← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~dag-stenstad/duplicity/swift_authversion_3_support into lp:duplicity

 

Dag Stenstad has proposed merging lp:~dag-stenstad/duplicity/swift_authversion_3_support into lp:duplicity.

Commit message:
Added support for Openstack Identity v3 in the Swift backend.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~dag-stenstad/duplicity/swift_authversion_3_support/+merge/266638

Added support for the Openstack Identity v3 API in the Swift backend.

The current version only supports Swift v1 and v2.

It has not had a lot of testing, but it works find on our cloud wich needs v3 auth to work.

If the reviewer needs access to a cloud with Swift v3 activated, please get in touch.
-- 
Your team duplicity-team is requested to review the proposed merge of lp:~dag-stenstad/duplicity/swift_authversion_3_support into lp:duplicity.
=== modified file 'duplicity/backends/swiftbackend.py'
--- duplicity/backends/swiftbackend.py	2015-05-31 15:07:59 +0000
+++ duplicity/backends/swiftbackend.py	2015-08-01 01:18:57 +0000
@@ -63,14 +63,30 @@
             conn_kwargs['key'] = os.environ['SWIFT_PASSWORD']
             conn_kwargs['authurl'] = os.environ['SWIFT_AUTHURL']
 
+        os_options = {}
+
         if 'SWIFT_AUTHVERSION' in os.environ:
             conn_kwargs['auth_version'] = os.environ['SWIFT_AUTHVERSION']
+            if os.environ['SWIFT_AUTHVERSION'] == '3':
+                if 'SWIFT_USER_DOMAIN_NAME' in os.environ:
+                    os_options.update({'user_domain_name': os.environ['SWIFT_USER_DOMAIN_NAME']})
+                if 'SWIFT_USER_DOMAIN_ID' in os.environ:
+                    os_options.update({'user_domain_id': os.environ['SWIFT_USER_DOMAIN_ID']})
+                if 'SWIFT_PROJECT_DOMAIN_NAME' in os.environ:
+                    os_options.update({'project_domain_name': os.environ['SWIFT_PROJECT_DOMAIN_NAME']})
+                if 'SWIFT_PROJECT_DOMAIN_ID' in os.environ:
+                    os_options.update({'project_domain_id': os.environ['SWIFT_PROJECT_DOMAIN_ID']})
+                if 'SWIFT_TENANTNAME' in os.environ:
+                    os_options.update({'tenant_name': os.environ['SWIFT_TENANTNAME']})
+
         else:
             conn_kwargs['auth_version'] = '1'
         if 'SWIFT_TENANTNAME' in os.environ:
             conn_kwargs['tenant_name'] = os.environ['SWIFT_TENANTNAME']
         if 'SWIFT_REGIONNAME' in os.environ:
-            conn_kwargs['os_options'] = {'region_name': os.environ['SWIFT_REGIONNAME']}
+            os_options.update({'region_name': os.environ['SWIFT_REGIONNAME']})
+
+        conn_kwargs['os_options'] = os_options
 
         self.container = parsed_url.path.lstrip('/')
 


Follow ups