Bug 1482477

Summary: Null values are not handled correctly when dumping data to file with tripleo-ansible-inventory
Product: Red Hat OpenStack Reporter: Yurii Prokulevych <yprokule>
Component: openstack-tripleo-validationsAssignee: Florian Fuchs <flfuchs>
Status: CLOSED ERRATA QA Contact: Honza Pokorny <hpokorny>
Severity: medium Docs Contact:
Priority: medium    
Version: 12.0 (Pike)CC: beth.white, gchamoul, hpokorny, jjoyce, jschluet, lbezdick, mandreou, sathlang, slinaber, tvignaud
Target Milestone: betaKeywords: Triaged
Target Release: 12.0 (Pike)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-tripleo-validations-7.3.1-0.20170831052729.67faa39.el7ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-13 21:53:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Yurii Prokulevych 2017-08-17 11:26:49 UTC
Description of problem:
-----------------------
Null values are not handled correctly, which leads to just key being dumped to the inventory file.

E.g: 
/usr/bin/tripleo-ansible-inventory --static-inventory oc-hosts
ansible -i oc-hosts Controllers -m ping -vv
Using /etc/ansible/ansible.cfg as config file
ERROR! Attempted to read "oc-hosts" as YAML: Syntax Error while loading YAML.

The error appears to have been in '/home/stack/oc-hosts': line 1, column 16, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

[aodh_evaluator:vars]
               ^ here

Attempted to read "oc-hosts" as ini file: oc-hosts:366: Expected key=value, got: cacert

Offending line: 
===============
[undercloud:vars]
...
auth_url = http://192.168.24.1:5000/
ansible_connection = local
--->cacert
undercloud_swift_url = http://192.168.24.1:8080/v1/AUTH_f83abc228845445dbc8cea361ee276ff
plan = overcloud

And when passing output through 'python -m json.tool':
======================================================
/usr/bin/tripleo-ansible-inventory --list | python -m json.tool
...
    "undercloud": {
        "hosts": [
            "localhost"
        ],
        "vars": {
            "ansible_connection": "local",
            "auth_url": "http://192.168.24.1:5000/",
            "cacert": null,
            "undercloud_swift_url": "http://192.168.24.1:8080/v1/AUTH_f83abc228845445dbc8cea361ee276ff",
            "username": "admin"
        }
...

Version-Release number of selected component (if applicable):
-------------------------------------------------------------
openstack-tripleo-validations-7.2.1-0.20170807182119.1f60b6f.el7ost.noarch

How reproducible:
-----------------
So far 100%

Comment 2 Gaël Chamoulaud 2017-10-03 14:09:15 UTC
FYI, This issue was fixed in the openstack/tripleo-validations 7.3.0 upstream release [1].

[1] - https://review.openstack.org/#/c/495965/

Comment 3 Gaël Chamoulaud 2017-10-03 14:40:26 UTC
(In reply to Gaël Chamoulaud from comment #2)
> FYI, This issue was fixed in the openstack/tripleo-validations 7.3.0
> upstream release [1].
> 
> [1] - https://review.openstack.org/#/c/495965/

And this change was included into openstack-tripleo-validations-7.3.1-0.20170831052729.67faa39.el7ost build.

Comment 9 errata-xmlrpc 2017-12-13 21:53:35 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/RHEA-2017:3462