yaml-validate.py not compatible with python3

Bug #1783988 reported by Cédric Jeanneret
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
Medium
Cédric Jeanneret

Bug Description

Dear Stackers,

In tripleo-heat-templates, the pep8 tox task fails when we have python3 available.
We can find multiple occurrence of this kind of error:

Validating ./docker/services/octavia/octavia-deployment-config.yaml
Traceback (most recent call last):
  File "./tools/yaml-validate.py", line 1060, in validate
    retval |= validate_service_hiera_interpol(filename, tpl)
  File "./tools/yaml-validate.py", line 897, in validate_service_hiera_interpol
    search_keynames, enter_lists)
  File "./tools/yaml-validate.py", line 858, in _rsearch_keys
    return _rsearch_keys_nested(d, pattern, search_keynames, enter_lists)
  File "./tools/yaml-validate.py", line 813, in _rsearch_keys_nested
    for k, v in d.iteritems():
AttributeError: 'dict' object has no attribute 'iteritems'

For now, a change is proposed in order to fix python2 as the running version¹, but this is a quick fix.

I'm unfortunately not the right one for some python2->python3 migration :(.

Thank you!

Cheers,

C.

¹ https://review.openstack.org/#/c/586518/

Changed in tripleo:
assignee: nobody → Cédric Jeanneret (cjeanner)
status: Triaged → In Progress
Revision history for this message
Cédric Jeanneret (cjeanner) wrote :

Updated review in order to actually correct the script. It wasn't that hard :)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-heat-templates (master)

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

commit d37308d63c0b94ab0815416eaae9fe282c8181e4
Author: Cédric Jeanneret <email address hidden>
Date: Fri Jul 27 13:48:09 2018 +0200

    Fix python3 support in yaml-validate script.

    Python3 drops the "iteritems" method for dict in favor to
    "items".

    Change-Id: I8d21233e917b5d36be385d59f1a7c9a0588aea2d
    Closes-Bug: 1783988

Changed in tripleo:
status: In Progress → Fix Released
Changed in tripleo:
milestone: stein-1 → rocky-rc1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/tripleo-heat-templates 9.0.0.0rc1

This issue was fixed in the openstack/tripleo-heat-templates 9.0.0.0rc1 release candidate.

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.