Convert get_config to a direct call instead of using mistral
This change uses the the generated mistral context to call the underlying workflow function without needing mistral. Story: 2007212 Task: 38436 Depends-On: https://review.opendev.org/#/c/706196/ Change-Id: I79ded325b904bf0f60408250611935d229eda426 Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
parent
d76866404e
commit
04f8e338aa
|
@ -16,6 +16,7 @@
|
|||
import mock
|
||||
from osc_lib.tests import utils
|
||||
|
||||
from tripleoclient import plugin
|
||||
from tripleoclient.tests import fakes
|
||||
|
||||
|
||||
|
@ -47,11 +48,14 @@ class TestFFWDUpgradePrepare(utils.TestCommand):
|
|||
self.app.client_manager.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||
self.app.client_manager.baremetal = mock.Mock()
|
||||
self.app.client_manager.orchestration = mock.Mock()
|
||||
self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
workflow = execution = mock.Mock()
|
||||
execution.id = "IDID"
|
||||
workflow.executions.create.return_value = execution
|
||||
self.app.client_manager.workflow_engine = workflow
|
||||
tc = self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
tc.create_mistral_context = plugin.ClientWrapper(
|
||||
instance=fakes.FakeInstanceData
|
||||
).create_mistral_context
|
||||
|
||||
|
||||
class TestFFWDUpgradeRun(utils.TestCommand):
|
||||
|
@ -60,9 +64,12 @@ class TestFFWDUpgradeRun(utils.TestCommand):
|
|||
super(TestFFWDUpgradeRun, self).setUp()
|
||||
|
||||
self.app.client_manager.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||
self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
self.app.client_manager.workflow_engine = mock.Mock()
|
||||
self.app.client_manager.orchestration = mock.Mock()
|
||||
tc = self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
tc.create_mistral_context = plugin.ClientWrapper(
|
||||
instance=fakes.FakeInstanceData
|
||||
).create_mistral_context
|
||||
|
||||
|
||||
class TestFFWDUpgradeConverge(utils.TestCommand):
|
||||
|
@ -73,8 +80,11 @@ class TestFFWDUpgradeConverge(utils.TestCommand):
|
|||
self.app.client_manager.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||
self.app.client_manager.baremetal = mock.Mock()
|
||||
self.app.client_manager.orchestration = mock.Mock()
|
||||
self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
workflow = execution = mock.Mock()
|
||||
execution.id = "IDID"
|
||||
workflow.executions.create.return_value = execution
|
||||
self.app.client_manager.workflow_engine = workflow
|
||||
tc = self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
tc.create_mistral_context = plugin.ClientWrapper(
|
||||
instance=fakes.FakeInstanceData
|
||||
).create_mistral_context
|
||||
|
|
|
@ -35,6 +35,12 @@ class TestFFWDUpgradePrepare(fakes.TestFFWDUpgradePrepare):
|
|||
uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4")
|
||||
self.mock_uuid4 = uuid4_patcher.start()
|
||||
self.addCleanup(self.mock_uuid4.stop)
|
||||
config_mock = mock.patch(
|
||||
'tripleo_common.actions.config.GetOvercloudConfig',
|
||||
autospec=True
|
||||
)
|
||||
config_mock.start()
|
||||
self.addCleanup(config_mock.stop)
|
||||
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'take_action')
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
import mock
|
||||
from osc_lib.tests import utils
|
||||
|
||||
from tripleoclient import plugin
|
||||
from tripleoclient.tests import fakes
|
||||
|
||||
|
||||
|
@ -47,11 +48,14 @@ class TestOvercloudUpdatePrepare(utils.TestCommand):
|
|||
self.app.client_manager.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||
self.app.client_manager.baremetal = mock.Mock()
|
||||
self.app.client_manager.orchestration = mock.Mock()
|
||||
self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
workflow = execution = mock.Mock()
|
||||
execution.id = "IDID"
|
||||
workflow.executions.create.return_value = execution
|
||||
self.app.client_manager.workflow_engine = workflow
|
||||
tc = self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
tc.create_mistral_context = plugin.ClientWrapper(
|
||||
instance=fakes.FakeInstanceData
|
||||
).create_mistral_context
|
||||
|
||||
|
||||
class TestOvercloudUpdateRun(utils.TestCommand):
|
||||
|
@ -60,9 +64,12 @@ class TestOvercloudUpdateRun(utils.TestCommand):
|
|||
super(TestOvercloudUpdateRun, self).setUp()
|
||||
|
||||
self.app.client_manager.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||
self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
self.app.client_manager.workflow_engine = mock.Mock()
|
||||
self.app.client_manager.orchestration = mock.Mock()
|
||||
tc = self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
tc.create_mistral_context = plugin.ClientWrapper(
|
||||
instance=fakes.FakeInstanceData
|
||||
).create_mistral_context
|
||||
|
||||
|
||||
class TestOvercloudUpdateConverge(utils.TestCommand):
|
||||
|
@ -73,5 +80,8 @@ class TestOvercloudUpdateConverge(utils.TestCommand):
|
|||
self.app.client_manager.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||
self.app.client_manager.baremetal = mock.Mock()
|
||||
self.app.client_manager.orchestration = mock.Mock()
|
||||
self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
self.app.client_manager.workflow_engine = mock.Mock()
|
||||
tc = self.app.client_manager.tripleoclient = FakeClientWrapper()
|
||||
tc.create_mistral_context = plugin.ClientWrapper(
|
||||
instance=fakes.FakeInstanceData
|
||||
).create_mistral_context
|
||||
|
|
|
@ -35,6 +35,12 @@ class TestOvercloudUpdatePrepare(fakes.TestOvercloudUpdatePrepare):
|
|||
uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4")
|
||||
self.mock_uuid4 = uuid4_patcher.start()
|
||||
self.addCleanup(self.mock_uuid4.stop)
|
||||
config_mock = mock.patch(
|
||||
'tripleo_common.actions.config.GetOvercloudConfig',
|
||||
autospec=True
|
||||
)
|
||||
config_mock.start()
|
||||
self.addCleanup(config_mock.stop)
|
||||
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'_get_undercloud_host_entry', autospec=True,
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
import mock
|
||||
from osc_lib.tests import utils
|
||||
|
||||
from tripleoclient import plugin
|
||||
from tripleoclient.tests import fakes
|
||||
|
||||
|
||||
|
@ -47,7 +48,10 @@ class TestOvercloudUpgradePrepare(utils.TestCommand):
|
|||
self.app.client_manager.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||
self.app.client_manager.baremetal = mock.Mock()
|
||||
self.app.client_manager.orchestration = 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
|
||||
workflow = execution = mock.Mock()
|
||||
execution.id = "IDID"
|
||||
workflow.executions.create.return_value = execution
|
||||
|
|
|
@ -36,6 +36,12 @@ class TestOvercloudUpgradePrepare(fakes.TestOvercloudUpgradePrepare):
|
|||
uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4")
|
||||
self.mock_uuid4 = uuid4_patcher.start()
|
||||
self.addCleanup(self.mock_uuid4.stop)
|
||||
config_mock = mock.patch(
|
||||
'tripleo_common.actions.config.GetOvercloudConfig',
|
||||
autospec=True
|
||||
)
|
||||
config_mock.start()
|
||||
self.addCleanup(config_mock.stop)
|
||||
|
||||
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||
'take_action')
|
||||
|
|
|
@ -18,10 +18,11 @@ import time
|
|||
|
||||
from heatclient.common import event_utils
|
||||
from openstackclient import shell
|
||||
from tripleoclient import exceptions
|
||||
from tripleoclient import utils
|
||||
from tripleo_common.actions import config
|
||||
|
||||
from tripleoclient import constants
|
||||
from tripleoclient import exceptions
|
||||
from tripleoclient import utils
|
||||
from tripleoclient.workflows import base
|
||||
|
||||
_WORKFLOW_TIMEOUT = 120 * 60 # 2h
|
||||
|
@ -66,25 +67,19 @@ def update(clients, **workflow_input):
|
|||
raise exceptions.DeploymentError("Heat Stack update failed.")
|
||||
|
||||
|
||||
def get_config(clients, **workflow_input):
|
||||
workflow_client = clients.workflow_engine
|
||||
tripleoclients = clients.tripleoclient
|
||||
def get_config(clients, container):
|
||||
"""Get cloud config.
|
||||
|
||||
with tripleoclients.messaging_websocket() as ws:
|
||||
execution = base.start_workflow(
|
||||
workflow_client,
|
||||
'tripleo.package_update.v1.get_config',
|
||||
workflow_input=workflow_input
|
||||
)
|
||||
:param clients: Application client object.
|
||||
:type clients: Object
|
||||
|
||||
for payload in base.wait_for_messages(workflow_client, ws, execution,
|
||||
_WORKFLOW_TIMEOUT):
|
||||
assert payload['status'] == "SUCCESS", pprint.pformat(payload)
|
||||
:param container: Container name to pull from.
|
||||
:type container: String.
|
||||
"""
|
||||
|
||||
if payload['status'] == 'SUCCESS':
|
||||
print('Success')
|
||||
else:
|
||||
raise RuntimeError('Minor update failed with: {}'.format(payload))
|
||||
context = clients.tripleoclient.create_mistral_context()
|
||||
config_action = config.GetOvercloudConfig(container=container)
|
||||
config_action.run(context=context)
|
||||
|
||||
|
||||
def get_key(stack):
|
||||
|
|
Loading…
Reference in New Issue