tht validate templates skips hiera interpolation checks when ean via py3

Bug #1817914 reported by Bogdan Dobrelya on 2019-02-27
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Medium
Bogdan Dobrelya

Bug Description

For https://review.openstack.org/#/c/639615/ it is expected to fail pep8, but it passes for py3.

$ python3 ./tools/process-templates.py
$ python3 tools/yaml-validate.py puppet/services/apache.yaml
Validating puppet/services/apache.yaml
ERROR: Did not find expected number of environments containing the EndpointMap parameter. If you meant to add or remove one of these environments then you also need to update this tool.
Mismatched parameter definitions: 0
Validation failed on:
endpoint_map.yaml
tls-endpoints-public-dns.yaml
tls-everywhere-endpoints-dns.yaml
tls-endpoints-public-ip.yaml
no-tls-endpoints-public-ip.yaml

$python tools/yaml-validate.py puppet/services/apache.yaml
Validating puppet/services/apache.yaml
ERROR: Missed %{hiera('... NETWORK ...')} interpolation in str_replace['template'] in puppet/services/apache.yaml, role_data: ['value', 'config_settings', 'map_merge', 0, 'apache::ip', 'str_replace', 'params', 'NETWORK', 'get_param', 0]
ERROR: Did not find expected number of environments containing the EndpointMap parameter. If you meant to add or remove one of these environments then you also need to update this tool.
Mismatched parameter definitions: 0
Validation failed on:
puppet/services/apache.yaml
endpoint_map.yaml
no-tls-endpoints-public-ip.yaml
tls-endpoints-public-ip.yaml
tls-endpoints-public-dns.yaml
tls-everywhere-endpoints-dns.yaml

Changed in tripleo:
importance: Undecided → Medium
milestone: none → stein-3
status: New → Triaged
Bogdan Dobrelya (bogdando) wrote :

So this boils down to

import re
path_str='value;config_settings;map_merge;0;apache::ip;str_replace;params;NETWORK;get_param;0'
query = re.compile(r'\\;str\\_replace\\;params\\;\S*?net',re.IGNORECASE)
query.search(re.escape(path_str))
<_sre.SRE_Match object at 0x7f39c5f586b0>

works for py2, but returns nothing for py3

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

Changed in tripleo:
assignee: nobody → Bogdan Dobrelya (bogdando)
status: Triaged → In Progress

Reviewed: https://review.openstack.org/639680
Committed: https://git.openstack.org/cgit/openstack/tripleo-heat-templates/commit/?id=d2eba382ccea9e38112dc8c596c923b6f53b288b
Submitter: Zuul
Branch: master

commit d2eba382ccea9e38112dc8c596c923b6f53b288b
Author: Bogdan Dobrelya <email address hidden>
Date: Wed Feb 27 15:36:01 2019 +0100

    Fix py3 compat for regex searches in YAML validate

    Closes-Bug: #1817914

    Change-Id: I985d1a7750c18d42042d689c56efee90c20b809c
    Signed-off-by: Bogdan Dobrelya <email address hidden>

Changed in tripleo:
status: In Progress → Fix Released

This issue was fixed in the openstack/tripleo-heat-templates 10.4.0 release.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers