summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2011-07-14 19:13:15 +0000
committerTarmac <>2011-07-14 19:13:15 +0000
commitb5af7c4df50812ba36a68b9a658f7df03ced0b1e (patch)
tree19745ad03a916af937f30f40c9d06cde0a549397
parentfa2cdbc5d4201ace6c1a6459bbd653b0b63b7667 (diff)
parentee143766a32486664d47aee11f792854cbedd4ff (diff)
downloadnova-b5af7c4df50812ba36a68b9a658f7df03ced0b1e.tar.gz
nova-b5af7c4df50812ba36a68b9a658f7df03ced0b1e.tar.xz
nova-b5af7c4df50812ba36a68b9a658f7df03ced0b1e.zip
add support to write to stdout rather than file if '-' is specified.
see bug 810157
-rw-r--r--Authors1
-rwxr-xr-xbin/nova-manage14
2 files changed, 11 insertions, 4 deletions
diff --git a/Authors b/Authors
index 2e50cfbe0..a366cec87 100644
--- a/Authors
+++ b/Authors
@@ -85,6 +85,7 @@ Ryan Lucio <rlucio@internap.com>
Salvatore Orlando <salvatore.orlando@eu.citrix.com>
Sandy Walsh <sandy.walsh@rackspace.com>
Sateesh Chodapuneedi <sateesh.chodapuneedi@citrix.com>
+Scott Moser <smoser@ubuntu.com>
Soren Hansen <soren.hansen@rackspace.com>
Thierry Carrez <thierry@openstack.org>
Todd Willey <todd@ansolabs.com>
diff --git a/bin/nova-manage b/bin/nova-manage
index 94ab22092..b892d958a 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -414,8 +414,11 @@ class ProjectCommands(object):
except (exception.UserNotFound, exception.ProjectNotFound) as ex:
print ex
raise
- with open(filename, 'w') as f:
- f.write(rc)
+ if filename == "-":
+ sys.stdout.write(rc)
+ else:
+ with open(filename, 'w') as f:
+ f.write(rc)
def list(self, username=None):
"""Lists all projects
@@ -465,8 +468,11 @@ class ProjectCommands(object):
arguments: project_id user_id [filename='nova.zip]"""
try:
zip_file = self.manager.get_credentials(user_id, project_id)
- with open(filename, 'w') as f:
- f.write(zip_file)
+ if filename == "-":
+ sys.stdout.write(zip_file)
+ else:
+ with open(filename, 'w') as f:
+ f.write(zip_file)
except (exception.UserNotFound, exception.ProjectNotFound) as ex:
print ex
raise