add support to write to stdout rather than file if '-' is specified.
see bug 810157
This commit is contained in:
1
Authors
1
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>
|
||||
|
@@ -414,6 +414,9 @@ class ProjectCommands(object):
|
||||
except (exception.UserNotFound, exception.ProjectNotFound) as ex:
|
||||
print ex
|
||||
raise
|
||||
if filename == "-":
|
||||
sys.stdout.write(rc)
|
||||
else:
|
||||
with open(filename, 'w') as f:
|
||||
f.write(rc)
|
||||
|
||||
@@ -465,6 +468,9 @@ class ProjectCommands(object):
|
||||
arguments: project_id user_id [filename='nova.zip]"""
|
||||
try:
|
||||
zip_file = self.manager.get_credentials(user_id, project_id)
|
||||
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:
|
||||
|
Reference in New Issue
Block a user