From 9593d4b58a5e9f240e26d7873d3cc251c7d51f71 Mon Sep 17 00:00:00 2001 From: Alistair Coles Date: Mon, 29 Sep 2014 18:26:33 +0100 Subject: 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 --- swiftclient/multithreading.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'swiftclient/multithreading.py') 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): """ -- cgit v1.2.1