Fix functional CI failure

Keystone now close V2 API by default. We should
move our test to keystone v3.

Change-Id: I9e553a614654aa53a0209ae056946827f1e2e830
This commit is contained in:
wangxiyuan 2017-10-31 11:10:32 +08:00
parent 85cef9c8c8
commit d0fd8bc246
1 changed files with 5 additions and 7 deletions

View File

@ -75,22 +75,20 @@ class TestBase(testtools.TestCase):
def _setup_auth_params(self):
self.creds = self._credentials().get_auth_args()
# FIXME(flwang): Now we're hardcode the keystone auth version, since
# there is a 'bug' with the osc-config which is returning the auth_url
# without version. This should be fixed as long as the bug is fixed.
parsed_url = urllib_parse.urlparse(self.creds['auth_url'])
auth_url = self.creds['auth_url']
if not parsed_url.path or parsed_url.path == '/':
auth_url = urllib_parse.urljoin(self.creds['auth_url'], 'v2.0')
if (parsed_url.path == '/identity_v2_admin' or
parsed_url.path == '/identity'):
auth_url = '%s/v2.0' % auth_url
auth_url = urllib_parse.urljoin(self.creds['auth_url'], 'v3')
if parsed_url.path == '/identity':
auth_url = '%s/v3' % auth_url
self.conf['auth_opts']['backend'] = 'keystone'
options = {'os_username': self.creds['username'],
'os_user_domain_id': self.creds['user_domain_id'],
'os_password': self.creds['password'],
'os_project_name': self.creds['project_name'],
'os_project_id': '',
'os_project_domain_id': self.creds['project_domain_id'],
'os_auth_url': auth_url}
self.conf['auth_opts'].setdefault('options', {}).update(options)