Deploy validations SSH key in post config

Call the 'tripleo.validations.v1.copy_ssh_key' mistral workflow to
generate and copy validations SSH key to relevant nodes at the end of
provisioning.

Closes-Bug: #1621045
Change-Id: Ia3cb02067aee5e3344d72537bdd035d82dc77b0a
This commit is contained in:
Martin André 2016-08-29 17:19:42 +02:00 committed by Tomas Sedovic
parent bf0f777c4a
commit 3431bde072
2 changed files with 21 additions and 4 deletions

View File

@ -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()

View File

@ -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):