newton config-template change breaks previously working configuration

Bug #1705469 reported by Jesse Pretorius
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack-Ansible
Fix Released
High
Unassigned

Bug Description

I don't know if this is an issue for later branches, but a recent config template change [1] for newton has changed the results, causing things to break.

For example, when implementing:

    openstack_user_config_overrides:
      shared-infra_hosts:
        aio1:
          affinity:
            galera_container: 3
            rabbit_mq_container: 3
          ip: 172.29.236.100

The result used to be:

shared-infra_hosts:
  aio1:
    affinity:
      galera_container: 3
      rabbit_mq_container: 3
    ip: 172.29.236.100

but is now:

shared-infra_hosts:
  aio1:
    affinity:
      galera_container: '3'
      rabbit_mq_container: '3'
    ip: 172.29.236.100

which causes:

Inventory script (/opt/rpc-openstack/openstack-ansible/playbooks/inventory/dynamic_inventory.py) had an execution error: Traceback (most recent call last):
  File "/opt/rpc-openstack/openstack-ansible/playbooks/inventory/dynamic_inventory.py", line 1348, in <module>
    output = main(**all_args)
  File "/opt/rpc-openstack/openstack-ansible/playbooks/inventory/dynamic_inventory.py", line 1296, in main
    user_defined_config
  File "/opt/rpc-openstack/openstack-ansible/playbooks/inventory/dynamic_inventory.py", line 772, in container_skel_load
    value.get('properties')
  File "/opt/rpc-openstack/openstack-ansible/playbooks/inventory/dynamic_inventory.py", line 465, in _add_container_hosts
    assignment,
  File "/opt/rpc-openstack/openstack-ansible/playbooks/inventory/dynamic_inventory.py", line 246, in _build_container_hosts
    for make_container in range(container_affinity):
TypeError: range() integer end argument expected, got str.
Options

[1] https://github.com/openstack/openstack-ansible-plugins/commit/64353d8ff0d0c2d803aba1f2af607e7ffb13c662

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to openstack-ansible (stable/newton)

Related fix proposed to branch: stable/newton
Review: https://review.openstack.org/485592

Revision history for this message
Matthew Thode (prometheanfire) wrote :

I think a better fix would be to just use six (if I can, not sure of what python modules are available).

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to openstack-ansible (stable/newton)

Reviewed: https://review.openstack.org/485592
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible/commit/?id=a44a21db5203a4da03608a549d0ea2ba41d46a86
Submitter: Jenkins
Branch: stable/newton

commit a44a21db5203a4da03608a549d0ea2ba41d46a86
Author: Jesse Pretorius (odyssey4me) <email address hidden>
Date: Thu Jul 20 12:26:29 2017 +0000

    Revert "Update plugins repo SHA to include unicode fix"

    This reverts commit 58bd8b8bceee7be49a81760d8a33fa732c232ea8.

    Change-Id: I6b973c997895c9000c0e7be75422ef2a9ff0e787
    Related-Bug: 1705469

tags: added: in-stable-newton
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstack-ansible-plugins (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/486754

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-ansible-plugins (stable/newton)

Reviewed: https://review.openstack.org/486754
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible-plugins/commit/?id=782460644902f391cadb83e61c882956c0e569ee
Submitter: Jenkins
Branch: stable/newton

commit 782460644902f391cadb83e61c882956c0e569ee
Author: Matthew Thode <email address hidden>
Date: Mon Jul 24 16:05:12 2017 -0500

    Do not convert integers to strings

    When overrides are used in config templates the previous behavior was to
    not convert the integers to strings. The previous change,
    I8986688efbd7e05ba17c3d61ee032dcc29d3b05d changed this behavior. The
    reason why try-except was used instead of isnumeric is because isnumeric
    only accepts positive numbers, while we could strip signs off the ends,
    that could alter things past what we want.

    Closes-Bug: #1705469

    Change-Id: I5927cdcd06b4398c76b4e4d33f7a21335a6abbf2
    Signed-off-by: Matthew Thode <email address hidden>

Revision history for this message
Hugh Saunders (hughsaunders) wrote :

I'm not sure https://git.openstack.org/cgit/openstack/openstack-ansible-plugins/commit/?id=782460644902f391cadb83e61c882956c0e569ee entirely fixes the problem, what if the value is a float or a bool?

Changed in openstack-ansible:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Matthew Thode (prometheanfire)
Revision history for this message
Matthew Thode (prometheanfire) wrote :

I'm not sure there's going to be a perfectly clean way of doing this. IF we only care about loading ascii bytestrings then we could probably force the load of the text as bytestring then yaml.load it (I don't see a way of directly yaml.loading bytestrings). Does that sound good? We could also revert both commits and just live with the bug, telling people to upgrade to ocata or above.

Revision history for this message
Matthew Thode (prometheanfire) wrote :

bug talk today said to back out the two commits and just roll forward with it already being fixed in ocata on.

782460644902f391cadb83e61c882956c0e569ee and 64353d8ff0d0c2d803aba1f2af607e7ffb13c662

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to openstack-ansible-plugins (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/492148

Revision history for this message
Matthew Thode (prometheanfire) wrote :

in case it doesn't link, https://review.openstack.org/492148

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-ansible-plugins (stable/newton)

Reviewed: https://review.openstack.org/492148
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible-plugins/commit/?id=d9669419bf63d92c7fd0702ee6ca48fab3ea0a0a
Submitter: Jenkins
Branch: stable/newton

commit d9669419bf63d92c7fd0702ee6ca48fab3ea0a0a
Author: Matthew Thode <email address hidden>
Date: Wed Aug 9 09:02:00 2017 -0500

    Revert unicode parsing changes to config-template

    This reverts commits 64353d8ff0d0c2d803aba1f2af607e7ffb13c662 and
    782460644902f391cadb83e61c882956c0e569ee.

    Change-Id: I72b32ab12845be230ae8ce51befba7bf5d3d170c
    Fixes-Bug: #1705469

Changed in openstack-ansible:
assignee: Matthew Thode (prometheanfire) → nobody
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/openstack-ansible-plugins 14.2.8

This issue was fixed in the openstack/openstack-ansible-plugins 14.2.8 release.

Changed in openstack-ansible:
status: Confirmed → Fix Released
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.