Pass token and endpoint to swift os_options

get_capabilities runs through a code path in swiftclient where the auth
token pieces need to be in os_options. We also need to tell swift to use
keystone auth, not swift auth.

Change-Id: I3768f40059b6f6591f67e47a3202ed17779d0fe8
This commit is contained in:
Monty Taylor
2015-06-18 09:01:31 -04:00
parent 2e67397e4f
commit 11059de528
2 changed files with 13 additions and 4 deletions

View File

@@ -610,7 +610,11 @@ class OpenStackCloud(object):
self._swift_client = swift_client.Connection(
preauthurl=endpoint,
preauthtoken=token,
os_options=dict(region_name=self.region_name),
auth_version=self.api_versions['identity'],
os_options=dict(
auth_token=token,
object_storage_url=endpoint,
region_name=self.region_name),
)
except OpenStackCloudException:
raise

View File

@@ -36,9 +36,14 @@ class TestShade(base.TestCase):
endpoint_mock.return_value = 'danzig'
auth_mock.return_value = 'yankee'
self.cloud.swift_client
swift_mock.assert_called_with(preauthurl='danzig',
preauthtoken='yankee',
os_options=mock.ANY)
swift_mock.assert_called_with(
preauthurl='danzig',
preauthtoken='yankee',
auth_version='2',
os_options=dict(
object_storage_url='danzig',
auth_token='yankee',
region_name=''))
@mock.patch.object(shade.OpenStackCloud, 'auth_token',
new_callable=mock.PropertyMock)