Remove mistral from the expand_roles deploy workflow

This change removes all of mistral from the expand_roles function
by calling the required functions directly.

Story: 2007212
Task: 38782

Change-Id: I07c1249571e1fe989d57427412c1aaa6ea1ff165
Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
Kevin Carter 2020-02-17 18:52:54 -06:00
parent a14e145ff1
commit eee13397c2
No known key found for this signature in database
GPG Key ID: CE94BD890A47B20A
3 changed files with 12 additions and 37 deletions

View File

@ -14,8 +14,12 @@
#
import mock
from osc_lib.tests import utils
from tripleoclient import plugin
from tripleoclient.tests import fakes
class FakeClientWrapper(object):
@ -48,4 +52,7 @@ class TestOvercloudNode(utils.TestCommand):
self.app.client_manager.baremetal = mock.Mock()
self.app.client_manager.workflow_engine = mock.Mock()
self.app.client_manager.tripleoclient = FakeClientWrapper()
tc = self.app.client_manager.tripleoclient = FakeClientWrapper()
tc.create_mistral_context = plugin.ClientWrapper(
instance=fakes.FakeInstanceData
).create_mistral_context

View File

@ -1357,21 +1357,6 @@ class TestUnprovisionNode(fakes.TestOvercloudNode):
argslist, verifylist)
self.cmd.take_action(parsed_args)
self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal_deploy.v1.undeploy_roles',
workflow_input={
'plan': 'overcloud',
'roles': [{
'name': 'Unprovisioned',
'count': 0,
'instances': [
{'hostname': u'compute-0', 'provisioned': False},
{'hostname': u'controller-0', 'provisioned': False}
]
}]
}
)
def test_ok_all(self):
rv = mock.Mock()
rv.output = json.dumps({
@ -1405,20 +1390,3 @@ class TestUnprovisionNode(fakes.TestOvercloudNode):
parsed_args = self.check_parser(self.cmd,
argslist, verifylist)
self.cmd.take_action(parsed_args)
self.workflow.executions.create.assert_called_once_with(
'tripleo.baremetal_deploy.v1.undeploy_roles',
workflow_input={
'plan': 'overcloud',
'roles': [{
'name': 'Unprovisioned',
'count': 0,
'instances': [
{'hostname': u'compute-0', 'provisioned': False},
{'hostname': u'controller-0', 'provisioned': False},
{'hostname': u'compute-1', 'provisioned': False},
{'hostname': u'controller-1', 'provisioned': False}
]
}]
}
)

View File

@ -17,6 +17,7 @@ from __future__ import print_function
import six
from tripleo_common.actions import baremetal
from tripleo_common.actions import baremetal_deploy
from tripleoclient import exceptions
from tripleoclient.workflows import base
@ -613,11 +614,10 @@ def undeploy_roles(clients, **workflow_input):
def expand_roles(clients, roles, stackname, provisioned):
workflow_client = clients.workflow_engine
return base.call_action(
workflow_client,
'tripleo.baremetal_deploy.expand_roles',
context = clients.tripleoclient.create_mistral_context()
expand_roles = baremetal_deploy.ExpandRolesAction(
roles=roles,
stackname=stackname,
provisioned=provisioned
)
return expand_roles.run(context=context)