Workflow to get the list of deprecated parameters from the plan

Templates can have parameter_groups with label as deprecated to
specific the list of deprecated parameters. This workflow will
return the list all the deprecated parameters including nested
stacks. The sample output will look like -
[
    {
        "deprecated": true,
        "parameter": "ServiceNetMapDeprecatedMapping",
        "user_defined": false
    },
    {
        "deprecated": true,
        "parameter": "NeutronL3HA",
        "user_defined": true
    }
]

Depends-On: I032144733bde916f8de8644121b9fb1ef29baef2

Change-Id: I18430b7d7bca7c58b75569e3d296e315227e6f61
This commit is contained in:
Saravanan KR 2017-05-11 14:47:37 +05:30
parent bff587cf43
commit 847e31069a
3 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,3 @@
---
features:
- Added a workflow to list all the deprecated parameters in the plan

View File

@ -398,6 +398,8 @@ class GetFlattenedParametersAction(GetParametersAction):
if 'Parameters' in data:
value['parameters'] = self._processParams(flattened,
data['Parameters'])
if 'ParameterGroups' in data:
value['parameter_groups'] = data['ParameterGroups']
if 'NestedParameters' in data:
nested = data['NestedParameters']
nested_ids = []

View File

@ -415,3 +415,49 @@ workflows:
tempurl: <% task(create_tempurl).result %>
on-success:
- fail: <% $.get('status') = "FAILED" %>
get_deprecated_parameters:
description: Gets the list of deprecated parameters in the whole of the plan including nested stack
input:
- container: overcloud
- queue_name: tripleo
tasks:
get_flatten_data:
action: tripleo.parameters.get_flatten container=<% $.container %>
on-success: get_deprecated_params
on-error: set_status_failed_get_flatten_data
publish:
user_params: <% task().result.environment_parameters %>
parameter_groups: <% task().result.heat_resource_tree.resources.values().where( $.get('parameter_groups') ).select($.parameter_groups).flatten() %>
get_deprecated_params:
on-success: check_if_user_param_has_deprecated
publish:
deprecated_params: <% $.parameter_groups.where($.get('label') = 'deprecated').select($.parameters).flatten().distinct() %>
check_if_user_param_has_deprecated:
on-success: send_message
publish:
formatted: <% let(up => $.user_params) -> $.deprecated_params.select( dict('parameter' => $, 'deprecated' => true, 'user_defined' => $up.keys().contains($)) ) %>
set_status_failed_get_flatten_data:
on-success: send_message
publish:
status: FAILED
message: <% task(get_flatten_data).result %>
send_message:
action: zaqar.queue_post
input:
queue_name: <% $.queue_name %>
messages:
body:
type: tripleo.plan_management.v1.get_deprecated_parameters
payload:
status: <% $.get('status', 'SUCCESS') %>
message: <% $.get('message', '') %>
execution: <% execution() %>
deprecated: <% $.get('formatted', []) %>
on-success:
- fail: <% $.get('status') = "FAILED" %>