Merge "Convert get_config to a direct call instead of using mistral"
This commit is contained in:
commit
8047aec5c4
|
@ -16,6 +16,7 @@
|
||||||
import mock
|
import mock
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
|
||||||
|
from tripleoclient import plugin
|
||||||
from tripleoclient.tests import fakes
|
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.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||||
self.app.client_manager.baremetal = mock.Mock()
|
self.app.client_manager.baremetal = mock.Mock()
|
||||||
self.app.client_manager.orchestration = mock.Mock()
|
self.app.client_manager.orchestration = mock.Mock()
|
||||||
self.app.client_manager.tripleoclient = FakeClientWrapper()
|
|
||||||
workflow = execution = mock.Mock()
|
workflow = execution = mock.Mock()
|
||||||
execution.id = "IDID"
|
execution.id = "IDID"
|
||||||
workflow.executions.create.return_value = execution
|
workflow.executions.create.return_value = execution
|
||||||
self.app.client_manager.workflow_engine = workflow
|
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):
|
class TestFFWDUpgradeRun(utils.TestCommand):
|
||||||
|
@ -60,9 +64,12 @@ class TestFFWDUpgradeRun(utils.TestCommand):
|
||||||
super(TestFFWDUpgradeRun, self).setUp()
|
super(TestFFWDUpgradeRun, self).setUp()
|
||||||
|
|
||||||
self.app.client_manager.auth_ref = mock.Mock(auth_token="TOKEN")
|
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.workflow_engine = mock.Mock()
|
||||||
self.app.client_manager.orchestration = 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):
|
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.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||||
self.app.client_manager.baremetal = mock.Mock()
|
self.app.client_manager.baremetal = mock.Mock()
|
||||||
self.app.client_manager.orchestration = mock.Mock()
|
self.app.client_manager.orchestration = mock.Mock()
|
||||||
self.app.client_manager.tripleoclient = FakeClientWrapper()
|
|
||||||
workflow = execution = mock.Mock()
|
workflow = execution = mock.Mock()
|
||||||
execution.id = "IDID"
|
execution.id = "IDID"
|
||||||
workflow.executions.create.return_value = execution
|
workflow.executions.create.return_value = execution
|
||||||
self.app.client_manager.workflow_engine = workflow
|
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")
|
uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4")
|
||||||
self.mock_uuid4 = uuid4_patcher.start()
|
self.mock_uuid4 = uuid4_patcher.start()
|
||||||
self.addCleanup(self.mock_uuid4.stop)
|
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.'
|
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||||
'take_action')
|
'take_action')
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
import mock
|
import mock
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
|
||||||
|
from tripleoclient import plugin
|
||||||
from tripleoclient.tests import fakes
|
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.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||||
self.app.client_manager.baremetal = mock.Mock()
|
self.app.client_manager.baremetal = mock.Mock()
|
||||||
self.app.client_manager.orchestration = mock.Mock()
|
self.app.client_manager.orchestration = mock.Mock()
|
||||||
self.app.client_manager.tripleoclient = FakeClientWrapper()
|
|
||||||
workflow = execution = mock.Mock()
|
workflow = execution = mock.Mock()
|
||||||
execution.id = "IDID"
|
execution.id = "IDID"
|
||||||
workflow.executions.create.return_value = execution
|
workflow.executions.create.return_value = execution
|
||||||
self.app.client_manager.workflow_engine = workflow
|
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):
|
class TestOvercloudUpdateRun(utils.TestCommand):
|
||||||
|
@ -60,9 +64,12 @@ class TestOvercloudUpdateRun(utils.TestCommand):
|
||||||
super(TestOvercloudUpdateRun, self).setUp()
|
super(TestOvercloudUpdateRun, self).setUp()
|
||||||
|
|
||||||
self.app.client_manager.auth_ref = mock.Mock(auth_token="TOKEN")
|
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.workflow_engine = mock.Mock()
|
||||||
self.app.client_manager.orchestration = 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):
|
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.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||||
self.app.client_manager.baremetal = mock.Mock()
|
self.app.client_manager.baremetal = mock.Mock()
|
||||||
self.app.client_manager.orchestration = mock.Mock()
|
self.app.client_manager.orchestration = mock.Mock()
|
||||||
self.app.client_manager.tripleoclient = FakeClientWrapper()
|
|
||||||
self.app.client_manager.workflow_engine = mock.Mock()
|
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")
|
uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4")
|
||||||
self.mock_uuid4 = uuid4_patcher.start()
|
self.mock_uuid4 = uuid4_patcher.start()
|
||||||
self.addCleanup(self.mock_uuid4.stop)
|
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.'
|
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||||
'_get_undercloud_host_entry', autospec=True,
|
'_get_undercloud_host_entry', autospec=True,
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
import mock
|
import mock
|
||||||
from osc_lib.tests import utils
|
from osc_lib.tests import utils
|
||||||
|
|
||||||
|
from tripleoclient import plugin
|
||||||
from tripleoclient.tests import fakes
|
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.auth_ref = mock.Mock(auth_token="TOKEN")
|
||||||
self.app.client_manager.baremetal = mock.Mock()
|
self.app.client_manager.baremetal = mock.Mock()
|
||||||
self.app.client_manager.orchestration = 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()
|
workflow = execution = mock.Mock()
|
||||||
execution.id = "IDID"
|
execution.id = "IDID"
|
||||||
workflow.executions.create.return_value = execution
|
workflow.executions.create.return_value = execution
|
||||||
|
|
|
@ -36,6 +36,12 @@ class TestOvercloudUpgradePrepare(fakes.TestOvercloudUpgradePrepare):
|
||||||
uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4")
|
uuid4_patcher = mock.patch('uuid.uuid4', return_value="UUID4")
|
||||||
self.mock_uuid4 = uuid4_patcher.start()
|
self.mock_uuid4 = uuid4_patcher.start()
|
||||||
self.addCleanup(self.mock_uuid4.stop)
|
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.'
|
@mock.patch('tripleoclient.v1.overcloud_deploy.DeployOvercloud.'
|
||||||
'take_action')
|
'take_action')
|
||||||
|
|
|
@ -18,10 +18,11 @@ import time
|
||||||
|
|
||||||
from heatclient.common import event_utils
|
from heatclient.common import event_utils
|
||||||
from openstackclient import shell
|
from openstackclient import shell
|
||||||
from tripleoclient import exceptions
|
from tripleo_common.actions import config
|
||||||
from tripleoclient import utils
|
|
||||||
|
|
||||||
from tripleoclient import constants
|
from tripleoclient import constants
|
||||||
|
from tripleoclient import exceptions
|
||||||
|
from tripleoclient import utils
|
||||||
from tripleoclient.workflows import base
|
from tripleoclient.workflows import base
|
||||||
|
|
||||||
_WORKFLOW_TIMEOUT = 120 * 60 # 2h
|
_WORKFLOW_TIMEOUT = 120 * 60 # 2h
|
||||||
|
@ -66,25 +67,19 @@ def update(clients, **workflow_input):
|
||||||
raise exceptions.DeploymentError("Heat Stack update failed.")
|
raise exceptions.DeploymentError("Heat Stack update failed.")
|
||||||
|
|
||||||
|
|
||||||
def get_config(clients, **workflow_input):
|
def get_config(clients, container):
|
||||||
workflow_client = clients.workflow_engine
|
"""Get cloud config.
|
||||||
tripleoclients = clients.tripleoclient
|
|
||||||
|
|
||||||
with tripleoclients.messaging_websocket() as ws:
|
:param clients: Application client object.
|
||||||
execution = base.start_workflow(
|
:type clients: Object
|
||||||
workflow_client,
|
|
||||||
'tripleo.package_update.v1.get_config',
|
|
||||||
workflow_input=workflow_input
|
|
||||||
)
|
|
||||||
|
|
||||||
for payload in base.wait_for_messages(workflow_client, ws, execution,
|
:param container: Container name to pull from.
|
||||||
_WORKFLOW_TIMEOUT):
|
:type container: String.
|
||||||
assert payload['status'] == "SUCCESS", pprint.pformat(payload)
|
"""
|
||||||
|
|
||||||
if payload['status'] == 'SUCCESS':
|
context = clients.tripleoclient.create_mistral_context()
|
||||||
print('Success')
|
config_action = config.GetOvercloudConfig(container=container)
|
||||||
else:
|
config_action.run(context=context)
|
||||||
raise RuntimeError('Minor update failed with: {}'.format(payload))
|
|
||||||
|
|
||||||
|
|
||||||
def get_key(stack):
|
def get_key(stack):
|
||||||
|
|
Loading…
Reference in New Issue