diff --git a/tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py b/tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py index 5331ebb96..7d890b229 100644 --- a/tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py +++ b/tripleoclient/tests/v1/tripleo/test_tripleo_deploy.py @@ -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, diff --git a/tripleoclient/v1/tripleo_deploy.py b/tripleoclient/v1/tripleo_deploy.py index a8c80d49f..f21bad41d 100644 --- a/tripleoclient/v1/tripleo_deploy.py +++ b/tripleoclient/v1/tripleo_deploy.py @@ -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()