Browse Source

Merge "Convert get_config to a direct call instead of using mistral"

tags/13.1.0
Zuul 1 week ago
parent
commit
8047aec5c4
7 changed files with 62 additions and 25 deletions
  1. +13
    -3
      tripleoclient/tests/v1/overcloud_ffwd_upgrade/fakes.py
  2. +6
    -0
      tripleoclient/tests/v1/overcloud_ffwd_upgrade/test_overcloud_ffwd_upgrade.py
  3. +13
    -3
      tripleoclient/tests/v1/overcloud_update/fakes.py
  4. +6
    -0
      tripleoclient/tests/v1/overcloud_update/test_overcloud_update.py
  5. +5
    -1
      tripleoclient/tests/v1/overcloud_upgrade/fakes.py
  6. +6
    -0
      tripleoclient/tests/v1/overcloud_upgrade/test_overcloud_upgrade.py
  7. +13
    -18
      tripleoclient/workflows/package_update.py

+ 13
- 3
tripleoclient/tests/v1/overcloud_ffwd_upgrade/fakes.py View File

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

+ 6
- 0
tripleoclient/tests/v1/overcloud_ffwd_upgrade/test_overcloud_ffwd_upgrade.py View File

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

+ 13
- 3
tripleoclient/tests/v1/overcloud_update/fakes.py View File

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

+ 6
- 0
tripleoclient/tests/v1/overcloud_update/test_overcloud_update.py View File

@@ -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,

+ 5
- 1
tripleoclient/tests/v1/overcloud_upgrade/fakes.py View File

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

+ 6
- 0
tripleoclient/tests/v1/overcloud_upgrade/test_overcloud_upgrade.py View File

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

+ 13
- 18
tripleoclient/workflows/package_update.py View File

@@ -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…
Cancel
Save