Pass the plan name when tagging nodes
Right now, tagging a node also updates the number of nodes assigned to that role. However because the plan/container name wasn't being passed, only the Mistral environment for the default 'overcloud' plan would ever be updated with these new values, sometimes mistakenly. Change-Id: Ifaeb9df96dbd7ca6a5553ecdc22c6ab8c56b7365 Partial-Bug: #1642342
This commit is contained in:
parent
d9de59e17e
commit
bdef2f7ee9
@ -120,8 +120,9 @@ class UpdateParametersAction(base.TripleOAction):
|
||||
class UpdateRoleParametersAction(UpdateParametersAction):
|
||||
"""Updates role related parameters in Mistral Environment ."""
|
||||
|
||||
def __init__(self, role):
|
||||
super(UpdateRoleParametersAction, self).__init__(parameters=None)
|
||||
def __init__(self, role, container=constants.DEFAULT_CONTAINER_NAME):
|
||||
super(UpdateRoleParametersAction, self).__init__(parameters=None,
|
||||
container=container)
|
||||
self.role = role
|
||||
|
||||
def run(self):
|
||||
|
@ -171,6 +171,40 @@ class UpdateParametersActionTest(base.TestCase):
|
||||
)
|
||||
|
||||
|
||||
class UpdateRoleParametersActionTest(base.TestCase):
|
||||
|
||||
@mock.patch('tripleo_common.utils.parameters.set_count_and_flavor_params')
|
||||
@mock.patch('tripleo_common.actions.base.TripleOAction.'
|
||||
'_get_baremetal_client')
|
||||
@mock.patch('tripleo_common.actions.base.TripleOAction.'
|
||||
'_get_compute_client')
|
||||
@mock.patch('tripleo_common.actions.base.TripleOAction.'
|
||||
'_get_workflow_client')
|
||||
@mock.patch('mistral.context.ctx')
|
||||
def test_run(self, mock_ctx, mock_get_workflow_client,
|
||||
mock_get_compute_client, mock_get_baremetal_client,
|
||||
mock_set_count_and_flavor):
|
||||
|
||||
mock_ctx.return_value = mock.MagicMock()
|
||||
mock_mistral = mock.MagicMock()
|
||||
mock_env = mock.MagicMock()
|
||||
mock_env.name = 'overcast'
|
||||
mock_env.variables = {}
|
||||
mock_mistral.environments.get.return_value = mock_env
|
||||
mock_get_workflow_client.return_value = mock_mistral
|
||||
|
||||
params = {'CephStorageCount': 1,
|
||||
'OvercloudCephStorageFlavor': 'ceph-storage'}
|
||||
mock_set_count_and_flavor.return_value = params
|
||||
|
||||
action = parameters.UpdateRoleParametersAction('ceph-storage',
|
||||
'overcast')
|
||||
action.run()
|
||||
|
||||
mock_mistral.environments.update.assert_called_once_with(
|
||||
name='overcast', variables={'parameter_defaults': params})
|
||||
|
||||
|
||||
class GeneratePasswordsActionTest(base.TestCase):
|
||||
|
||||
@mock.patch('tripleo_common.actions.base.TripleOAction.'
|
||||
|
@ -457,6 +457,7 @@ workflows:
|
||||
- tag_node_uuids
|
||||
- untag_node_uuids
|
||||
- role
|
||||
- plan: overcloud
|
||||
- queue_name: tripleo
|
||||
|
||||
task-defaults:
|
||||
@ -478,7 +479,7 @@ workflows:
|
||||
|
||||
update_role_parameters:
|
||||
on-success: send_message
|
||||
action: tripleo.parameters.update_role role=<% $.role %>
|
||||
action: tripleo.parameters.update_role role=<% $.role %> container=<% $.plan %>
|
||||
publish:
|
||||
message: <% task(update_role_parameters).result %>
|
||||
status: SUCCESS
|
||||
|
Loading…
Reference in New Issue
Block a user