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.
Currently the UpdateParameter sAction 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: ction (If heat provides the data, it would be nice if response included parameter errors in format
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 GetParamertersA
{ Parameter1: 'error message',
Parameter2: 'another error }