Update overcloud credentials to use ephemeral Heat
This command was still attempting to query Heat for the stack, which would not work with ephemeral Heat. Depends-On: I28c21f923baf75fbc3be501552c10a5bb5384a09 Change-Id: I176bc05bf588f12c543273fa1d5e357ea819fcd3 Signed-off-by: James Slagle <jslagle@redhat.com>
This commit is contained in:
parent
a34acccb04
commit
035827f3db
@ -89,10 +89,12 @@ STACK_OUTPUTS = ['BlacklistedHostnames',
|
||||
'RoleNetIpMap',
|
||||
'BlacklistedIpAddresses',
|
||||
'RoleNetHostnameMap',
|
||||
'KeystoneRegion',
|
||||
'KeystoneURL',
|
||||
'EndpointMap',
|
||||
'VipMap',
|
||||
'EnabledServices']
|
||||
'EnabledServices',
|
||||
'AdminPassword']
|
||||
|
||||
IRONIC_HTTP_BOOT_BIND_MOUNT = '/var/lib/ironic/httpboot'
|
||||
IRONIC_LOCAL_IMAGE_PATH = '/var/lib/ironic/images'
|
||||
|
@ -32,7 +32,7 @@ class TestOvercloudCredentials(test_plugin.TestPluginV1):
|
||||
def test_ok(self, mock_run_playbook):
|
||||
arglist = ['overcloud', ]
|
||||
verifylist = [
|
||||
('plan', 'overcloud'),
|
||||
('stack', 'overcloud'),
|
||||
('directory', '.')
|
||||
]
|
||||
|
||||
@ -46,7 +46,7 @@ class TestOvercloudCredentials(test_plugin.TestPluginV1):
|
||||
|
||||
arglist = ['overcloud', '--directory', temp]
|
||||
verifylist = [
|
||||
('plan', 'overcloud'),
|
||||
('stack', 'overcloud'),
|
||||
('directory', temp)
|
||||
]
|
||||
self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
@ -981,8 +981,8 @@ def get_stack_saved_output_item(output, working_dir):
|
||||
return yaml.safe_load(f.read())
|
||||
|
||||
|
||||
def get_overcloud_endpoint(stack):
|
||||
return get_stack_output_item(stack, 'KeystoneURL')
|
||||
def get_overcloud_endpoint(working_dir):
|
||||
return get_stack_saved_output_item('KeystoneURL', working_dir)
|
||||
|
||||
|
||||
def get_service_ips(stack):
|
||||
@ -1029,18 +1029,12 @@ def get_stack(orchestration_client, stack_name):
|
||||
pass
|
||||
|
||||
|
||||
def get_rc_params(orchestration_client, stack_name):
|
||||
env = orchestration_client.stacks.environment(stack_name)
|
||||
def get_rc_params(working_dir):
|
||||
rc_params = {}
|
||||
try:
|
||||
rc_params['password'] = env[
|
||||
'parameter_defaults']['AdminPassword']
|
||||
except KeyError as ex:
|
||||
error = ("Unable to find %s in the stack "
|
||||
"environment." % ex.args[0])
|
||||
raise RuntimeError(error)
|
||||
rc_params['region'] = env[
|
||||
'parameter_defaults'].get('KeystoneRegion')
|
||||
rc_params['password'] = get_stack_saved_output_item(
|
||||
'AdminPassword', working_dir)
|
||||
rc_params['region'] = get_stack_saved_output_item(
|
||||
'KeystoneRegion', working_dir)
|
||||
return rc_params
|
||||
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
|
||||
import logging
|
||||
|
||||
from osc_lib.i18n import _
|
||||
|
||||
from tripleoclient import command
|
||||
from tripleoclient.workflows import deployment
|
||||
from tripleoclient import utils
|
||||
@ -24,21 +26,32 @@ class OvercloudCredentials(command.Command):
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(OvercloudCredentials, self).get_parser(prog_name)
|
||||
parser.add_argument('plan', help=("The name of the plan you want to "
|
||||
"create rc files for."))
|
||||
parser.add_argument('--directory', default=".", nargs='?', help=(
|
||||
"The directory to create the rc files. Defaults to the current "
|
||||
"directory."))
|
||||
parser.add_argument(
|
||||
'stack',
|
||||
help=_("The name of the stack you want to "
|
||||
"create rc files for."))
|
||||
parser.add_argument(
|
||||
'--directory',
|
||||
default=".",
|
||||
nargs='?',
|
||||
help=_("The directory to create the rc files. "
|
||||
"Defaults to the current directory."))
|
||||
parser.add_argument(
|
||||
'--working-dir',
|
||||
action='store',
|
||||
help=_('The working directory that contains the input, output, '
|
||||
'and generated files for the deployment.\n'
|
||||
'Defaults to "$HOME/overcloud-deploy/<stack>"')
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
self.clients = self.app.client_manager
|
||||
stack = utils.get_stack(
|
||||
self.clients.orchestration, parsed_args.plan)
|
||||
rc_params = utils.get_rc_params(
|
||||
self.clients.orchestration,
|
||||
parsed_args.plan)
|
||||
parsed_args.working_dir)
|
||||
endpoint = utils.get_overcloud_endpoint(parsed_args.working_dir)
|
||||
admin_vip = utils.get_stack_saved_output_item(
|
||||
'KeystoneAdminVip', parsed_args.working_dir)
|
||||
deployment.create_overcloudrc(
|
||||
stack, rc_params,
|
||||
parsed_args.stack, endpoint, admin_vip, rc_params,
|
||||
output_dir=parsed_args.directory)
|
||||
|
@ -432,7 +432,7 @@ class DeployOvercloud(command.Command):
|
||||
def _deploy_postconfig(self, stack, parsed_args):
|
||||
self.log.debug("_deploy_postconfig(%s)" % parsed_args)
|
||||
|
||||
overcloud_endpoint = utils.get_overcloud_endpoint(stack)
|
||||
overcloud_endpoint = utils.get_overcloud_endpoint(self.working_dir)
|
||||
# NOTE(jaosorior): The overcloud endpoint can contain an IP address or
|
||||
# an FQDN depending on how what it's configured to output in the
|
||||
# tripleo-heat-templates. Such a configuration can be done by
|
||||
@ -440,7 +440,8 @@ class DeployOvercloud(command.Command):
|
||||
overcloud_ip_or_fqdn = urllib.parse.urlparse(
|
||||
overcloud_endpoint).hostname
|
||||
|
||||
keystone_admin_ip = utils.get_endpoint('KeystoneAdmin', stack)
|
||||
keystone_admin_ip = utils.get_stack_saved_output_item(
|
||||
'KeystoneAdminVip', self.working_dir)
|
||||
no_proxy = os.environ.get('no_proxy', overcloud_ip_or_fqdn)
|
||||
no_proxy_list = map(utils.bracket_ipv6,
|
||||
[no_proxy, overcloud_ip_or_fqdn,
|
||||
@ -1211,24 +1212,20 @@ class DeployOvercloud(command.Command):
|
||||
|
||||
try:
|
||||
if stack:
|
||||
# Force fetching of attributes
|
||||
stack.get()
|
||||
overcloud_endpoint = utils.get_overcloud_endpoint(stack)
|
||||
horizon_url = deployment.get_horizon_url(
|
||||
stack=stack.stack_name,
|
||||
heat_type=parsed_args.heat_type,
|
||||
working_dir=self.working_dir)
|
||||
rc_params = utils.get_rc_params(
|
||||
self.orchestration_client,
|
||||
parsed_args.stack)
|
||||
overcloud_endpoint = utils.get_overcloud_endpoint(
|
||||
self.working_dir)
|
||||
overcloud_admin_vip = utils.get_stack_saved_output_item(
|
||||
'KeystoneAdminVip', self.working_dir)
|
||||
rc_params = utils.get_rc_params(self.working_dir)
|
||||
|
||||
# For backwards compatibility, we will also write overcloudrc
|
||||
# to $HOME and then self.working_dir.
|
||||
old_rcpath = deployment.create_overcloudrc(
|
||||
stack, rc_params, parsed_args.no_proxy)
|
||||
parsed_args.stack, overcloud_endpoint, overcloud_admin_vip,
|
||||
rc_params, parsed_args.no_proxy)
|
||||
rcpath = deployment.create_overcloudrc(
|
||||
stack, rc_params, parsed_args.no_proxy,
|
||||
self.working_dir)
|
||||
parsed_args.stack, overcloud_endpoint, overcloud_admin_vip,
|
||||
rc_params, parsed_args.no_proxy, self.working_dir)
|
||||
|
||||
if do_setup:
|
||||
deployment.get_hosts_and_enable_ssh_admin(
|
||||
|
@ -32,13 +32,12 @@ from tripleoclient import utils
|
||||
_WORKFLOW_TIMEOUT = 360 # 6 * 60 seconds
|
||||
|
||||
|
||||
def create_overcloudrc(stack, rc_params, no_proxy='',
|
||||
output_dir=CLOUD_HOME_DIR):
|
||||
overcloudrcs = rc_utils._create_overcloudrc(
|
||||
stack, no_proxy,
|
||||
rc_params['password'],
|
||||
def create_overcloudrc(stack_name, endpoint, admin_vip, rc_params,
|
||||
no_proxy='', output_dir=CLOUD_HOME_DIR):
|
||||
overcloudrcs = rc_utils._create_overcloudrc_from_outputs(
|
||||
stack_name, endpoint, admin_vip, no_proxy, rc_params['password'],
|
||||
rc_params['region'])
|
||||
rcpath = os.path.join(output_dir, '%src' % stack.stack_name)
|
||||
rcpath = os.path.join(output_dir, '%src' % stack_name)
|
||||
with open(rcpath, 'w') as rcfile:
|
||||
rcfile.write(overcloudrcs['overcloudrc'])
|
||||
os.chmod(rcpath, 0o600)
|
||||
|
Loading…
Reference in New Issue
Block a user