Example #1
0
    def test_retrieve_baymodel(self, mock_baymodel_get_by_uuid):
        expected_context = 'context'
        expected_baymodel_uuid = 'baymodel_uuid'

        bay = objects.Bay({})
        bay.baymodel_id = expected_baymodel_uuid

        utils.retrieve_baymodel(expected_context, bay)

        mock_baymodel_get_by_uuid.assert_called_once_with(
            expected_context, expected_baymodel_uuid)
Example #2
0
    def test_retrieve_baymodel(self, mock_baymodel_get_by_uuid):
        expected_context = 'context'
        expected_baymodel_uuid = 'baymodel_uuid'

        bay = objects.Bay({})
        bay.baymodel_id = expected_baymodel_uuid

        utils.retrieve_baymodel(expected_context, bay)

        mock_baymodel_get_by_uuid.assert_called_once_with(
            expected_context,
            expected_baymodel_uuid)
Example #3
0
def _update_stack_outputs(context, stack, bay):
    baymodel = conductor_utils.retrieve_baymodel(context, bay)
    cluster_distro = baymodel.cluster_distro
    cluster_coe = baymodel.coe
    definition = TDef.get_template_definition('vm', cluster_distro,
                                              cluster_coe)
    return definition.update_outputs(stack, bay)
Example #4
0
def docker_for_bay(context, bay):
    baymodel = conductor_utils.retrieve_baymodel(context, bay)

    ca_cert, magnum_key, magnum_cert = None, None, None
    client_kwargs = dict()
    if not baymodel.tls_disabled:
        (ca_cert, magnum_key,
         magnum_cert) = cert_manager.create_client_files(bay)
        client_kwargs['ca_cert'] = ca_cert.name
        client_kwargs['client_key'] = magnum_key.name
        client_kwargs['client_cert'] = magnum_cert.name

    yield DockerHTTPClient(
        bay.api_address,
        CONF.docker.docker_remote_api_version,
        CONF.docker.default_timeout,
        **client_kwargs
    )

    if ca_cert:
        ca_cert.close()
    if magnum_key:
        magnum_key.close()
    if magnum_cert:
        magnum_cert.close()
Example #5
0
def _update_stack_outputs(context, stack, bay):
    baymodel = conductor_utils.retrieve_baymodel(context, bay)
    cluster_distro = baymodel.cluster_distro
    cluster_coe = baymodel.coe
    definition = TDef.get_template_definition('vm', cluster_distro,
                                              cluster_coe)
    return definition.update_outputs(stack, bay)
Example #6
0
 def __init__(self, openstack_client, bay):
     self.openstack_client = openstack_client
     self.context = self.openstack_client.context
     self.bay = bay
     self.attempts = 0
     baymodel = conductor_utils.retrieve_baymodel(self.context, bay)
     self.template_def = TDef.get_template_definition("vm", baymodel.cluster_distro, baymodel.coe)
Example #7
0
def docker_for_bay(context, bay):
    baymodel = conductor_utils.retrieve_baymodel(context, bay)

    tcp_url = 'tcp://%s:2376' % bay.api_address

    ca_cert, magnum_key, magnum_cert = None, None, None
    client_kwargs = dict()
    if not baymodel.tls_disabled:
        tcp_url = 'https://%s:2376' % bay.api_address
        (ca_cert, magnum_key,
         magnum_cert) = cert_manager.create_client_files(bay)
        client_kwargs['ca_cert'] = ca_cert.name
        client_kwargs['client_key'] = magnum_key.name
        client_kwargs['client_cert'] = magnum_cert.name

    yield docker_client.DockerHTTPClient(tcp_url,
                                         CONF.docker.docker_remote_api_version,
                                         CONF.docker.default_timeout,
                                         **client_kwargs)

    if ca_cert:
        ca_cert.close()
    if magnum_key:
        magnum_key.close()
    if magnum_cert:
        magnum_cert.close()
Example #8
0
def _extract_template_definition(context, bay, scale_manager=None):
    baymodel = conductor_utils.retrieve_baymodel(context, bay)
    cluster_distro = baymodel.cluster_distro
    cluster_coe = baymodel.coe
    definition = TDef.get_template_definition('vm', cluster_distro,
                                              cluster_coe)
    return definition.extract_definition(baymodel, bay,
                                         scale_manager=scale_manager)
Example #9
0
 def __init__(self, openstack_client, bay):
     self.openstack_client = openstack_client
     self.context = self.openstack_client.context
     self.bay = bay
     self.attempts = 0
     self.baymodel = conductor_utils.retrieve_baymodel(self.context, bay)
     self.template_def = TDef.get_template_definition(
         'vm', self.baymodel.cluster_distro, self.baymodel.coe)
Example #10
0
def _extract_template_definition(context, bay, scale_manager=None):
    baymodel = conductor_utils.retrieve_baymodel(context, bay)
    cluster_distro = baymodel.cluster_distro
    cluster_coe = baymodel.coe
    definition = TDef.get_template_definition('vm', cluster_distro,
                                              cluster_coe)
    return definition.extract_definition(context, baymodel, bay,
                                         scale_manager=scale_manager)