Repository: libcloud Updated Branches: refs/heads/trunk 8164de7de -> 1ae9f1c6a
Ceph S3 Outscale storage driver fixes - Simplify the Outscale driver - Remove unused Outscale connection classes - Fix default signature v2 issue with the Outscale driver Closes #792 Signed-off-by: Javier M. Mellid <[email protected]> Signed-off-by: Tomaz Muraus <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/0062f8b2 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/0062f8b2 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/0062f8b2 Branch: refs/heads/trunk Commit: 0062f8b2c39fe913c54a90de8f0b928f3a226c2a Parents: 8164de7 Author: Javier M. Mellid <[email protected]> Authored: Fri May 20 10:44:30 2016 +0000 Committer: Tomaz Muraus <[email protected]> Committed: Sun May 22 12:05:58 2016 +0200 ---------------------------------------------------------------------- libcloud/storage/drivers/rgw.py | 39 +++++++++--------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/0062f8b2/libcloud/storage/drivers/rgw.py ---------------------------------------------------------------------- diff --git a/libcloud/storage/drivers/rgw.py b/libcloud/storage/drivers/rgw.py index 0f16ac9..f7d053e 100644 --- a/libcloud/storage/drivers/rgw.py +++ b/libcloud/storage/drivers/rgw.py @@ -72,12 +72,16 @@ class S3RGWStorageDriver(S3StorageDriver): def __init__(self, key, secret=None, secure=True, host=None, port=None, api_version=None, region=S3_RGW_DEFAULT_REGION, **kwargs): + if host is None: raise LibcloudError('host required', driver=self) - self.name = 'Ceph RGW S3 (%s)' % (region) + + self.name = kwargs.pop('name', None) + if self.name is None: + self.name = 'Ceph RGW S3 (%s)' % (region) + self.ex_location_name = region self.region_name = region - self.signature_version = str(kwargs.pop('signature_version', DEFAULT_SIGNATURE_VERSION)) @@ -86,10 +90,11 @@ class S3RGWStorageDriver(S3StorageDriver): (self.signature_version)) if self.signature_version == '2': - self.connectionCls = S3RGWOutscaleConnectionAWS2 + self.connectionCls = S3RGWConnectionAWS2 elif self.signature_version == '4': - self.connectionCls = S3RGWOutscaleConnectionAWS4 + self.connectionCls = S3RGWConnectionAWS4 self.connectionCls.host = host + super(S3RGWStorageDriver, self).__init__(key, secret, secure, host, port, api_version, region, @@ -101,14 +106,6 @@ class S3RGWStorageDriver(S3StorageDriver): return kwargs -class S3RGWOutscaleConnectionAWS4(S3RGWConnectionAWS4): - pass - - -class S3RGWOutscaleConnectionAWS2(S3RGWConnectionAWS2): - pass - - class S3RGWOutscaleStorageDriver(S3RGWStorageDriver): def __init__(self, key, secret=None, secure=True, host=None, port=None, @@ -116,24 +113,8 @@ class S3RGWOutscaleStorageDriver(S3RGWStorageDriver): **kwargs): if region not in S3_RGW_OUTSCALE_HOSTS_BY_REGION: raise LibcloudError('Unknown region (%s)' % (region), driver=self) - - self.name = 'OUTSCALE Ceph RGW S3 (%s)' % (region) - self.ex_location_name = region - self.region_name = region - self.signature_version = str(kwargs.pop('signature_version', - DEFAULT_SIGNATURE_VERSION)) - - if self.signature_version not in ['2', '4']: - raise ValueError('Invalid signature_version: %s' % - (self.signature_version)) - - if self.signature_version == '2': - self.connectionCls = S3RGWOutscaleConnectionAWS2 - elif self.signature_version == '4': - self.connectionCls = S3RGWOutscaleConnectionAWS4 - host = S3_RGW_OUTSCALE_HOSTS_BY_REGION[region] - self.connectionCls.host = host + kwargs['name'] = 'OUTSCALE Ceph RGW S3 (%s)' % region super(S3RGWOutscaleStorageDriver, self).__init__(key, secret, secure, host, port, api_version, region,
