From b265e2e7b0f530be8523e69fe7b336366b5be2a4 Mon Sep 17 00:00:00 2001 From: Ryan Brady Date: Fri, 2 Feb 2018 09:28:40 -0500 Subject: [PATCH] Adds Update Parameters Workflow This patch adds a workflow to update the parameters in a given deployment plan so the tripleo.parameters.update action does not need to be called directly. This patch also makes a small change to the parameters.py file to mitigate a import overshadowing. Change-Id: I4be0edabad934db6cc203dd45be98a0a3b5fc6e0 Partial-Bug: 1640436 --- ...date-params-workflow-b26fd4cc40549537.yaml | 5 +++ tripleo_common/actions/parameters.py | 8 ++-- workbooks/plan_management.yaml | 42 +++++++++++++++++++ 3 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 releasenotes/notes/update-params-workflow-b26fd4cc40549537.yaml diff --git a/releasenotes/notes/update-params-workflow-b26fd4cc40549537.yaml b/releasenotes/notes/update-params-workflow-b26fd4cc40549537.yaml new file mode 100644 index 000000000..4c0210154 --- /dev/null +++ b/releasenotes/notes/update-params-workflow-b26fd4cc40549537.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Adds a workflow to update the parameters in a given deployment plan so the + tripleo.parameters.update action does not need to be called directly. \ No newline at end of file diff --git a/tripleo_common/actions/parameters.py b/tripleo_common/actions/parameters.py index 77e96dfa9..7abf2784d 100644 --- a/tripleo_common/actions/parameters.py +++ b/tripleo_common/actions/parameters.py @@ -27,7 +27,7 @@ from tripleo_common.actions import templates from tripleo_common import constants from tripleo_common import exception from tripleo_common.utils import nodes -from tripleo_common.utils import parameters +from tripleo_common.utils import parameters as parameter_utils from tripleo_common.utils import passwords as password_utils from tripleo_common.utils import plan as plan_utils @@ -223,7 +223,7 @@ class UpdateRoleParametersAction(UpdateParametersAction): def run(self, context): baremetal_client = self.get_baremetal_client(context) compute_client = self.get_compute_client(context) - self.parameters = parameters.set_count_and_flavor_params( + self.parameters = parameter_utils.set_count_and_flavor_params( self.role, baremetal_client, compute_client) return super(UpdateRoleParametersAction, self).run(context) @@ -514,8 +514,8 @@ class GetProfileOfFlavorAction(base.TripleOAction): def run(self, context): compute_client = self.get_compute_client(context) try: - return parameters.get_profile_of_flavor(self.flavor_name, - compute_client) + return parameter_utils.get_profile_of_flavor(self.flavor_name, + compute_client) except exception.DeriveParamsError as err: LOG.error('Derive Params Error: %s', err) return actions.Result(error=str(err)) diff --git a/workbooks/plan_management.yaml b/workbooks/plan_management.yaml index 4d2c9f514..b57d1d298 100644 --- a/workbooks/plan_management.yaml +++ b/workbooks/plan_management.yaml @@ -503,6 +503,48 @@ workflows: on-success: - fail: <% $.get('status') = "FAILED" %> + update_parameters: + description: > + Updates plan environment with parameters. + + tags: + - tripleo-common-managed + + input: + - container: overcloud + - parameters + - key + - queue_name: tripleo + + tasks: + update_parameters: + action: tripleo.parameters.update + input: + container: <% $.container %> + parameters: <% $.parameters %> + key: <% $.key %> + on-complete: notify_zaqar + publish-on-error: + status: FAILED + message: <% task().result %> + publish: + status: SUCCESS + message: <% task().result %> + + notify_zaqar: + action: zaqar.queue_post + input: + queue_name: <% $.queue_name %> + messages: + body: + type: tripleo.plan_management.v1.update_parameters + payload: + status: <% $.status %> + message: <% $.get('message', '') %> + execution: <% execution() %> + on-success: + - fail: <% $.get('status') = "FAILED" %> + publish_ui_logs_to_swift: description: > This workflow drains a zaqar queue, and publish its messages into a log