Example #1
0
 def test_get_nova_bm_client(self, client_mock):
     clients.get_nova_bm_client('username', 'password', 'tenant_name',
                                'auth_url')
     client_mock.assert_called_once_with('username',
                                         'password',
                                         'tenant_name',
                                         'auth_url',
                                         extensions=[mock.ANY])
Example #2
0
    def _deploy_postconfig(self, stack, parsed_args):
        self.log.debug("_deploy_postconfig(%s)" % parsed_args)

        passwords = self.passwords

        overcloud_endpoint = self._get_overcloud_endpoint(stack)
        overcloud_ip = six.moves.urllib.parse.urlparse(
            overcloud_endpoint).hostname

        no_proxy = [os.environ.get('no_proxy'), overcloud_ip]
        os.environ['no_proxy'] = ','.join(
            [x for x in no_proxy if x is not None])

        service_ips = self._get_service_ips(stack)

        utils.remove_known_hosts(overcloud_ip)

        keystone_ip = service_ips.get('KeystoneInternalVip')
        if not keystone_ip:
            keystone_ip = overcloud_ip

        keystone.initialize(keystone_ip,
                            passwords['OVERCLOUD_ADMIN_TOKEN'],
                            '*****@*****.**',
                            passwords['OVERCLOUD_ADMIN_PASSWORD'],
                            public=overcloud_ip,
                            user='******')

        # NOTE(bcrochet): Bad hack. Remove the ssl_port info from the
        # os_cloud_config.SERVICES dictionary
        for service_name, data in keystone.SERVICES.iteritems():
            data.pop('ssl_port', None)

        services = {}
        for service, data in six.iteritems(utils.SERVICE_LIST):
            service_data = data.copy()
            service_data.pop('password_field', None)
            password_field = data.get('password_field')
            if password_field:
                service_data['password'] = passwords[password_field]

            service_name = re.sub('v[0-9]+', '',
                                  service.capitalize() + 'InternalVip')
            internal_vip = service_ips.get(service_name)
            if internal_vip:
                service_data['internal_host'] = internal_vip
            services.update({service: service_data})

        keystone_client = clients.get_keystone_client(
            'admin', passwords['OVERCLOUD_ADMIN_PASSWORD'], 'admin',
            overcloud_endpoint)
        keystone.setup_endpoints(services,
                                 client=keystone_client,
                                 os_auth_url=overcloud_endpoint,
                                 public_host=overcloud_ip)

        compute_client = clients.get_nova_bm_client(
            'admin', passwords['OVERCLOUD_ADMIN_PASSWORD'], 'admin',
            overcloud_endpoint)
        compute_client.flavors.create('m1.demo', 512, 1, 10, 'auto')
    def _deploy_postconfig(self, stack, parsed_args):
        self.log.debug("_deploy_postconfig(%s)" % parsed_args)

        passwords = self.passwords

        overcloud_endpoint = self._get_overcloud_endpoint(stack)
        overcloud_ip = six.moves.urllib.parse.urlparse(
            overcloud_endpoint).hostname

        no_proxy = [os.environ.get('no_proxy'), overcloud_ip]
        os.environ['no_proxy'] = ','.join(
            [x for x in no_proxy if x is not None])

        service_ips = self._get_service_ips(stack)

        utils.remove_known_hosts(overcloud_ip)

        keystone_ip = service_ips.get('KeystoneInternalVip')
        if not keystone_ip:
            keystone_ip = overcloud_ip

        keystone.initialize(
            keystone_ip,
            passwords['OVERCLOUD_ADMIN_TOKEN'],
            '*****@*****.**',
            passwords['OVERCLOUD_ADMIN_PASSWORD'],
            public=overcloud_ip,
            user='******')

        # NOTE(bcrochet): Bad hack. Remove the ssl_port info from the
        # os_cloud_config.SERVICES dictionary
        for service_name, data in keystone.SERVICES.iteritems():
            data.pop('ssl_port', None)

        services = {}
        for service, data in six.iteritems(utils.SERVICE_LIST):
            service_data = data.copy()
            service_data.pop('password_field', None)
            password_field = data.get('password_field')
            if password_field:
                service_data['password'] = passwords[password_field]

            service_name = re.sub('v[0-9]+', '',
                                  service.capitalize() + 'InternalVip')
            internal_vip = service_ips.get(service_name)
            if internal_vip:
                service_data['internal_host'] = internal_vip
            services.update({service: service_data})

        keystone_client = clients.get_keystone_client(
            'admin',
            passwords['OVERCLOUD_ADMIN_PASSWORD'],
            'admin',
            overcloud_endpoint)
        keystone.setup_endpoints(
            services,
            client=keystone_client,
            os_auth_url=overcloud_endpoint,
            public_host=overcloud_ip)

        compute_client = clients.get_nova_bm_client(
            'admin',
            passwords['OVERCLOUD_ADMIN_PASSWORD'],
            'admin',
            overcloud_endpoint)
        compute_client.flavors.create('m1.demo', 512, 1, 10, 'auto')
    def _deploy_postconfig(self, stack, parsed_args):
        self.log.debug("_deploy_postconfig(%s)" % parsed_args)

        overcloud_endpoint = utils.get_overcloud_endpoint(stack)
        overcloud_ip = six.moves.urllib.parse.urlparse(
            overcloud_endpoint).hostname

        no_proxy = [os.environ.get('no_proxy'), overcloud_ip]
        os.environ['no_proxy'] = ','.join(
            [x for x in no_proxy if x is not None])

        service_ips = utils.get_service_ips(stack)

        utils.remove_known_hosts(overcloud_ip)

        keystone_ip = service_ips.get('KeystoneAdminVip')
        if not keystone_ip:
            keystone_ip = overcloud_ip

        # Note (spredzy): This was deprecated at the begining of
        # the Mitaka cycle. Should be good to remove for the
        # next N cycle.
        keystone.initialize(
            keystone_ip,
            utils.get_password('OVERCLOUD_ADMIN_TOKEN'),
            '*****@*****.**',
            utils.get_password('OVERCLOUD_ADMIN_PASSWORD'),
            public=overcloud_ip,
            user=parsed_args.overcloud_ssh_user)

        # NOTE(bcrochet): Bad hack. Remove the ssl_port info from the
        # os_cloud_config.SERVICES dictionary
        for service_name, data in keystone.SERVICES.iteritems():
            data.pop('ssl_port', None)

        services = {}
        for service, data in six.iteritems(constants.SERVICE_LIST):
            service_data = data.copy()
            service_data.pop('password_field', None)
            password_field = data.get('password_field')
            if password_field:
                service_data['password'] = utils.get_password(password_field)

            service_name = re.sub('v[0-9]+', '',
                                  service.capitalize() + 'InternalVip')
            internal_vip = service_ips.get(service_name)
            if internal_vip:
                service_data['internal_host'] = internal_vip
            services.update({service: service_data})

        # Note (spredzy): This was deprecated at the begining of
        # the Mitaka cycle. Should be good to remove for the
        # next N cycle.
        try:
            keystone_client = clients.get_keystone_client(
                'admin',
                utils.get_password('OVERCLOUD_ADMIN_PASSWORD'),
                'admin',
                overcloud_endpoint)
            keystone.setup_endpoints(
                services,
                client=keystone_client,
                os_auth_url=overcloud_endpoint,
                public_host=overcloud_ip)
        except kscexc.Conflict:
            pass
        else:
            self.log.warning("Setting up keystone endpoints via "
                             "os-cloud-config. This behavior is "
                             "deprecated and will be removed in "
                             "a future release.  Please update "
                             "your heat templates to a version "
                             "that does Keystone initialization "
                             "via Puppet.")

        compute_client = clients.get_nova_bm_client(
            'admin',
            utils.get_password('OVERCLOUD_ADMIN_PASSWORD'),
            'admin',
            overcloud_endpoint)
        compute_client.flavors.create('m1.demo', 512, 1, 10, 'auto')
