allow stdin to be used instead of filename for Tosca run.py and destroy.py
Change-Id: Ib1dd05859509a7590735f6dc535ddf85b870e3c3
diff --git a/xos/tosca/destroy.py b/xos/tosca/destroy.py
index 6fa9101..0c65600 100644
--- a/xos/tosca/destroy.py
+++ b/xos/tosca/destroy.py
@@ -24,7 +24,12 @@
u = User.objects.get(email=username)
- xt = XOSTosca(file(template_name).read(), parent_dir=currentdir, log_to_console=True)
+ if template_name=="-":
+ tosca_source = sys.stdin.read()
+ else:
+ tosca_source = file(template_name).read()
+
+ xt = XOSTosca(tosca_source, parent_dir=currentdir, log_to_console=True)
xt.destroy(u)
if __name__=="__main__":
diff --git a/xos/tosca/run.py b/xos/tosca/run.py
index 0ba2df9..ff8b68d 100755
--- a/xos/tosca/run.py
+++ b/xos/tosca/run.py
@@ -27,7 +27,12 @@
else:
u = User.objects.get(email=username)
- xt = XOSTosca(file(template_name).read(), parent_dir=currentdir, log_to_console=True)
+ if template_name=="-":
+ tosca_source = sys.stdin.read()
+ else:
+ tosca_source = file(template_name).read()
+
+ xt = XOSTosca(tosca_source, parent_dir=currentdir, log_to_console=True)
xt.execute(u)
if __name__=="__main__":