Merge "Rename 'undercloud-' to '<stack_name>-'"
This commit is contained in:
commit
c28df729e7
|
@ -513,7 +513,7 @@ class TestDeployUndercloud(TestPluginV1):
|
||||||
{'name': 'Foo', 'tags': ['primary']}
|
{'name': 'Foo', 'tags': ['primary']}
|
||||||
]
|
]
|
||||||
|
|
||||||
def set_tht(templates):
|
def set_tht(templates, stack_name):
|
||||||
self.cmd.tht_render = "tht_from"
|
self.cmd.tht_render = "tht_from"
|
||||||
|
|
||||||
mock_populate.side_effect = set_tht
|
mock_populate.side_effect = set_tht
|
||||||
|
|
|
@ -219,13 +219,13 @@ class Deploy(command.Command):
|
||||||
'first defined role')
|
'first defined role')
|
||||||
return roles_data[0]['name']
|
return roles_data[0]['name']
|
||||||
|
|
||||||
def _get_tar_filename(self):
|
def _get_tar_filename(self, stack_name='undercloud'):
|
||||||
"""Return tarball name for the install artifacts"""
|
"""Return tarball name for the install artifacts"""
|
||||||
return '%s/undercloud-install-%s.tar.bzip2' % \
|
return '%s/%s-install-%s.tar.bzip2' % \
|
||||||
(self.output_dir,
|
(self.output_dir, stack_name,
|
||||||
datetime.utcnow().strftime('%Y%m%d%H%M%S'))
|
datetime.utcnow().strftime('%Y%m%d%H%M%S'))
|
||||||
|
|
||||||
def _create_install_artifact(self, user):
|
def _create_install_artifact(self, user, stack_name='undercloud'):
|
||||||
"""Create a tarball of the temporary folders used"""
|
"""Create a tarball of the temporary folders used"""
|
||||||
self.log.debug(_("Preserving deployment artifacts"))
|
self.log.debug(_("Preserving deployment artifacts"))
|
||||||
|
|
||||||
|
@ -238,7 +238,8 @@ class Deploy(command.Command):
|
||||||
|
|
||||||
# tar up working data and put in
|
# tar up working data and put in
|
||||||
# output_dir/undercloud-install-TS.tar.bzip2
|
# output_dir/undercloud-install-TS.tar.bzip2
|
||||||
tar_filename = self._get_tar_filename()
|
# if the stack name is "undercloud".
|
||||||
|
tar_filename = self._get_tar_filename(stack_name)
|
||||||
try:
|
try:
|
||||||
tf = tarfile.open(tar_filename, 'w:bz2')
|
tf = tarfile.open(tar_filename, 'w:bz2')
|
||||||
tf.add(self.tht_render, recursive=True, filter=remove_output_dir)
|
tf.add(self.tht_render, recursive=True, filter=remove_output_dir)
|
||||||
|
@ -258,7 +259,7 @@ class Deploy(command.Command):
|
||||||
if not os.path.exists(constants.STANDALONE_EPHEMERAL_STACK_VSTATE):
|
if not os.path.exists(constants.STANDALONE_EPHEMERAL_STACK_VSTATE):
|
||||||
os.mkdir(constants.STANDALONE_EPHEMERAL_STACK_VSTATE)
|
os.mkdir(constants.STANDALONE_EPHEMERAL_STACK_VSTATE)
|
||||||
|
|
||||||
def _create_working_dirs(self):
|
def _create_working_dirs(self, stack_name='undercloud'):
|
||||||
"""Creates temporary working directories"""
|
"""Creates temporary working directories"""
|
||||||
if self.output_dir and not os.path.exists(self.output_dir):
|
if self.output_dir and not os.path.exists(self.output_dir):
|
||||||
os.mkdir(self.output_dir)
|
os.mkdir(self.output_dir)
|
||||||
|
@ -272,9 +273,10 @@ class Deploy(command.Command):
|
||||||
shutil.rmtree(self.tht_render, ignore_errors=True)
|
shutil.rmtree(self.tht_render, ignore_errors=True)
|
||||||
if not self.tmp_ansible_dir:
|
if not self.tmp_ansible_dir:
|
||||||
self.tmp_ansible_dir = tempfile.mkdtemp(
|
self.tmp_ansible_dir = tempfile.mkdtemp(
|
||||||
prefix='undercloud-ansible-', dir=self.output_dir)
|
prefix=stack_name + '-ansible-', dir=self.output_dir)
|
||||||
|
|
||||||
def _populate_templates_dir(self, source_templates_dir):
|
def _populate_templates_dir(self, source_templates_dir,
|
||||||
|
stack_name='undercloud'):
|
||||||
"""Creates template dir with templates
|
"""Creates template dir with templates
|
||||||
|
|
||||||
* Copy --templates content into a working dir
|
* Copy --templates content into a working dir
|
||||||
|
@ -283,7 +285,7 @@ class Deploy(command.Command):
|
||||||
:param source_templates_dir: string to a directory containing our
|
:param source_templates_dir: string to a directory containing our
|
||||||
source templates
|
source templates
|
||||||
"""
|
"""
|
||||||
self._create_working_dirs()
|
self._create_working_dirs(stack_name)
|
||||||
if not os.path.exists(source_templates_dir):
|
if not os.path.exists(source_templates_dir):
|
||||||
raise exceptions.NotFound("%s templates directory does not exist "
|
raise exceptions.NotFound("%s templates directory does not exist "
|
||||||
"or permission denied" %
|
"or permission denied" %
|
||||||
|
@ -333,10 +335,11 @@ class Deploy(command.Command):
|
||||||
constants.PUPPET_BASE)
|
constants.PUPPET_BASE)
|
||||||
|
|
||||||
def _update_passwords_env(self, output_dir, user, upgrade=None,
|
def _update_passwords_env(self, output_dir, user, upgrade=None,
|
||||||
passwords=None):
|
passwords=None, stack_name='undercloud'):
|
||||||
pw_file = os.path.join(output_dir, 'tripleo-undercloud-passwords.yaml')
|
pw_file = os.path.join(output_dir,
|
||||||
|
'tripleo-' + stack_name + '-passwords.yaml')
|
||||||
undercloud_pw_file = os.path.join(output_dir,
|
undercloud_pw_file = os.path.join(output_dir,
|
||||||
'undercloud-passwords.conf')
|
stack_name + '-passwords.conf')
|
||||||
|
|
||||||
# Generated passwords take the lowest precedence, allowing
|
# Generated passwords take the lowest precedence, allowing
|
||||||
# custom overrides
|
# custom overrides
|
||||||
|
@ -669,9 +672,10 @@ class Deploy(command.Command):
|
||||||
# this will allow the user to overwrite passwords with custom envs
|
# this will allow the user to overwrite passwords with custom envs
|
||||||
# or pick instack legacy passwords as is, if upgrading from instack
|
# or pick instack legacy passwords as is, if upgrading from instack
|
||||||
pw_file = self._update_passwords_env(
|
pw_file = self._update_passwords_env(
|
||||||
self.output_dir,
|
output_dir=self.output_dir,
|
||||||
parsed_args.deployment_user,
|
user=parsed_args.deployment_user,
|
||||||
parsed_args.upgrade,
|
upgrade=parsed_args.upgrade,
|
||||||
|
stack_name=parsed_args.stack.lower(),
|
||||||
)
|
)
|
||||||
environments.append(pw_file)
|
environments.append(pw_file)
|
||||||
|
|
||||||
|
@ -716,7 +720,8 @@ class Deploy(command.Command):
|
||||||
if parsed_args.hieradata_override:
|
if parsed_args.hieradata_override:
|
||||||
environments.append(self._process_hieradata_overrides(
|
environments.append(self._process_hieradata_overrides(
|
||||||
parsed_args.hieradata_override,
|
parsed_args.hieradata_override,
|
||||||
parsed_args.standalone_role))
|
parsed_args.standalone_role,
|
||||||
|
parsed_args.stack.lower()))
|
||||||
|
|
||||||
# Create a persistent drop-in file to indicate the stack
|
# Create a persistent drop-in file to indicate the stack
|
||||||
# virtual state changes
|
# virtual state changes
|
||||||
|
@ -777,7 +782,8 @@ class Deploy(command.Command):
|
||||||
self.log.info('Removing unused services, updating roles')
|
self.log.info('Removing unused services, updating roles')
|
||||||
# This will clean up the directory and set it up again
|
# This will clean up the directory and set it up again
|
||||||
self.tht_render = None
|
self.tht_render = None
|
||||||
self._populate_templates_dir(parsed_args.templates)
|
self._populate_templates_dir(parsed_args.templates,
|
||||||
|
parsed_args.stack.lower())
|
||||||
roles_file_path = os.path.join(
|
roles_file_path = os.path.join(
|
||||||
self.tht_render, 'roles-data-override.yaml')
|
self.tht_render, 'roles-data-override.yaml')
|
||||||
with open(roles_file_path, "w") as f:
|
with open(roles_file_path, "w") as f:
|
||||||
|
@ -826,7 +832,7 @@ class Deploy(command.Command):
|
||||||
tripleo_role_name='Standalone',
|
tripleo_role_name='Standalone',
|
||||||
python_interpreter=sys.executable):
|
python_interpreter=sys.executable):
|
||||||
stack_config = config.Config(client)
|
stack_config = config.Config(client)
|
||||||
self._create_working_dirs()
|
self._create_working_dirs(stack_name.lower())
|
||||||
|
|
||||||
self.log.warning(_('** Downloading {0} ansible.. **').format(
|
self.log.warning(_('** Downloading {0} ansible.. **').format(
|
||||||
stack_name))
|
stack_name))
|
||||||
|
@ -886,7 +892,7 @@ class Deploy(command.Command):
|
||||||
globalcfg['oslo_messaging_notify_node_names'] = [name]
|
globalcfg['oslo_messaging_notify_node_names'] = [name]
|
||||||
outputs['GlobalConfigExtraMapData'] = globalcfg
|
outputs['GlobalConfigExtraMapData'] = globalcfg
|
||||||
|
|
||||||
self._create_working_dirs()
|
self._create_working_dirs(stack_name.lower())
|
||||||
output = {'parameter_defaults': outputs}
|
output = {'parameter_defaults': outputs}
|
||||||
with open(endpointmap_file, 'w') as f:
|
with open(endpointmap_file, 'w') as f:
|
||||||
yaml.safe_dump(output, f, default_flow_style=False)
|
yaml.safe_dump(output, f, default_flow_style=False)
|
||||||
|
@ -1110,7 +1116,8 @@ class Deploy(command.Command):
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def _process_hieradata_overrides(self, override_file=None,
|
def _process_hieradata_overrides(self, override_file=None,
|
||||||
tripleo_role_name='Standalone'):
|
tripleo_role_name='Standalone',
|
||||||
|
stack_name='undercloud'):
|
||||||
"""Count in hiera data overrides including legacy formats
|
"""Count in hiera data overrides including legacy formats
|
||||||
|
|
||||||
Return a file name that points to processed hiera data overrides file
|
Return a file name that points to processed hiera data overrides file
|
||||||
|
@ -1138,7 +1145,7 @@ class Deploy(command.Command):
|
||||||
target)
|
target)
|
||||||
self.log.error(msg)
|
self.log.error(msg)
|
||||||
raise exceptions.DeploymentError(msg)
|
raise exceptions.DeploymentError(msg)
|
||||||
self._create_working_dirs()
|
self._create_working_dirs(stack_name)
|
||||||
|
|
||||||
# NOTE(bogdando): In t-h-t, hiera data should come in wrapped as
|
# NOTE(bogdando): In t-h-t, hiera data should come in wrapped as
|
||||||
# {parameter_defaults: {UndercloudExtraConfig: ... }}
|
# {parameter_defaults: {UndercloudExtraConfig: ... }}
|
||||||
|
@ -1205,7 +1212,7 @@ class Deploy(command.Command):
|
||||||
|
|
||||||
# prepare working spaces
|
# prepare working spaces
|
||||||
self.output_dir = os.path.abspath(parsed_args.output_dir)
|
self.output_dir = os.path.abspath(parsed_args.output_dir)
|
||||||
self._create_working_dirs()
|
self._create_working_dirs(parsed_args.stack.lower())
|
||||||
# The state that needs to be persisted between serial deployments
|
# The state that needs to be persisted between serial deployments
|
||||||
# and cannot be contained in ephemeral heat stacks or working dirs
|
# and cannot be contained in ephemeral heat stacks or working dirs
|
||||||
self._create_persistent_dirs()
|
self._create_persistent_dirs()
|
||||||
|
@ -1214,7 +1221,8 @@ class Deploy(command.Command):
|
||||||
self._configure_puppet()
|
self._configure_puppet()
|
||||||
|
|
||||||
# copy the templates dir in place
|
# copy the templates dir in place
|
||||||
self._populate_templates_dir(parsed_args.templates)
|
self._populate_templates_dir(parsed_args.templates,
|
||||||
|
parsed_args.stack.lower())
|
||||||
|
|
||||||
# Set default plan if not specified by user
|
# Set default plan if not specified by user
|
||||||
self._set_default_plan()
|
self._set_default_plan()
|
||||||
|
@ -1312,7 +1320,8 @@ class Deploy(command.Command):
|
||||||
if not parsed_args.keep_running:
|
if not parsed_args.keep_running:
|
||||||
self._kill_heat(parsed_args)
|
self._kill_heat(parsed_args)
|
||||||
tar_filename = \
|
tar_filename = \
|
||||||
self._create_install_artifact(parsed_args.deployment_user)
|
self._create_install_artifact(parsed_args.deployment_user,
|
||||||
|
parsed_args.stack.lower())
|
||||||
if self.ansible_dir:
|
if self.ansible_dir:
|
||||||
self._dump_ansible_errors(
|
self._dump_ansible_errors(
|
||||||
os.path.join(self.ansible_dir,
|
os.path.join(self.ansible_dir,
|
||||||
|
|
Loading…
Reference in New Issue