summaryrefslogtreecommitdiff
path: root/icktool
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2018-04-22 15:47:03 +0300
committerLars Wirzenius <liw@liw.fi>2018-04-22 15:47:03 +0300
commitac29df9a56ef6ce920e31070ac209cf2d4865d57 (patch)
treed7a41f1ff27e3381b0dca29674aa1c6b33f2e3ba /icktool
parentde66501367c1ba4289be21e3a681776f7506d89d (diff)
downloadick2-ac29df9a56ef6ce920e31070ac209cf2d4865d57.tar.gz
Change: icktool make-it-so can read descriptions from named files
Diffstat (limited to 'icktool')
-rwxr-xr-xicktool16
1 files changed, 12 insertions, 4 deletions
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: