diff options
author | Mahati Chamarthy <mahati.chamarthy@gmail.com> | 2014-10-01 12:42:56 +0530 |
---|---|---|
committer | Mahati Chamarthy <mahati.chamarthy@gmail.com> | 2014-10-28 21:33:58 +0530 |
commit | 51ed14d9aef827752ca6418318ad8af0e8d92253 (patch) | |
tree | 771c87f0acfab29a2d52b7f54e9393e2a9343ddb /swiftclient | |
parent | 43c1141baa6c5a5987fd4ab71d1c2299898ea251 (diff) | |
download | python-swiftclient-51ed14d9aef827752ca6418318ad8af0e8d92253.tar.gz |
Adds user friendly message when --segment-size is a non-integer
Change-Id: Ic2c062110b2fe2e725b0f4a4517a300cfbf663a8
Diffstat (limited to 'swiftclient')
-rw-r--r-- | swiftclient/service.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/swiftclient/service.py b/swiftclient/service.py index a91c605..4315295 100644 --- a/swiftclient/service.py +++ b/swiftclient/service.py @@ -1177,6 +1177,12 @@ class SwiftService(object): else: options = self._options + try: + segment_size = int(0 if options['segment_size'] is None else + options['segment_size']) + except ValueError: + raise SwiftError('Segment size should be an integer value') + # Does the account exist? account_stat = self.stat(options=options) if not account_stat["success"]: @@ -1204,7 +1210,7 @@ class SwiftService(object): res = r.result() yield res - if options['segment_size'] is not None: + if segment_size: seg_container = container + '_segments' if options['segment_container']: seg_container = options['segment_container'] |