Example #5
0
def get_nova_bm_client():
    return clients.get_nova_bm_client(*_get_client_args())
Example #6
0
def get_nova_bm_client():
    return clients.get_nova_bm_client(os.environ["OS_USERNAME"],
                                      os.environ["OS_PASSWORD"],
                                      os.environ["OS_TENANT_NAME"],
                                      os.environ["OS_AUTH_URL"])
Example #7
0
    def _deploy_postconfig(self, stack, parsed_args):
        self.log.debug("_deploy_postconfig(%s)" % parsed_args)

        overcloud_endpoint = utils.get_overcloud_endpoint(stack)
        overcloud_ip = six.moves.urllib.parse.urlparse(
            overcloud_endpoint).hostname

        no_proxy = [os.environ.get('no_proxy'), overcloud_ip]
        os.environ['no_proxy'] = ','.join(
            [x for x in no_proxy if x is not None])

        service_ips = utils.get_service_ips(stack)

        utils.remove_known_hosts(overcloud_ip)

        keystone_ip = service_ips.get('KeystoneAdminVip')
        if not keystone_ip:
            keystone_ip = overcloud_ip

        # Note (spredzy): This was deprecated at the begining of
        # the Mitaka cycle. Should be good to remove for the
        # next N cycle.
        keystone.initialize(keystone_ip,
                            utils.get_password('OVERCLOUD_ADMIN_TOKEN'),
                            '*****@*****.**',
                            utils.get_password('OVERCLOUD_ADMIN_PASSWORD'),
                            public=overcloud_ip,
                            user=parsed_args.overcloud_ssh_user)

        # NOTE(bcrochet): Bad hack. Remove the ssl_port info from the
        # os_cloud_config.SERVICES dictionary
        for service_name, data in keystone.SERVICES.iteritems():
            data.pop('ssl_port', None)

        services = {}
        for service, data in six.iteritems(constants.SERVICE_LIST):
            service_data = data.copy()
            service_data.pop('password_field', None)
            password_field = data.get('password_field')
            if password_field:
                service_data['password'] = utils.get_password(password_field)

            service_name = re.sub('v[0-9]+', '',
                                  service.capitalize() + 'InternalVip')
            internal_vip = service_ips.get(service_name)
            if internal_vip:
                service_data['internal_host'] = internal_vip
            services.update({service: service_data})

        # Note (spredzy): This was deprecated at the begining of
        # the Mitaka cycle. Should be good to remove for the
        # next N cycle.
        try:
            keystone_client = clients.get_keystone_client(
                'admin', utils.get_password('OVERCLOUD_ADMIN_PASSWORD'),
                'admin', overcloud_endpoint)
            keystone.setup_endpoints(services,
                                     client=keystone_client,
                                     os_auth_url=overcloud_endpoint,
                                     public_host=overcloud_ip)
        except kscexc.Conflict:
            pass
        else:
            self.log.warning("Setting up keystone endpoints via "
                             "os-cloud-config. This behavior is "
                             "deprecated and will be removed in "
                             "a future release.  Please update "
                             "your heat templates to a version "
                             "that does Keystone initialization "
                             "via Puppet.")

        compute_client = clients.get_nova_bm_client(
            'admin', utils.get_password('OVERCLOUD_ADMIN_PASSWORD'), 'admin',
            overcloud_endpoint)
        compute_client.flavors.create('m1.demo', 512, 1, 10, 'auto')