Fix Swift Authentication for log commands

Updates the swift authentication handling in v1/instances:_get_swift_client
to set auth_version as appropriate.

Change-Id: I39a22eeb4a9c371f333f81a69d4d429805b935f9
Fixes-bug: 1651502
This commit is contained in:
Morgan Jones 2016-12-20 11:18:33 -05:00
parent 20eb0a4bd1
commit 7420dbbe3d
1 changed files with 5 additions and 1 deletions

View File

@ -72,11 +72,14 @@ class Instances(base.ManagerWithFind):
user = self.api.client.auth._username
key = self.api.client.auth._password
tenant_name = self.api.client.auth._project_name
auth_version = "3.0"
else:
auth_url = self.api.client.auth_url
user = self.api.client.username
key = self.api.client.password
tenant_name = self.api.client.tenant
auth_version = "2.0"
# remove '/tokens' from the end of auth_url so it works for swift
token_str = "/tokens"
if auth_url.endswith(token_str):
@ -85,7 +88,8 @@ class Instances(base.ManagerWithFind):
os_options = {'tenant_name': tenant_name, 'region_name': region_name}
return swift_client.Connection(
auth_url, user, key, auth_version="2.0", os_options=os_options)
auth_url, user, key, auth_version=auth_version,
os_options=os_options)
# TODO(mriedem): Remove slave_of after liberty-eol for Trove.
def create(self, name, flavor_id, volume=None, databases=None, users=None,