summaryrefslogtreecommitdiff
path: root/swiftclient/shell.py
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2015-02-02 08:30:40 +0000
committerGerrit Code Review <review@openstack.org>2015-02-02 08:30:40 +0000
commit21473f1bc475fa69aa9d1cdd6b60cc827c4f7f1b (patch)
treea644c4ca51a352f11bf16d4ccfd2c7a90bc0f14d /swiftclient/shell.py
parenteef91b35139411fcef31855ce0ebe4407a2de70b (diff)
parent9593d4b58a5e9f240e26d7873d3cc251c7d51f71 (diff)
downloadpython-swiftclient-21473f1bc475fa69aa9d1cdd6b60cc827c4f7f1b.tar.gz
Merge "Fix cross account upload using --os-storage-url"
Diffstat (limited to 'swiftclient/shell.py')
-rwxr-xr-xswiftclient/shell.py37
1 files changed, 15 insertions, 22 deletions
diff --git a/swiftclient/shell.py b/swiftclient/shell.py
index c3f4628..6b3ee3f 100755
--- a/swiftclient/shell.py
+++ b/swiftclient/shell.py
@@ -817,16 +817,14 @@ def st_upload(parser, args, output_manager):
)
else:
error = r['error']
- if isinstance(error, SwiftError):
- output_manager.error("%s" % error)
- elif isinstance(error, ClientException):
- if r['action'] == "create_container":
- if 'X-Storage-Policy' in r['headers']:
- output_manager.error(
- 'Error trying to create container %s with '
- 'Storage Policy %s', container,
- r['headers']['X-Storage-Policy'].strip()
- )
+ if 'action' in r and r['action'] == "create_container":
+ # it is not an error to be unable to create the
+ # container so print a warning and carry on
+ if isinstance(error, ClientException):
+ if (r['headers'] and
+ 'X-Storage-Policy' in r['headers']):
+ msg = ' with Storage Policy %s' % \
+ r['headers']['X-Storage-Policy'].strip()
else:
msg = ' '.join(str(x) for x in (
error.http_status, error.http_reason)
@@ -835,20 +833,15 @@ def st_upload(parser, args, output_manager):
if msg:
msg += ': '
msg += error.http_response_content[:60]
- output_manager.error(
- 'Error trying to create container %r: %s',
- container, msg
- )
+ msg = ': %s' % msg
else:
- output_manager.error("%s" % error)
+ msg = ': %s' % error
+ output_manager.warning(
+ 'Warning: failed to create container '
+ '%r%s', container, msg
+ )
else:
- if r['action'] == "create_container":
- output_manager.error(
- 'Error trying to create container %r: %s',
- container, error
- )
- else:
- output_manager.error("%s" % error)
+ output_manager.error("%s" % error)
except SwiftError as e:
output_manager.error("%s" % e)