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>
|
Salvatore Orlando <salvatore.orlando@eu.citrix.com>
|
||||||
Sandy Walsh <sandy.walsh@rackspace.com>
|
Sandy Walsh <sandy.walsh@rackspace.com>
|
||||||
Sateesh Chodapuneedi <sateesh.chodapuneedi@citrix.com>
|
Sateesh Chodapuneedi <sateesh.chodapuneedi@citrix.com>
|
||||||
|
Scott Moser <smoser@ubuntu.com>
|
||||||
Soren Hansen <soren.hansen@rackspace.com>
|
Soren Hansen <soren.hansen@rackspace.com>
|
||||||
Thierry Carrez <thierry@openstack.org>
|
Thierry Carrez <thierry@openstack.org>
|
||||||
Todd Willey <todd@ansolabs.com>
|
Todd Willey <todd@ansolabs.com>
|
||||||
|
@@ -414,8 +414,11 @@ class ProjectCommands(object):
|
|||||||
except (exception.UserNotFound, exception.ProjectNotFound) as ex:
|
except (exception.UserNotFound, exception.ProjectNotFound) as ex:
|
||||||
print ex
|
print ex
|
||||||
raise
|
raise
|
||||||
with open(filename, 'w') as f:
|
if filename == "-":
|
||||||
f.write(rc)
|
sys.stdout.write(rc)
|
||||||
|
else:
|
||||||
|
with open(filename, 'w') as f:
|
||||||
|
f.write(rc)
|
||||||
|
|
||||||
def list(self, username=None):
|
def list(self, username=None):
|
||||||
"""Lists all projects
|
"""Lists all projects
|
||||||
@@ -465,8 +468,11 @@ class ProjectCommands(object):
|
|||||||
arguments: project_id user_id [filename='nova.zip]"""
|
arguments: project_id user_id [filename='nova.zip]"""
|
||||||
try:
|
try:
|
||||||
zip_file = self.manager.get_credentials(user_id, project_id)
|
zip_file = self.manager.get_credentials(user_id, project_id)
|
||||||
with open(filename, 'w') as f:
|
if filename == "-":
|
||||||
f.write(zip_file)
|
sys.stdout.write(zip_file)
|
||||||
|
else:
|
||||||
|
with open(filename, 'w') as f:
|
||||||
|
f.write(zip_file)
|
||||||
except (exception.UserNotFound, exception.ProjectNotFound) as ex:
|
except (exception.UserNotFound, exception.ProjectNotFound) as ex:
|
||||||
print ex
|
print ex
|
||||||
raise
|
raise
|
||||||
|
Reference in New Issue
Block a user