Merge "Add endpoint_override parameter to python-magnumclient"
This commit is contained in:
commit
a7e876b68b
@ -129,3 +129,33 @@ class ClientTest(testtools.TestCase):
|
||||
project_id=None,
|
||||
project_name=None)
|
||||
http_client.assert_not_called()
|
||||
|
||||
@mock.patch('magnumclient.common.httpclient.SessionClient')
|
||||
@mock.patch('keystoneauth1.session.Session')
|
||||
def test_init_with_endpoint_override(self, mock_session, http_client):
|
||||
session = mock.Mock()
|
||||
client.Client(session=session, endpoint_override='magnumurl')
|
||||
mock_session.assert_not_called()
|
||||
http_client.assert_called_once_with(
|
||||
interface='public',
|
||||
region_name=None,
|
||||
service_name=None,
|
||||
service_type='container',
|
||||
session=session,
|
||||
endpoint_override='magnumurl')
|
||||
|
||||
@mock.patch('magnumclient.common.httpclient.SessionClient')
|
||||
@mock.patch('keystoneauth1.session.Session')
|
||||
def test_init_with_magnum_url_and_endpoint_override(self, mock_session,
|
||||
http_client):
|
||||
session = mock.Mock()
|
||||
client.Client(session=session, magnum_url='magnumurl',
|
||||
endpoint_override='magnumurl_override')
|
||||
mock_session.assert_not_called()
|
||||
http_client.assert_called_once_with(
|
||||
interface='public',
|
||||
region_name=None,
|
||||
service_name=None,
|
||||
service_type='container',
|
||||
session=session,
|
||||
endpoint_override='magnumurl')
|
||||
|
@ -30,7 +30,8 @@ from magnumclient.v1 import services
|
||||
class Client(object):
|
||||
def __init__(self, username=None, api_key=None, project_id=None,
|
||||
project_name=None, auth_url=None, magnum_url=None,
|
||||
endpoint_type=None, service_type='container',
|
||||
endpoint_type=None, endpoint_override=None,
|
||||
service_type='container',
|
||||
region_name=None, input_auth_token=None,
|
||||
session=None, password=None, auth_type='password',
|
||||
interface='public', service_name=None, insecure=False,
|
||||
@ -46,6 +47,11 @@ class Client(object):
|
||||
if endpoint_type:
|
||||
interface = endpoint_type
|
||||
|
||||
# fix (yolanda): os-cloud-config is using endpoint_override
|
||||
# instead of magnum_url
|
||||
if endpoint_override and not magnum_url:
|
||||
magnum_url = endpoint_override
|
||||
|
||||
if magnum_url and input_auth_token:
|
||||
auth_type = 'admin_token'
|
||||
session = None
|
||||
|
Loading…
Reference in New Issue
Block a user