Bug 1377077 - Failed to detect an error in hiera YAML file
Summary: Failed to detect an error in hiera YAML file
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-tripleo-heat-templates
Version: 13.0 (Queens)
Hardware: x86_64
OS: Linux
high
medium
Target Milestone: ---
: 13.0 (Queens)
Assignee: RHOS Maint
QA Contact: Gurenko Alex
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-18 08:27 UTC by Yogev Rabl
Modified: 2019-04-02 21:14 UTC (History)
17 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-04-02 20:47:54 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Yogev Rabl 2016-09-18 08:27:59 UTC
Description of problem:
Heat failed to detect an indentation mistake in one of the YAML templates during Openstack installation with OSPD.

The YAML template was
ceph::profile::params::osd_journal_size: 5120
ceph::profile::params::osd_pool_default_pg_num: 1024
ceph::profile::params::osd_pool_default_pgp_num: 1024
ceph::profile::params::osd_pool_default_size: 3
ceph::profile::params::osd_pool_default_min_size: 2
ceph::profile::params::osds:
 '/dev/vda':
    journal: {}
  '/dev/vdb':
    journal: {}
  '/dev/vdc':
    journal: {}
  '/dev/vdd':
    journal: {}
  '/dev/vde':
    journal: {}
  '/dev/vdf':
    journal: {}
  '/dev/vdg':
    journal: {}
  '/dev/vdh':
    journal: {}
  '/dev/vdi':
    journal: {}
  '/dev/vdj':
    journal: {}
ceph::profile::params::manage_repo: false
ceph::profile::params::authentication_type: cephx

ceph_classes: []

ceph_osd_selinux_permissive: true


with the line of 'vdb' lacked one space. Heat should've indicated an error in the templates

Version-Release number of selected component (if applicable):
openstack-heat-api-cfn-6.0.0-11.el7ost.noarch
openstack-heat-common-6.0.0-11.el7ost.noarch
python-heatclient-1.2.0-1.el7ost.noarch
openstack-heat-templates-0-0.3.96a0b0bgit.el7ost.noarch
heat-cfntools-1.3.0-2.el7ost.noarch
openstack-heat-api-6.0.0-11.el7ost.noarch
python-heat-tests-6.0.0-11.el7ost.noarch
openstack-heat-engine-6.0.0-11.el7ost.noarch

How reproducible:
100% 

Steps to Reproduce:
1. Deploy a stack with an indentation error in one of the tamplates


Actual results:
An unrelated error cause the deployment to fail

Expected results:
The deployment will not start due to an error in the template

Additional info:

Comment 2 Zane Bitter 2016-09-19 12:21:18 UTC
That... isn't a Heat template file. If it were then Heat would certainly be reporting an error, because PyYAML raises an exception when you try to parse it.

Comment 3 Yogev Rabl 2016-09-20 06:51:56 UTC
(In reply to Zane Bitter from comment #2)
> That... isn't a Heat template file. If it were then Heat would certainly be
> reporting an error, because PyYAML raises an exception when you try to parse
> it.

Shouldn't Heat parse all of the templates in the templates directory?

Comment 4 Steve Baker 2016-09-20 22:00:00 UTC
The heat client will parse heat templates and environment files, but not other included files which just happen to be YAML.

I don't have enough context in comment #0 to say whether heat would consider this part of a template. Could you please provide a more complete example?

Comment 5 Yogev Rabl 2016-09-21 10:20:00 UTC
(In reply to Steve Baker from comment #4)
> The heat client will parse heat templates and environment files, but not
> other included files which just happen to be YAML.
> 
> I don't have enough context in comment #0 to say whether heat would consider
> this part of a template. Could you please provide a more complete example?

1. The entire issue is that error. Can we add this functionality, validation of the YAML files of the entire templates before deployment?

2. What would you like me to add, the heat-engine.log?

Comment 6 Steve Baker 2016-09-21 21:07:13 UTC
I need to see how this yaml is being included in your templates, so I need a more full template example.

Comment 7 Yogev Rabl 2016-09-25 11:38:23 UTC
This is the existing file, located in /usr/share/openstack-tripleo-heat-templates/puppet/hiera/ceph.yaml 
after I've edited it

Comment 8 Zane Bitter 2016-10-14 15:12:34 UTC
(In reply to Yogev Rabl from comment #3)
> Shouldn't Heat parse all of the templates in the templates directory?

No, it only parses the ones that it's going to create a stack from.

In this case, this isn't even a Heat template, it's a Puppet Hiera file that just happens to be in YAML format (though Heat neither knows nor cares about that). It's Puppet's job to verify that the file is valid; we don't want to enforce that in Heat because we can't possibly know about every configuration file format that users might want to give us.

This *would*, however, be a good candidate for a pre-flight validation, since TripleO knows that this is a hiera file. So I'm moving this bug to tripleo-validations and retargeting to OSP11.

Comment 12 Emilien Macchi 2017-11-21 23:03:38 UTC
I'm currently testing it on https://review.openstack.org/522038

Comment 18 Alex Schultz 2019-04-02 20:47:54 UTC
So closing this out because I think this was an issue prior to 10 when you would configure these values in a hieradata file rather than heat templates. Today these values would be in a yaml file which would results in a failure when it gets loaded.  If this is still the case in a newer version, please provide specific reproducer details.

Comment 19 Alex Schultz 2019-04-02 21:14:03 UTC
And for the record this is because we used to split this hieradata out in to a get_file call in heat yaml. In the future if someone wanted to invest in a typed get_file in heat that could be used address this issue. http://git.openstack.org/cgit/openstack/tripleo-heat-templates/tree/puppet/controller.yaml?h=liberty-eol#n1294


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