Revise trust_id param for sdk connection

trust_id parameter is now transmitted to sdk driver as a UUID string
rather than a list of UUID. This change is to keep compatible with
Juno environment.

Change-Id: I2fff2b3b5979fc26fcb86170e27211f3688a31ef
This commit is contained in:
yanyanhu 2016-02-24 04:24:50 -05:00
parent a868d690ee
commit 845cbcc9ee
5 changed files with 6 additions and 6 deletions

View File

@ -95,10 +95,10 @@ class Receiver(object):
# use object owner if request is from admin
cred = db_api.cred_get(context, cluster.user, cluster.project)
trust_id = cred['cred']['openstack']['trust']
cdata['trust_id'] = [trust_id]
cdata['trust_id'] = trust_id
else:
# otherwise, use context user
cdata['trust_id'] = [context.trusts]
cdata['trust_id'] = context.trusts
kwargs['id'] = uuidutils.generate_uuid()
kwargs['actor'] = cdata

View File

@ -288,6 +288,6 @@ class Policy(object):
cluster.user, cluster.project)
if cred is None:
raise exception.TrustNotFound(trustor=cluster.user)
params['trust_id'] = [cred.cred['openstack']['trust']]
params['trust_id'] = cred.cred['openstack']['trust']
return params

View File

@ -267,7 +267,7 @@ class Profile(object):
# This is supposed to be trust-based authentication
params = copy.deepcopy(self.context)
params['trust_id'] = [trust_id]
params['trust_id'] = trust_id
return params

View File

@ -440,7 +440,7 @@ class TestPolicyBase(base.SenlinTestCase):
'username': 'senlin',
'user_domain_name': 'default',
'password': '123',
'trust_id': ['TRUST_ID']
'trust_id': 'TRUST_ID'
}
res = policy._build_conn_params(cluster)
self.assertEqual(expected_result, res)

View File

@ -565,7 +565,7 @@ class TestProfileBase(base.SenlinTestCase):
res = profile._build_conn_params(user, project)
expected = {
'foo': 'bar',
'trust_id': ['TRUST_ID'],
'trust_id': 'TRUST_ID',
}
self.assertEqual(expected, res)
mock_current.assert_called_once_with()