diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-11-13 03:30:01 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-11-13 03:30:01 +0000 |
commit | 202bbab2d06b9ef751fba306effd09f3bae8f383 (patch) | |
tree | 50a64b15194fe95b82d3c9b6e262bfcc40cd74a7 /swiftclient/shell.py | |
parent | f99e71da0fa80b2110887a9694512c2fcaddc191 (diff) | |
parent | 95056d1ef49730d98eda1fc246b7e4bb1070a311 (diff) | |
download | python-swiftclient-202bbab2d06b9ef751fba306effd09f3bae8f383.tar.gz |
Merge "Make swift post output an error message when failing"
Diffstat (limited to 'swiftclient/shell.py')
-rwxr-xr-x | swiftclient/shell.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/swiftclient/shell.py b/swiftclient/shell.py index 015c9d9..2c627ad 100755 --- a/swiftclient/shell.py +++ b/swiftclient/shell.py @@ -547,8 +547,7 @@ If the container is not found, it will be created automatically. Positional arguments: [container] Name of container to post to. - [object] Name of object to post. Specify multiple times - for multiple objects. + [object] Name of object to post. Optional arguments: --read-acl <acl> Read ACL for containers. Quick summary of ACL syntax: @@ -600,7 +599,7 @@ def st_post(parser, args, output_manager): with SwiftService(options=_opts) as swift: try: if not args: - swift.post() + result = swift.post() else: container = args[0] if '/' in container: @@ -616,15 +615,16 @@ def st_post(parser, args, output_manager): results_iterator = swift.post( container=container, objects=objects ) - for result in results_iterator: # only 1 result - if not result["success"]: - raise(result["error"]) + result = next(results_iterator) else: output_manager.error( 'Usage: %s post %s\n%s', BASENAME, st_post_options, st_post_help) + return else: - swift.post(container=container) + result = swift.post(container=container) + if not result["success"]: + raise(result["error"]) except SwiftError as e: output_manager.error(e.value) |