diff options
| author | Scott Moser <smoser@ubuntu.com> | 2011-07-13 17:16:27 -0400 |
|---|---|---|
| committer | Scott Moser <smoser@ubuntu.com> | 2011-07-13 17:16:27 -0400 |
| commit | b9ea0f43c186d5fbc232b0ddd11c3e64898136ab (patch) | |
| tree | d2fc6eb095c921db3e608c9fc20e2f42c6a83f74 | |
| parent | 326074c903e8ec03b28154ea2547cf1dd00cdbac (diff) | |
| download | nova-b9ea0f43c186d5fbc232b0ddd11c3e64898136ab.tar.gz nova-b9ea0f43c186d5fbc232b0ddd11c3e64898136ab.tar.xz nova-b9ea0f43c186d5fbc232b0ddd11c3e64898136ab.zip | |
support '-' to indicate stdout in nova-manage project 'environment' and 'zip'
This just adds support to do:
nova-manage project zip test-project admin - > out.zip
nova-manage project environment test-project admin - | grep NOVA_URL
| -rwxr-xr-x | bin/nova-manage | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/bin/nova-manage b/bin/nova-manage index 7dfe91698..b5247f8c3 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 == "-": + f = sys.stdout + else: + f = open(filename, 'w') + 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 == "-": + f = sys.stdout + else: + f = open(filename, 'w') + f.write(zip_file) except (exception.UserNotFound, exception.ProjectNotFound) as ex: print ex raise |
