Parameters should be validated before being saved to Mistral

Bug #1638598 reported by Julie Pichon
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
Medium
Adriano Petrich

Bug Description

Parameters are saved to Mistral even when the data isn't valid and will prevent the deployment from starting.

Steps to reproduce
------------------
$ cat params.yaml
parameter_defaults:
  CephStorageExtraConfig: "ceph::profile::params::osds:\n '/dev/sdc':\njournal: '/dev/sdc'"
$ openstack overcloud parameters set overcloud params.yaml

Expected result
---------------
Some kind of error message, and the wrong parameter not to be saved.

Actual result
-------------
The broken data is saved and the deployment fails at the beginning. The specific parameter causing the problem is not mentioned either.

$ openstack overcloud deploy --templates --control-scale 1 --compute-scale 1 --ceph-storage-scale 1 --neutron-network-type vxlan --neutron-tunnel-types vxlan,gre --ntp-server clock.redhat.com -e /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml -e /usr/share/openstack-tripleo-heat-templates/environments/puppet-pacemaker.yaml
Removing the current plan files
Uploading new plan files
Started Mistral Workflow tripleo.plan_management.v1.update_deployment_plan. Execution ID: 2dd69963-a78f-4030-b61d-866a20f68c87
Plan updated
Deploying templates in the directory /tmp/tripleoclient-cmh_Lr/tripleo-heat-templates
Started Mistral Workflow tripleo.deployment.v1.deploy_plan. Execution ID: ad1d855f-3dbc-46d2-9d6e-b1989806ce61
{u'execution': {u'id': u'ad1d855f-3dbc-46d2-9d6e-b1989806ce61',
                u'input': {u'container': u'overcloud',
                           u'queue_name': u'79af5154-b986-46fb-bd79-f11c2853cf9b',
                           u'timeout': 240},
                u'name': u'tripleo.deployment.v1.deploy_plan',
                u'params': {},
                u'spec': {u'input': [u'container',
                                     {u'timeout': 240},
                                     {u'queue_name': u'tripleo'}],
                          u'name': u'deploy_plan',
                          u'tasks': {u'add_validation_ssh_key': {u'name': u'add_validation_ssh_key',
                                                                 u'on-complete': u'deploy',
                                                                 u'type': u'direct',
                                                                 u'version': u'2.0',
                                                                 u'workflow': u'tripleo.validations.v1.add_validation_ssh_key_parameter container=<% $.container %>'},
                                     u'deploy': {u'action': u'tripleo.deployment.deploy timeout=<% $.timeout %> container=<% $.container %>',
                                                 u'name': u'deploy',
                                                 u'on-error': u'set_deployment_failed',
                                                 u'on-success': u'send_message',
                                                 u'type': u'direct',
                                                 u'version': u'2.0'},
                                     u'send_message': {u'action': u'zaqar.queue_post',
                                                       u'input': {u'messages': {u'body': {u'payload': {u'execution': u'<% execution() %>',
                                                                                                       u'message': u"<% $.get('message', '') %>",
                                                                                                       u'status': u"<% $.get('status', 'SUCCESS') %>"},
                                                                                          u'type': u'tripleo.deployment.v1.deploy_plan'}},
                                                                  u'queue_name': u'<% $.queue_name %>'},
                                                       u'name': u'send_message',
                                                       u'retry': u'count=5 delay=1',
                                                       u'type': u'direct',
                                                       u'version': u'2.0'},
                                     u'set_deployment_failed': {u'name': u'set_deployment_failed',
                                                                u'on-success': u'send_message',
                                                                u'publish': {u'message': u'<% task(deploy).result %>',
                                                                             u'status': u'FAILED'},
                                                                u'type': u'direct',
                                                                u'version': u'2.0'}},
                          u'version': u'2.0'}},
 u'message': u"Failed to run action [action_ex_id=5129ed4b-af8a-4e29-b48d-6452c4d163e0, action_cls='<class 'mistral.actions.action_factory.DeployStackAction'>', attributes='{}', params='{u'container': u'overcloud', u'timeout': 240}']\n ERROR: Failed to validate: Failed to validate: resources[0]: Value must be valid JSON: No JSON object could be decoded",
 u'status': u'FAILED'}

Additional information
----------------------
A related bug was filed for the web UI at bug 1638523.

Steven Hardy (shardy)
Changed in tripleo:
milestone: ocata-1 → ocata-2
Revision history for this message
Jiri Tomasek (jtomasek) wrote :

Currently the UpdateParametersAction only updates the mistral environment with updated values. This is quite insufficient because value needs to get validated by heat before it is saved.

If value which fails validation gets saved in mistral environment, it is no more possible to successfully get parameters which means UI is not able to fix the situation without resetting the mistral environment.

Proposed flow:
1. Receive a list of parameter names and values to update
2. Run GetParametersAction including those parameters (runs heat-validate)
3. In case of success, return response from GetParametersAction
4. In case of failure, return error response from GetParamertersAction (If heat provides the data, it would be nice if response included parameter errors in format
{ Parameter1: 'error message',
  Parameter2: 'another error }

Changed in tripleo:
milestone: ocata-2 → ocata-3
Dougal Matthews (d0ugal)
tags: added: workflows
Changed in tripleo:
milestone: ocata-3 → pike-1
Changed in tripleo:
milestone: pike-1 → pike-2
Changed in tripleo:
milestone: pike-2 → pike-3
Changed in tripleo:
milestone: pike-3 → pike-rc1
Changed in tripleo:
milestone: pike-rc1 → queens-1
Changed in tripleo:
assignee: nobody → Adriano Petrich (apetrich)
Changed in tripleo:
milestone: queens-1 → queens-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-common (master)

Fix proposed to branch: master
Review: https://review.openstack.org/511249

Changed in tripleo:
status: Triaged → In Progress
Changed in tripleo:
milestone: queens-2 → queens-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-common (master)

Reviewed: https://review.openstack.org/511249
Committed: https://git.openstack.org/cgit/openstack/tripleo-common/commit/?id=52159197d895b65ff3720f5ee09f6b22a8a1528f
Submitter: Zuul
Branch: master

commit 52159197d895b65ff3720f5ee09f6b22a8a1528f
Author: Adriano Petrich <email address hidden>
Date: Wed Oct 11 14:59:20 2017 +0100

    Validate parameters before updating

    When updating parameters we save the old env try updating it
    and test if that works and validates. If it doesn't the old env is
    restored. The update params also now returns the flattened params
    saving the ui from having to make another call after the update.

    Change-Id: I9aa18c4152ff9bf896729ace0d9481af50fd7802
    Closes-Bug: #1638598

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-common 8.4.0

This issue was fixed in the openstack/tripleo-common 8.4.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.