Remove mistral when creating the overcloudrc file.

Remove the mistral indirection and Use the tripleo-common
infrastructure directly when creating an overcloudrc file.

Story: 2007212
Task: 38426

Change-Id: Iaf6a401f510b768f26f3ff95a9c47d2d1dced71d
Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
Luke Short 2019-11-13 13:45:43 -05:00 committed by apetrich
parent 8416553903
commit 0e901cda25
3 changed files with 13 additions and 44 deletions

View File

@ -25,25 +25,14 @@ class TestOvercloudCredentials(test_plugin.TestPluginV1):
super(TestOvercloudCredentials, self).setUp()
self.cmd = overcloud_credentials.OvercloudCredentials(self.app, None)
workflow = execution = mock.Mock()
execution.id = "IDID"
workflow.executions.create.return_value = execution
self.app.client_manager.workflow_engine = workflow
self.app.client_manager.workflow_engine = self.workflow = workflow
self.tripleoclient = mock.Mock()
self.websocket = mock.Mock()
self.websocket.__enter__ = lambda s: self.websocket
self.websocket.__exit__ = lambda s, *exc: None
self.tripleoclient.messaging_websocket.return_value = self.websocket
self.app.client_manager.tripleoclient = self.tripleoclient
self.websocket.wait_for_messages.return_value = iter([{
"execution_id": "IDID",
"status": "SUCCESS",
"message": {
"overcloudrc": "OVERCLOUDRC CONTENTS",
}
}])
self.rc_action_patcher = mock.patch(
'tripleo_common.actions.deployment.OvercloudRcAction',
autospec=True)
self.mock_rc_action = self.rc_action_patcher.start()
self.addCleanup(self.rc_action_patcher.stop)
@mock.patch('os.chmod')
def test_ok(self, mock_chmod):
@ -62,10 +51,6 @@ class TestOvercloudCredentials(test_plugin.TestPluginV1):
mock_chmod.assert_has_calls([
mock.call('./overcloudrc', 384)])
self.workflow.executions.create.assert_called_once_with(
'tripleo.deployment.v1.create_overcloudrc',
workflow_input={'container': 'overcloud'})
@mock.patch('os.chmod')
def test_okay_custom_dir(self, mock_chmod):
@ -87,7 +72,3 @@ class TestOvercloudCredentials(test_plugin.TestPluginV1):
self.assertIn(mock.call(path, 'w'), m.call_args_list)
mock_chmod.assert_has_calls([
mock.call(path, 384)])
self.workflow.executions.create.assert_called_once_with(
'tripleo.deployment.v1.create_overcloudrc',
workflow_input={'container': 'overcloud'})

View File

@ -145,6 +145,11 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
)
flatten.start()
self.addCleanup(flatten.stop)
self.rc_action_patcher = mock.patch(
'tripleo_common.actions.deployment.OvercloudRcAction',
autospec=True)
self.mock_rc_action = self.rc_action_patcher.start()
self.addCleanup(self.rc_action_patcher.stop)
# Mock playbook runner
playbook_runner = mock.patch(

View File

@ -118,26 +118,9 @@ def deploy_and_wait(log, clients, stack, plan_name, verbose_level,
raise exceptions.DeploymentError("Heat Stack update failed.")
def create_overcloudrc(clients, **workflow_input):
workflow_client = clients.workflow_engine
tripleoclients = clients.tripleoclient
with tripleoclients.messaging_websocket() as ws:
execution = base.start_workflow(
workflow_client,
'tripleo.deployment.v1.create_overcloudrc',
workflow_input=workflow_input
)
for payload in base.wait_for_messages(workflow_client, ws, execution):
# the workflow will return the overcloudrc data, an error message
# or blank.
if payload.get('status') == 'SUCCESS':
return payload.get('message')
else:
raise exceptions.WorkflowServiceError(
'Exception creating overcloudrc: {}'.format(
payload.get('message')))
def create_overcloudrc(clients, container="overcloud", no_proxy=''):
context = clients.tripleoclient.create_mistral_context()
return deployment.OvercloudRcAction(container, no_proxy).run(context)
def get_overcloud_hosts(stack, ssh_network):