Bug 1489908 - format conversion issues wiht openstack HOT heat templates for lists and hashes
Summary: format conversion issues wiht openstack HOT heat templates for lists and hashes
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Automate
Version: 5.7.0
Hardware: All
OS: All
high
medium
Target Milestone: GA
: 5.9.0
Assignee: Bill Wei
QA Contact: Ola Pavlenko
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-08 15:53 UTC by Felix Dewaleyne
Modified: 2021-06-10 12:59 UTC (History)
10 users (show)

Fixed In Version: 5.9.0.1
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-03-01 13:17:22 UTC
Category: ---
Cloudforms Team: Openstack
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 3235101 0 None None None 2017-11-08 09:27:41 UTC
Red Hat Product Errata RHSA-2018:0380 0 normal SHIPPED_LIVE Moderate: Red Hat CloudForms security, bug fix, and enhancement update 2018-03-01 18:37:12 UTC

Description Felix Dewaleyne 2017-09-08 15:53:58 UTC
Description of problem:
when provisioning with an openstack hot heat template, values that are lists or hashes stay in the ruby format instead of being converted to the json format, causing errors in openstack

Version-Release number of selected component (if applicable):
5.7.3

How reproducible:
all the time

Steps to Reproduce:
1.provision using an openstack hot heat template similar to info in additional info
2.
3.

Actual results:
fog error :
{\"message\": \"Value must be valid JSON: Expecting ':' delimiter: line 1 column 8 (char 7)\", \"traceback\": null, \"type\": \"ValueError\"}, \"title\": \"Bad Request\"}"

Expected results:
value correctly converted to JSON format and passed to openstack

Additional info:

sample :
  private_subnet_spec:
    type: json
    label: Subnet Spec
    description: Subnet prefix and gateway ip.
    default:
      cidr: 192.168.1.0/24
      gateway_ip: 192.168.1.254

the same happens for lists :

  dns_nameservers:
    type: comma_delimited_list
    label: DNS Name Servers
    description: Dns name servers for private stand network
    default:
      - 172.30.0.14
      - 172.30.0.15

gives ["172.30.0.14", "172.30.0.15"]

customer followed  HOT heat template: https://access.redhat.com/documentation/en/red-hat-cloudforms/4.2/paged/integration-with-aws-cloudformation-and-openstack-heat/

Comment 3 CFME Bot 2017-10-04 12:33:16 UTC
New commit detected on ManageIQ/manageiq-providers-openstack/master:
https://github.com/ManageIQ/manageiq-providers-openstack/commit/670beeca1c2935bcb2edadf4fc8f133523acfd04

commit 670beeca1c2935bcb2edadf4fc8f133523acfd04
Author:     Bill Wei <bilwei>
AuthorDate: Thu Sep 28 15:16:05 2017 -0400
Commit:     Bill Wei <bilwei>
CommitDate: Tue Oct 3 16:11:37 2017 -0400

    Enhance parameter type handling
    
    Better support non-string parameter types including comma-delimited-list,
    number, boolean
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1489908

 .../openstack/cloud_manager/orchestration_stack.rb |  16 +++
 .../cloud_manager/orchestration_template.rb        | 137 ++++++++++++++++++---
 .../orchestration_templates/heat_parameters.json   |  89 ++++++++++++-
 .../orchestration_templates/heat_parameters.yml    |  61 ++++++---
 .../cloud_manager/orchestration_stack_spec.rb      |  10 ++
 .../cloud_manager/orchestration_template_spec.rb   | 115 +++++++++++------
 6 files changed, 357 insertions(+), 71 deletions(-)

Comment 4 Bill Wei 2017-10-13 19:51:23 UTC
The problem had to do with the default values showing on the dialog. For both JSON and Array types a TextBox was used, and their default values were shown in a Ruby format.

The following fixes have been merged into upstream master
1) For both JSON and Array types, now a TextBoxArea is used
2) For Array type, default values are broken into multiple lines, one entry per line
3) For JSON type, default value is shown in true JSON format in multiple lines.

However these fixes will NOT be back ported to prior releases because we have refactored orchestration template classes and dialog generators and moved them to different repositories.

There is a workaround for customers using prior releases. They only need to edit the value in TextBox to a proper format:
1) For Array type, a comma delimited string should be used, for example, 172.30.0.14,172.30.0.15
2) For JSON type, a JSON string should be used, for example, {"cidr":"192.168.1.0/24",
"gateway_ip":"192.168.1.254"}
Our TextBox has length limit so it may not be able to accept a long JSON string. User can then convert the TextBox into a TextBoxArea.

Doc team should document the change for next release.

Comment 7 errata-xmlrpc 2018-03-01 13:17:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:0380


Note You need to log in before you can comment on or make changes to this bug.