Merge "Add trust info into heat params"
This commit is contained in:
commit
6fbae6c8ed
magnum
conductor
templates
tests/unit/conductor/handlers
@ -64,7 +64,9 @@ template_def_opts = [
|
||||
help=_('Enabled bay definition entry points.')),
|
||||
]
|
||||
|
||||
cfg.CONF.register_opts(template_def_opts, group='bay')
|
||||
CONF = cfg.CONF
|
||||
CONF.register_opts(template_def_opts, group='bay')
|
||||
CONF.import_opt('trustee_domain_id', 'magnum.common.keystone', group='trust')
|
||||
|
||||
|
||||
class ParameterMapping(object):
|
||||
@ -347,6 +349,19 @@ class BaseTemplateDefinition(TemplateDefinition):
|
||||
def template_path(self):
|
||||
pass
|
||||
|
||||
def get_params(self, context, baymodel, bay, **kwargs):
|
||||
extra_params = kwargs.pop('extra_params', {})
|
||||
extra_params['trustee_domain_id'] = CONF.trust.trustee_domain_id
|
||||
extra_params['trustee_user_id'] = bay.trustee_user_id
|
||||
extra_params['trustee_username'] = bay.trustee_username
|
||||
extra_params['trustee_password'] = bay.trustee_password
|
||||
extra_params['trust_id'] = bay.trust_id
|
||||
|
||||
return super(BaseTemplateDefinition,
|
||||
self).get_params(context, baymodel, bay,
|
||||
extra_params=extra_params,
|
||||
**kwargs)
|
||||
|
||||
def _get_user_token(self, context, osc, bay):
|
||||
"""Retrieve user token from the Heat stack or context.
|
||||
|
||||
|
@ -248,6 +248,33 @@ parameters:
|
||||
description: no proxies for docker
|
||||
default: ""
|
||||
|
||||
trustee_domain_id:
|
||||
type: string
|
||||
description: domain id of the trustee
|
||||
default: ""
|
||||
|
||||
trustee_user_id:
|
||||
type: string
|
||||
description: user id of the trustee
|
||||
default: ""
|
||||
|
||||
trustee_username:
|
||||
type: string
|
||||
description: username of the trustee
|
||||
default: ""
|
||||
|
||||
trustee_password:
|
||||
type: string
|
||||
description: password of the trustee
|
||||
default: ""
|
||||
hidden: true
|
||||
|
||||
trust_id:
|
||||
type: string
|
||||
description: id of the trust which is used by the trustee
|
||||
default: ""
|
||||
hidden: true
|
||||
|
||||
resources:
|
||||
|
||||
######################################################################
|
||||
|
@ -84,6 +84,33 @@ parameters:
|
||||
description: no proxies for docker
|
||||
default: ""
|
||||
|
||||
trustee_domain_id:
|
||||
type: string
|
||||
description: domain id of the trustee
|
||||
default: ""
|
||||
|
||||
trustee_user_id:
|
||||
type: string
|
||||
description: user id of the trustee
|
||||
default: ""
|
||||
|
||||
trustee_username:
|
||||
type: string
|
||||
description: username of the trustee
|
||||
default: ""
|
||||
|
||||
trustee_password:
|
||||
type: string
|
||||
description: password of the trustee
|
||||
default: ""
|
||||
hidden: true
|
||||
|
||||
trust_id:
|
||||
type: string
|
||||
description: id of the trust which is used by the trustee
|
||||
default: ""
|
||||
hidden: true
|
||||
|
||||
resources:
|
||||
|
||||
######################################################################
|
||||
|
@ -146,6 +146,33 @@ parameters:
|
||||
description: version of swarm used for swarm cluster
|
||||
default: 1.0.0
|
||||
|
||||
trustee_domain_id:
|
||||
type: string
|
||||
description: domain id of the trustee
|
||||
default: ""
|
||||
|
||||
trustee_user_id:
|
||||
type: string
|
||||
description: user id of the trustee
|
||||
default: ""
|
||||
|
||||
trustee_username:
|
||||
type: string
|
||||
description: username of the trustee
|
||||
default: ""
|
||||
|
||||
trustee_password:
|
||||
type: string
|
||||
description: password of the trustee
|
||||
default: ""
|
||||
hidden: true
|
||||
|
||||
trust_id:
|
||||
type: string
|
||||
description: id of the trust which is used by the trustee
|
||||
default: ""
|
||||
hidden: true
|
||||
|
||||
resources:
|
||||
|
||||
######################################################################
|
||||
|
@ -59,7 +59,14 @@ class TestBayConductorWithK8s(base.TestCase):
|
||||
'master_addresses': ['172.17.2.18'],
|
||||
'ca_cert_ref': 'http://barbican/v1/containers/xx-xx-xx-xx',
|
||||
'magnum_cert_ref': 'http://barbican/v1/containers/xx-xx-xx-xx',
|
||||
'trustee_username': 'fake_trustee',
|
||||
'trustee_password': 'fake_trustee_password',
|
||||
'trustee_user_id': '7b489f04-b458-4541-8179-6a48a553e656',
|
||||
'trust_id': 'bd11efc5-d4e2-4dac-bbce-25e348ddf7de'
|
||||
}
|
||||
cfg.CONF.set_override('trustee_domain_id',
|
||||
'3527620c-b220-4f37-9ebc-6e63a81a9b2f',
|
||||
group='trust')
|
||||
self.context.auth_url = 'http://192.168.10.10:5000/v3'
|
||||
self.context.user_name = 'fake_user'
|
||||
self.context.tenant = 'fake_tenant'
|
||||
@ -142,6 +149,11 @@ class TestBayConductorWithK8s(base.TestCase):
|
||||
'bay_uuid': self.bay_dict['uuid'],
|
||||
'magnum_url': self.mock_osc.magnum_url.return_value,
|
||||
'tls_disabled': False,
|
||||
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f',
|
||||
'trustee_username': 'fake_trustee',
|
||||
'trustee_password': 'fake_trustee_password',
|
||||
'trustee_user_id': '7b489f04-b458-4541-8179-6a48a553e656',
|
||||
'trust_id': 'bd11efc5-d4e2-4dac-bbce-25e348ddf7de'
|
||||
}
|
||||
if missing_attr is not None:
|
||||
expected.pop(mapping[missing_attr], None)
|
||||
@ -179,6 +191,11 @@ class TestBayConductorWithK8s(base.TestCase):
|
||||
'flannel_network_subnetlen': '26',
|
||||
'flannel_use_vxlan': 'yes',
|
||||
'tls_disabled': False,
|
||||
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f',
|
||||
'trustee_username': 'fake_trustee',
|
||||
'trustee_password': 'fake_trustee_password',
|
||||
'trustee_user_id': '7b489f04-b458-4541-8179-6a48a553e656',
|
||||
'trust_id': 'bd11efc5-d4e2-4dac-bbce-25e348ddf7de'
|
||||
}
|
||||
self.assertEqual(expected, definition)
|
||||
|
||||
@ -218,6 +235,11 @@ class TestBayConductorWithK8s(base.TestCase):
|
||||
'flannel_network_subnetlen': '26',
|
||||
'flannel_use_vxlan': 'yes',
|
||||
'tls_disabled': False,
|
||||
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f',
|
||||
'trustee_username': 'fake_trustee',
|
||||
'trustee_password': 'fake_trustee_password',
|
||||
'trustee_user_id': '7b489f04-b458-4541-8179-6a48a553e656',
|
||||
'trust_id': 'bd11efc5-d4e2-4dac-bbce-25e348ddf7de'
|
||||
}
|
||||
self.assertEqual(expected, definition)
|
||||
|
||||
@ -332,6 +354,11 @@ class TestBayConductorWithK8s(base.TestCase):
|
||||
'bay_uuid': self.bay_dict['uuid'],
|
||||
'magnum_url': self.mock_osc.magnum_url.return_value,
|
||||
'tls_disabled': False,
|
||||
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f',
|
||||
'trustee_username': 'fake_trustee',
|
||||
'trustee_password': 'fake_trustee_password',
|
||||
'trustee_user_id': '7b489f04-b458-4541-8179-6a48a553e656',
|
||||
'trust_id': 'bd11efc5-d4e2-4dac-bbce-25e348ddf7de'
|
||||
}
|
||||
self.assertEqual(expected, definition)
|
||||
reqget.assert_called_once_with('http://etcd/test?size=1')
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
import mock
|
||||
from mock import patch
|
||||
from oslo_config import cfg
|
||||
from oslo_service import loopingcall
|
||||
|
||||
from magnum.conductor.handlers import bay_conductor
|
||||
@ -49,7 +50,14 @@ class TestBayConductorWithMesos(base.TestCase):
|
||||
'node_addresses': ['172.17.2.4'],
|
||||
'node_count': 1,
|
||||
'master_count': 1,
|
||||
'trustee_username': 'fake_trustee',
|
||||
'trustee_password': 'fake_trustee_password',
|
||||
'trustee_user_id': '7b489f04-b458-4541-8179-6a48a553e656',
|
||||
'trust_id': 'bd11efc5-d4e2-4dac-bbce-25e348ddf7de'
|
||||
}
|
||||
cfg.CONF.set_override('trustee_domain_id',
|
||||
'3527620c-b220-4f37-9ebc-6e63a81a9b2f',
|
||||
group='trust')
|
||||
|
||||
@patch('magnum.objects.BayModel.get_by_uuid')
|
||||
def test_extract_template_definition_all_values(
|
||||
@ -75,7 +83,12 @@ class TestBayConductorWithMesos(base.TestCase):
|
||||
'http_proxy': 'http_proxy',
|
||||
'https_proxy': 'https_proxy',
|
||||
'no_proxy': 'no_proxy',
|
||||
'cluster_name': 'bay1'
|
||||
'cluster_name': 'bay1',
|
||||
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f',
|
||||
'trustee_username': 'fake_trustee',
|
||||
'trustee_password': 'fake_trustee_password',
|
||||
'trustee_user_id': '7b489f04-b458-4541-8179-6a48a553e656',
|
||||
'trust_id': 'bd11efc5-d4e2-4dac-bbce-25e348ddf7de'
|
||||
}
|
||||
self.assertEqual(expected, definition)
|
||||
|
||||
@ -102,7 +115,12 @@ class TestBayConductorWithMesos(base.TestCase):
|
||||
'external_network': 'external_network_id',
|
||||
'number_of_slaves': 1,
|
||||
'number_of_masters': 1,
|
||||
'cluster_name': 'bay1'
|
||||
'cluster_name': 'bay1',
|
||||
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f',
|
||||
'trustee_username': 'fake_trustee',
|
||||
'trustee_password': 'fake_trustee_password',
|
||||
'trustee_user_id': '7b489f04-b458-4541-8179-6a48a553e656',
|
||||
'trust_id': 'bd11efc5-d4e2-4dac-bbce-25e348ddf7de'
|
||||
}
|
||||
self.assertEqual(expected, definition)
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
import mock
|
||||
from mock import patch
|
||||
from oslo_config import cfg
|
||||
from oslo_service import loopingcall
|
||||
|
||||
from magnum.conductor.handlers import bay_conductor
|
||||
@ -56,7 +57,14 @@ class TestBayConductorWithSwarm(base.TestCase):
|
||||
'master_count': 1,
|
||||
'node_count': 1,
|
||||
'discovery_url': 'https://discovery.test.io/123456789',
|
||||
'trustee_username': 'fake_trustee',
|
||||
'trustee_password': 'fake_trustee_password',
|
||||
'trustee_user_id': '7b489f04-b458-4541-8179-6a48a553e656',
|
||||
'trust_id': 'bd11efc5-d4e2-4dac-bbce-25e348ddf7de'
|
||||
}
|
||||
cfg.CONF.set_override('trustee_domain_id',
|
||||
'3527620c-b220-4f37-9ebc-6e63a81a9b2f',
|
||||
group='trust')
|
||||
osc_patcher = mock.patch('magnum.common.clients.OpenStackClients')
|
||||
self.mock_osc_class = osc_patcher.start()
|
||||
self.addCleanup(osc_patcher.stop)
|
||||
@ -99,7 +107,12 @@ class TestBayConductorWithSwarm(base.TestCase):
|
||||
'network_driver': 'network_driver',
|
||||
'flannel_network_cidr': '10.101.0.0/16',
|
||||
'flannel_network_subnetlen': '26',
|
||||
'flannel_use_vxlan': 'yes'
|
||||
'flannel_use_vxlan': 'yes',
|
||||
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f',
|
||||
'trustee_username': 'fake_trustee',
|
||||
'trustee_password': 'fake_trustee_password',
|
||||
'trustee_user_id': '7b489f04-b458-4541-8179-6a48a553e656',
|
||||
'trust_id': 'bd11efc5-d4e2-4dac-bbce-25e348ddf7de'
|
||||
}
|
||||
self.assertEqual(expected, definition)
|
||||
|
||||
@ -136,7 +149,12 @@ class TestBayConductorWithSwarm(base.TestCase):
|
||||
'tls_disabled': False,
|
||||
'flannel_network_cidr': u'10.101.0.0/16',
|
||||
'flannel_network_subnetlen': u'26',
|
||||
'flannel_use_vxlan': u'yes'
|
||||
'flannel_use_vxlan': u'yes',
|
||||
'trustee_domain_id': '3527620c-b220-4f37-9ebc-6e63a81a9b2f',
|
||||
'trustee_username': 'fake_trustee',
|
||||
'trustee_password': 'fake_trustee_password',
|
||||
'trustee_user_id': '7b489f04-b458-4541-8179-6a48a553e656',
|
||||
'trust_id': 'bd11efc5-d4e2-4dac-bbce-25e348ddf7de'
|
||||
}
|
||||
self.assertEqual(expected, definition)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user