summaryrefslogtreecommitdiff
path: root/swiftclient/service.py
diff options
context:
space:
mode:
Diffstat (limited to 'swiftclient/service.py')
-rw-r--r--swiftclient/service.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/swiftclient/service.py b/swiftclient/service.py
index e905ea6..dd71409 100644
--- a/swiftclient/service.py
+++ b/swiftclient/service.py
@@ -196,7 +196,7 @@ _default_global_options = _build_default_global_options()
_default_local_options = {
'sync_to': None,
'sync_key': None,
- 'use_slo': False,
+ 'use_slo': None,
'segment_size': None,
'segment_container': None,
'leave_segments': False,
@@ -1467,7 +1467,7 @@ class SwiftService:
'meta': [],
'header': [],
'segment_size': None,
- 'use_slo': False,
+ 'use_slo': True,
'segment_container': None,
'leave_segments': False,
'changed': None,
@@ -1493,6 +1493,18 @@ class SwiftService:
except ValueError:
raise SwiftError('Segment size should be an integer value')
+ if segment_size and options['use_slo'] is None:
+ try:
+ cap_result = self.capabilities()
+ except ClientException:
+ # pre-info swift, maybe? assume no slo middleware
+ options['use_slo'] = False
+ else:
+ if not cap_result['success']:
+ options['use_slo'] = False
+ else:
+ options['use_slo'] = 'slo' in cap_result['capabilities']
+
# Incase we have a psudeo-folder path for <container> arg, derive
# the container name from the top path and prepend the rest to
# the object name. (same as passing --object-name).