From ac29df9a56ef6ce920e31070ac209cf2d4865d57 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 22 Apr 2018 15:47:03 +0300 Subject: Change: icktool make-it-so can read descriptions from named files --- NEWS | 3 +++ icktool | 16 ++++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/NEWS b/NEWS index 498c60d..3ce825d 100644 --- a/NEWS +++ b/NEWS @@ -26,6 +26,9 @@ Version 0.45+git, not yet released * New command: `icktool show-latest-log PROJECT`. +* `icktool make-it-so` now accepts filename from which to read project + and pipeline descriptions. + Version 0.45, released 2018-04-21 ---------------------------------- diff --git a/icktool b/icktool index 9230dd4..f384814 100755 --- a/icktool +++ b/icktool @@ -382,16 +382,24 @@ class BuildGraphCommand(Command): class MakeItSoCommand(Command): def execute(self, args): - obj = self._read_object() + if not args: + obj = self._read_object(sys.stdin) + self._make_it_so(obj) + else: + for filename in args: + with open(filename) as f: + obj = self._read_object(f) + self._make_it_so(obj) + def _read_object(self, f): + return yaml.load(f) + + def _make_it_so(self, obj): self._create_resources( '/projects', 'project', obj.get('projects', [])) self._create_resources( '/pipelines', 'pipeline', obj.get('pipelines', [])) - def _read_object(self): - return yaml.load(sys.stdin) - def _create_resources(self, path, name_field, objs): for obj in objs: try: -- cgit v1.2.1