inventory overrides causing dynamic_inventory.py to stacktrace

Bug #1675810 reported by Kevin Carter
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack-Ansible
Fix Released
Medium
Jean-Philippe Evrard

Bug Description

When overriding the property "is_metal" within the user defined env.d files I've found that the inventory generator raises an error indicating it's encountered a "KeyError" when adding addresses to a given container.

``` traceback
Traceback (most recent call last):
  File "./inventory/dynamic_inventory.py", line 78, in <module>
    output = generate.main(**all_args)
  File "/opt/openstack-ansible/playbooks/inventory/../../lib/generate.py", line 1100, in main
    user_defined_config
  File "/opt/openstack-ansible/playbooks/inventory/../../lib/generate.py", line 730, in container_skel_load
    static_routes=p_net.get('static_routes')
  File "/opt/openstack-ansible/playbooks/inventory/../../lib/generate.py", line 572, in _add_additional_networks
    static_routes
  File "/opt/openstack-ansible/playbooks/inventory/../../lib/generate.py", line 572, in _add_additional_networks
    static_routes
  File "/opt/openstack-ansible/playbooks/inventory/../../lib/generate.py", line 638, in _add_additional_networks
    phg = user_config[cphg][container_host]
KeyError: u'aio1_nova_scheduler_container-e973eb06'
```

This is an example env.d file defined as nova.yml within the /etc/openstack_deploy/env.d directory

``` yaml
container_skel:
  nova_api_metadata_container:
    properties:
      is_metal: true

  nova_api_os_compute_container:
    properties:
      is_metal: true

  nova_api_placement_container:
    properties:
      is_metal: true

  nova_compute_container:
    properties:
      is_metal: true

  nova_conductor_container:
    properties:
      is_metal: true

  nova_scheduler_container:
    properties:
      is_metal: true

  nova_console_container:
    properties:
      is_metal: true
```

The debug log for the inventory generation process can be found here: http://cdn.pasteraw.com/ct5gwf0vv7nlpkppwvrwv6rwoc8kwuf

----

The desired outcome would be to have the inventory generator allow me to flip the bit on the "is_metal" property leaving the existing containers untouched. This would allow a deployer to change the deployment strategy within a given release without having to first destroy the existing containers and remove their entries from inventory.

Changed in openstack-ansible:
status: New → Confirmed
assignee: nobody → Kevin Carter (kevin-carter)
Changed in openstack-ansible:
status: Confirmed → In Progress
Changed in openstack-ansible:
assignee: Kevin Carter (kevin-carter) → Jean-Philippe Evrard (jean-philippe-evrard)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to openstack-ansible (master)

Reviewed: https://review.openstack.org/531123
Committed: https://git.openstack.org/cgit/openstack/openstack-ansible/commit/?id=81e1f8d173d663e5f7f6a385e89359c3e9d75a54
Submitter: Zuul
Branch: master

commit 81e1f8d173d663e5f7f6a385e89359c3e9d75a54
Author: Jean-Philippe Evrard <email address hidden>
Date: Thu Jan 4 10:43:26 2018 +0000

    Include P-Q changes into the upgrade script

    We need to include changes in the upgrade script to handle
    the changes done during the Queens timeframe:

    - Inventory is fixed to prevent a stacktrace if a container
      default was moved from is_metal: False to is_metal: True,
      and now respects existing container properties.
    - Ensuring previous inventory location isn't overriding the
      Queens inventory location in memory, by unsetting
      ANSIBLE_INVENTORY.
    - Ensuring all containers are using the repo that was build
      during the upgrade.

    Change-Id: I0fd3a8803bf345ccad07dc97968e104cd0a7bf70
    Partial-Bug: #1741462
    Closes-Bug: #1675810

Changed in openstack-ansible:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/openstack-ansible 17.0.0.0b3

This issue was fixed in the openstack/openstack-ansible 17.0.0.0b3 development milestone.

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.