diff options
author | Lars Wirzenius <liw@liw.fi> | 2018-04-22 15:47:03 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2018-04-22 15:47:03 +0300 |
commit | ac29df9a56ef6ce920e31070ac209cf2d4865d57 (patch) | |
tree | d7a41f1ff27e3381b0dca29674aa1c6b33f2e3ba | |
parent | de66501367c1ba4289be21e3a681776f7506d89d (diff) | |
download | ick2-ac29df9a56ef6ce920e31070ac209cf2d4865d57.tar.gz |
Change: icktool make-it-so can read descriptions from named files
-rw-r--r-- | NEWS | 3 | ||||
-rwxr-xr-x | icktool | 16 |
2 files changed, 15 insertions, 4 deletions
@@ -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 ---------------------------------- @@ -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: |