Invalid JSON in parameters breaks deployments/parameters screen

Bug #1638523 reported by Julie Pichon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
High
Florian Fuchs

Bug Description

It's not always clear that pure JSON must be used for the parameters. If you make a mistake, the deployment will fail but it will become impossible to modify the parameter again.

Steps to reproduce
------------------
1. Pick an option, e.g. CephStorageConfig
2. Enter something wrong, e.g. the way you'd have made the change for a template: ceph::profile::params::osds:
  '/dev/sdc':
journal: '/dev/sdb'

Expected result
---------------
3. Some kind of warning, the wrong value is not saved in the Mistral environment

Actual result
-------------
3. The value is saved.

4. If you try to deploy, it fails with Failed to run action [action_ex_id=00e7c638-4741-4b79-a760-edfafb190cac, action_cls='<class 'mistral.actions.action_factory.DeployStackAction'>', attributes='{}', params='{u'container': u'master-tht-oct19', u'timeout': 240}'] ERROR: Failed to validate: Failed to validate: resources[0]: Value must be valid JSON: No JSON object could be decoded

5. If you reopen the parameters window, it closes quickly on its own before you can modify it, with the following error: Failed to run action [action_ex_id=None, action_cls='<class 'mistral.actions.action_factory.GetParametersAction'>', attributes='{}', params='{u'container': u'master-tht-oct19'}'] ERROR: Value must be valid JSON: No JSON object could be decoded

Julie Pichon (jpichon)
summary: - Entering invalid JSON for a parameter causes the UI to stop loading the
- configuration screen
+ Invalid JSON in parameters breaks deployments/parameters screen
Revision history for this message
Julie Pichon (jpichon) wrote :

This is what the parameter looks like in the mistral environment, after saving the wrong parameter:

"CephStorageExtraConfig": "ceph::profile::params::osds:\n '/dev/sdc':\n journal: '/dev/sdb'\n '/dev/sdd':\njournal: '/dev/sdb'"

Revision history for this message
Julie Pichon (jpichon) wrote :

As a workaround for when this happens, you can either update the broken parameter or reset the whole environment using the CLI, and start again.

$ openstack action execution run tripleo.parameters.update '{"container": "plan-name", "parameters": {"CephStorageExtraConfig": {}}}

$ openstack action execution run tripleo.parameters.reset '{"container": "plan-name"}'

Revision history for this message
Julie Pichon (jpichon) wrote :

I filed a bug for the tripleo-common side of things at bug 1638598. I set priority as medium because when working from the CLI it's easier to correct the problem, while in the UI you stay stuck or must switch the CLI - but feel free to change the importance if you disagree.

Changed in tripleo:
assignee: nobody → Florian Fuchs (flo-fuchs)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-ui (master)

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

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

Reviewed: https://review.openstack.org/393713
Committed: https://git.openstack.org/cgit/openstack/tripleo-ui/commit/?id=f7ddb6539685e981bca6fc6117fa54aae086fe65
Submitter: Jenkins
Branch: master

commit f7ddb6539685e981bca6fc6117fa54aae086fe65
Author: Florian Fuchs <email address hidden>
Date: Fri Nov 4 12:07:58 2016 +0100

    Validate JSON parameters

    This change adds a global `isJson` validation rule to the App component
    and uses it to validate parameter fields with the `json` type.

    Change-Id: I7c6826a32af63fb862017ea53d710447b61e57b6
    Closes-Bug: #1638523

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-ui (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/395580

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-ui (stable/newton)

Reviewed: https://review.openstack.org/395580
Committed: https://git.openstack.org/cgit/openstack/tripleo-ui/commit/?id=d5cd27997abf97e2c197b17050417123e40ff075
Submitter: Jenkins
Branch: stable/newton

commit d5cd27997abf97e2c197b17050417123e40ff075
Author: Florian Fuchs <email address hidden>
Date: Fri Nov 4 12:07:58 2016 +0100

    Validate JSON parameters

    This change adds a global `isJson` validation rule to the App component
    and uses it to validate parameter fields with the `json` type.

    Change-Id: I7c6826a32af63fb862017ea53d710447b61e57b6
    Closes-Bug: #1638523
    (cherry picked from commit f7ddb6539685e981bca6fc6117fa54aae086fe65)

tags: added: in-stable-newton
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-ui 1.0.5

This issue was fixed in the openstack/tripleo-ui 1.0.5 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-ui 2.0.0

This issue was fixed in the openstack/tripleo-ui 2.0.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-ui 1.0.5

This issue was fixed in the openstack/tripleo-ui 1.0.5 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.