Set endpoint_override from endpoint with noauth
When noauth is used via the 'none' auth_type, the endpoint given actually wants to get passed to keystoneauth as an endpoint_override for that service, otherwise discovery from keystoneauth no worky. Change-Id: I005a6d9b195a6cceae855d1392a29f12d6782a55
This commit is contained in:
@@ -278,6 +278,11 @@ class CloudRegion(object):
|
|||||||
value = self._get_config('endpoint_override', service_type)
|
value = self._get_config('endpoint_override', service_type)
|
||||||
if not value:
|
if not value:
|
||||||
value = self._get_config('endpoint', service_type)
|
value = self._get_config('endpoint', service_type)
|
||||||
|
if not value and self.config.get('auth_type') == 'none':
|
||||||
|
# If endpoint is given and we're using the none auth type,
|
||||||
|
# then the endpoint value is the endpoint_override for every
|
||||||
|
# service.
|
||||||
|
value = self.config.get('auth', {}).get('endpoint')
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def get_connect_retries(self, service_type):
|
def get_connect_retries(self, service_type):
|
||||||
|
@@ -64,6 +64,26 @@ class TestOpenStackCloudOperatorNoAuth(base.TestCase):
|
|||||||
|
|
||||||
self.assert_calls()
|
self.assert_calls()
|
||||||
|
|
||||||
|
def test_ironic_noauth_auth_endpoint(self):
|
||||||
|
"""Test noauth selection for Ironic in OpenStackCloud
|
||||||
|
|
||||||
|
Sometimes people also write clouds.yaml files that look like this:
|
||||||
|
|
||||||
|
::
|
||||||
|
clouds:
|
||||||
|
bifrost:
|
||||||
|
auth_type: "none"
|
||||||
|
endpoint: https://bare-metal.example.com
|
||||||
|
"""
|
||||||
|
self.cloud_noauth = openstack.connect(
|
||||||
|
auth_type='none',
|
||||||
|
endpoint='https://bare-metal.example.com/v1',
|
||||||
|
)
|
||||||
|
|
||||||
|
self.cloud_noauth.list_machines()
|
||||||
|
|
||||||
|
self.assert_calls()
|
||||||
|
|
||||||
def test_ironic_noauth_admin_token_auth_type(self):
|
def test_ironic_noauth_admin_token_auth_type(self):
|
||||||
"""Test noauth selection for Ironic in OpenStackCloud
|
"""Test noauth selection for Ironic in OpenStackCloud
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user