summaryrefslogtreecommitdiff
path: root/swiftclient/multithreading.py
diff options
context:
space:
mode:
authorAlistair Coles <alistair.coles@hp.com>2014-09-29 18:26:33 +0100
committerAlistair Coles <alistair.coles@hp.com>2015-01-06 16:13:39 +0000
commit9593d4b58a5e9f240e26d7873d3cc251c7d51f71 (patch)
treebf2e4135070d7afe5d2bc6f16c29668773967400 /swiftclient/multithreading.py
parent5d5701870702a554dcea61213999670ee15f4ea8 (diff)
downloadpython-swiftclient-9593d4b58a5e9f240e26d7873d3cc251c7d51f71.tar.gz
Fix cross account upload using --os-storage-url
Removes an account stat from the object upload path. This stat fails when user is not account admin even though the user may have container ACL permission to write objects. Reduces the severity of the CLI output message when upload fails to create the given container (this is not an error since the container may exist - the user just does not have permission to PUT or POST the container). Changes the 'swift upload' exit return code from 1 to 0 if container PUT fails but object PUT succeeds. For segment uploads, makes the attempt to create the segment container conditional on it not being the same as the manifest container. This avoids an unnecessary container PUT. Fixes another bug that became apparent: with segmented upload a container HEAD may be attempted to determine the policy to be used for the segment container. When this failed the result dict has headers=None which was causing an exception in the shell result handler. Add unit tests for object upload/download and container list with --os-storage-url option. Closes-Bug: #1371650 Change-Id: If1f8a02ee7459ea2158ffa6e958f67d299ec529e
Diffstat (limited to 'swiftclient/multithreading.py')
-rw-r--r--swiftclient/multithreading.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/swiftclient/multithreading.py b/swiftclient/multithreading.py
index ade0f7b..6e7f143 100644
--- a/swiftclient/multithreading.py
+++ b/swiftclient/multithreading.py
@@ -96,10 +96,16 @@ class OutputManager(object):
item = item.encode('utf8')
print(item, file=stream)
- def _print_error(self, item):
- self.error_count += 1
+ def _print_error(self, item, count=1):
+ self.error_count += count
return self._print(item, stream=self.error_stream)
+ def warning(self, msg, *fmt_args):
+ # print to error stream but do not increment error count
+ if fmt_args:
+ msg = msg % fmt_args
+ self.error_print_pool.submit(self._print_error, msg, count=0)
+
class MultiThreadingManager(object):
"""