diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-10-31 16:46:31 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-10-31 16:46:31 +0000 |
commit | 08fc1bdccc3b4b64384891bbe70a7637935314e1 (patch) | |
tree | 5b24bbe47a1572cd1964fcf6d834c8d44f3b4825 | |
parent | deb1e31016ca0c52aef34017d12843d9b754bb53 (diff) | |
parent | 266a7efbad9bf733de19b92174baf8768fc03d4b (diff) | |
download | python-saharaclient-08fc1bdccc3b4b64384891bbe70a7637935314e1.tar.gz |
Merge "Optimize command job-binary-download"
-rw-r--r-- | saharaclient/osc/v1/job_binaries.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/saharaclient/osc/v1/job_binaries.py b/saharaclient/osc/v1/job_binaries.py index e828084..30ad2e9 100644 --- a/saharaclient/osc/v1/job_binaries.py +++ b/saharaclient/osc/v1/job_binaries.py @@ -414,15 +414,15 @@ class DownloadJobBinary(command.Command): if not parsed_args.file: parsed_args.file = parsed_args.job_binary - jb_id = utils.get_resource_id( - client.job_binaries, parsed_args.job_binary) - data = client.job_binaries.get_file(jb_id) - if path.exists(parsed_args.file): msg = ('File "%s" already exists. Chose another one with ' '--file argument.' % parsed_args.file) raise exceptions.CommandError(msg) else: + jb_id = utils.get_resource_id( + client.job_binaries, parsed_args.job_binary) + data = client.job_binaries.get_file(jb_id) + with open(parsed_args.file, 'w') as f: f.write(data) sys.stdout.write( |