diff --git a/instack_undercloud/tests/test_undercloud.py b/instack_undercloud/tests/test_undercloud.py index f40011594..df1c33f3c 100644 --- a/instack_undercloud/tests/test_undercloud.py +++ b/instack_undercloud/tests/test_undercloud.py @@ -478,8 +478,8 @@ class TestPostConfig(base.BaseTestCase): @mock.patch('instack_undercloud.undercloud._get_auth_values') @mock.patch('instack_undercloud.undercloud._configure_ssh_keys') @mock.patch('instack_undercloud.undercloud._ensure_flavor') - @mock.patch('instack_undercloud.undercloud._create_default_plan') - def test_post_config(self, mock_create_default_plan, mock_ensure_flavor, + @mock.patch('instack_undercloud.undercloud._post_config_mistral') + def test_post_config(self, mock_post_config_mistral, mock_ensure_flavor, mock_configure_ssh_keys, mock_get_auth_values, mock_copy_stackrc, mock_delete, mock_mistral_client, mock_nova_client): @@ -505,7 +505,7 @@ class TestPostConfig(base.BaseTestCase): mock.call(mock_instance, 'swift-storage', 'swift-storage'), ] mock_ensure_flavor.assert_has_calls(calls) - mock_create_default_plan.assert_called_once_with(mock_instance_mistral) + mock_post_config_mistral.assert_called_once_with(mock_instance_mistral) def test_create_default_plan(self): mock_mistral = mock.Mock() @@ -530,6 +530,12 @@ class TestPostConfig(base.BaseTestCase): undercloud._create_default_plan(mock_mistral) mock_mistral.executions.create.assert_not_called() + def test_prepare_ssh_environment(self): + mock_mistral = mock.Mock() + undercloud._prepare_ssh_environment(mock_mistral) + mock_mistral.executions.create.assert_called_once_with( + 'tripleo.validations.v1.copy_ssh_key') + @mock.patch('instack_undercloud.undercloud._run_command') def test_copy_stackrc(self, mock_run): undercloud._copy_stackrc() diff --git a/instack_undercloud/undercloud.py b/instack_undercloud/undercloud.py index 4fcdb4694..755bdb5de 100644 --- a/instack_undercloud/undercloud.py +++ b/instack_undercloud/undercloud.py @@ -1017,6 +1017,17 @@ def _create_default_plan(mistral): ) +def _prepare_ssh_environment(mistral): + mistral.executions.create('tripleo.validations.v1.copy_ssh_key') + + +def _post_config_mistral(mistral): + _create_default_plan(mistral) + + if CONF.enable_validations: + _prepare_ssh_environment(mistral) + + def _post_config(instack_env): _copy_stackrc() user, password, tenant, auth_url = _get_auth_values() @@ -1036,7 +1047,7 @@ def _post_config(instack_env): mistral_url = instack_env['UNDERCLOUD_ENDPOINT_MISTRAL_PUBLIC'] mistral = mistralclient.client(mistral_url, user, password, tenant, auth_url) - _create_default_plan(mistral) + _post_config_mistral(mistral) def install(instack_root):