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
This commit is contained in:
Ryan Brady 2018-02-02 09:28:40 -05:00
parent aa44e05495
commit b265e2e7b0
3 changed files with 51 additions and 4 deletions

View File

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

View File

@ -27,7 +27,7 @@ from tripleo_common.actions import templates
from tripleo_common import constants from tripleo_common import constants
from tripleo_common import exception from tripleo_common import exception
from tripleo_common.utils import nodes 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 passwords as password_utils
from tripleo_common.utils import plan as plan_utils from tripleo_common.utils import plan as plan_utils
@ -223,7 +223,7 @@ class UpdateRoleParametersAction(UpdateParametersAction):
def run(self, context): def run(self, context):
baremetal_client = self.get_baremetal_client(context) baremetal_client = self.get_baremetal_client(context)
compute_client = self.get_compute_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) self.role, baremetal_client, compute_client)
return super(UpdateRoleParametersAction, self).run(context) return super(UpdateRoleParametersAction, self).run(context)
@ -514,7 +514,7 @@ class GetProfileOfFlavorAction(base.TripleOAction):
def run(self, context): def run(self, context):
compute_client = self.get_compute_client(context) compute_client = self.get_compute_client(context)
try: try:
return parameters.get_profile_of_flavor(self.flavor_name, return parameter_utils.get_profile_of_flavor(self.flavor_name,
compute_client) compute_client)
except exception.DeriveParamsError as err: except exception.DeriveParamsError as err:
LOG.error('Derive Params Error: %s', err) LOG.error('Derive Params Error: %s', err)

View File

@ -503,6 +503,48 @@ workflows:
on-success: on-success:
- fail: <% $.get('status') = "FAILED" %> - 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: publish_ui_logs_to_swift:
description: > description: >
This workflow drains a zaqar queue, and publish its messages into a log This workflow drains a zaqar queue, and publish its messages into a log