Select default openstack plan for tripleo deploy
This replicates the logic added to tripleo-common in https://review.openstack.org/#/c/579892/ so we select the default plan-samples/openstack files when no user provided files exist in the tht_render dir. Change-Id: I5ce97e7970648e65041a69a691aade2193834fb9
This commit is contained in:
parent
b10ca31475
commit
517512ec2e
|
@ -652,9 +652,12 @@ class TestDeployUndercloud(TestPluginV1):
|
|||
@mock.patch('tripleoclient.v1.tripleo_deploy.'
|
||||
'event_utils.poll_for_events',
|
||||
return_value=('CREATE_COMPLETE', 0))
|
||||
def test_take_action_standalone(self, mock_poll, mock_environ,
|
||||
mock_geteuid, mock_puppet, mock_killheat,
|
||||
mock_launchheat, mock_download, mock_tht,
|
||||
@mock.patch('tripleoclient.v1.tripleo_deploy.Deploy.'
|
||||
'_set_default_plan')
|
||||
def test_take_action_standalone(self, mock_def_plan, mock_poll,
|
||||
mock_environ, mock_geteuid, mock_puppet,
|
||||
mock_killheat, mock_launchheat,
|
||||
mock_download, mock_tht,
|
||||
mock_wait_for_port, mock_createdirs,
|
||||
mock_cleanupdirs, mock_launchansible,
|
||||
mock_tarball, mock_templates_dir,
|
||||
|
|
|
@ -249,6 +249,17 @@ class Deploy(command.Command):
|
|||
shutil.copytree(source_templates_dir, self.tht_render,
|
||||
symlinks=True)
|
||||
|
||||
def _set_default_plan(self):
|
||||
"""Populate default plan-environment.yaml and capabilities-map.yaml."""
|
||||
if not os.path.isfile(os.path.join(self.tht_render,
|
||||
'plan-environment.yaml')):
|
||||
shutil.copy(os.path.join(self.tht_render, 'plan-samples',
|
||||
'openstack', 'plan-environment.yaml'), self.tht_render)
|
||||
if not os.path.isfile(os.path.join(self.tht_render,
|
||||
'capabilities-map.yaml')):
|
||||
shutil.copy(os.path.join(self.tht_render, 'plan-samples',
|
||||
'openstack', 'capabilities-map.yaml'), self.tht_render)
|
||||
|
||||
def _cleanup_working_dirs(self, cleanup=False, user=None):
|
||||
"""Cleanup temporary working directories
|
||||
|
||||
|
@ -1008,6 +1019,9 @@ class Deploy(command.Command):
|
|||
self._populate_templates_dir(parsed_args.templates,
|
||||
parsed_args.deployment_user)
|
||||
|
||||
# Set default plan if not specified by user
|
||||
self._set_default_plan()
|
||||
|
||||
# configure our roles data
|
||||
self._set_roles_file(parsed_args.roles_file, self.tht_render)
|
||||
self._get_roles_data()
|
||||
|
|
Loading…
Reference in New Issue