tripleo-upgrade to_inventory_rolemap filter fails on KeyError: 'qe-Cloud-0_excluded_overcloud'

Bug #1994081 reported by Sofer Athlan-Guyot
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
Fix Released
High
Daniel Bengtsson

Bug Description

Hi,

while trying to review https://review.opendev.org/c/openstack/tripleo-common/+/859403 which is a backport from wallaby we get an error:

TASK [tripleo-upgrade : set inventory facts] ***********************************
Thursday 13 October 2022 12:32:49 +0000 (0:00:01.946) 0:01:24.815 ******
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: 'overcloud_excluded_overcloud'
fatal: [undercloud]: FAILED! => {"changed": false}
in https://zuul.opendev.org/t/openstack/build/3f0c74473e5e4da7b028cdc750ceabca

The associated task is

- name: set inventory facts
  set_fact:
    inventory_rolemap: "{{ upgrade_tripleo_inventory.content | b64decode | to_inventory_rolemap }}"
    inventory_hostmap: "{{ upgrade_tripleo_inventory.content | b64decode | to_inventory_hostmap }}"
    inventory_roles: "{{ upgrade_tripleo_inventory.content | b64decode | to_inventory_roles }}"

from https://opendev.org/openstack/tripleo-upgrade/src/branch/stable/train/tasks/common/load_roles_from_inventory.yaml#L15-L19

The error comes from to_inventory_rolemap.

By adding:

@@ -42,9 +42,11 @@ def to_inventory_hostmap(data):
                         break
                 else:
                     group_host_map[group] = []
- for child in inventory[group]['children']:
- group_host_map[group] += group_host_map[child]
- group_host_map[group].sort()
+ # take into account the case for excluded overcloud
+ if child in group_role_map:
+ for child in inventory[group]['children']:
+ group_host_map[group] += group_host_map[child]
+ group_host_map[group].sort()
     return group_host_map

in https://opendev.org/openstack/tripleo-upgrade/src/branch/stable/train/filter_plugins/tripleo_upgrade.py#L51

the error goes away.

But why the exclude group doesn't make any failure for wallaby and master is still to be found.

@damani42 as you worked on this could you have a look ?

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-upgrade (stable/train)

Fix proposed to branch: stable/train
Review: https://review.opendev.org/c/openstack/tripleo-upgrade/+/862541

Revision history for this message
Mikolaj Ciecierski (mciecierski) wrote :

Hi,

Most probably the exclude group doesn't make any failure for wallaby and master, because of the fact that master and wallaby doesn't use triple-ansible-inventory from tripleo-validations[1] anymore.

From wallaby onwards tripleo-upgrade uses inventory located under overcloud-deploy/<stack> [2][3]

[1]https://github.com/openstack/tripleo-validations/blob/stable/train/scripts/tripleo-ansible-inventory
[2]https://github.com/openstack/tripleo-upgrade/blob/master/tasks/common/load_roles_from_inventory.yaml#L2
[3]https://github.com/openstack/tripleo-upgrade/blob/master/defaults/main.yml#L61

I will investigate more and let you know what needs to be fixed for train.

Changed in tripleo:
status: Triaged → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-upgrade (master)

Reviewed: https://review.opendev.org/c/openstack/tripleo-upgrade/+/862101
Committed: https://opendev.org/openstack/tripleo-upgrade/commit/2eea005773a5d9b2a32c88e1427d839788d00dd6
Submitter: "Zuul (22348)"
Branch: master

commit 2eea005773a5d9b2a32c88e1427d839788d00dd6
Author: Oliver Walsh <email address hidden>
Date: Thu Oct 20 12:46:35 2022 +0100

    Create entry for empty groups in inventory_rolemap

    When a group is a child of another group then the child groups role mappings
    are added to the parent group role mappings. This which fails with a
    KeyError when the child is an empty group as no mapping is created.

    Closes-bug: #1994081
    Related: rhbz#2089512
    Change-Id: I05f4989b0f14d56d3c33f91b3cccb85b729987cb

Changed in tripleo:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-upgrade (stable/wallaby)

Reviewed: https://review.opendev.org/c/openstack/tripleo-upgrade/+/862144
Committed: https://opendev.org/openstack/tripleo-upgrade/commit/73ec7f09f4e35f1906f6fd5632aaaada72552284
Submitter: "Zuul (22348)"
Branch: stable/wallaby

commit 73ec7f09f4e35f1906f6fd5632aaaada72552284
Author: Oliver Walsh <email address hidden>
Date: Thu Oct 20 12:46:35 2022 +0100

    Create entry for empty groups in inventory_rolemap

    When a group is a child of another group then the child groups role mappings
    are added to the parent group role mappings. This which fails with a
    KeyError when the child is an empty group as no mapping is created.

    Conflicts:
            filter_plugins/tripleo_upgrade.py

    Closes-bug: #1994081
    Related: rhbz#2089512
    Change-Id: I05f4989b0f14d56d3c33f91b3cccb85b729987cb
    (cherry picked from commit 2eea005773a5d9b2a32c88e1427d839788d00dd6)

tags: added: in-stable-wallaby
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to tripleo-upgrade (stable/train)

Fix proposed to branch: stable/train
Review: https://review.opendev.org/c/openstack/tripleo-upgrade/+/865243

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to tripleo-upgrade (stable/train)

Reviewed: https://review.opendev.org/c/openstack/tripleo-upgrade/+/865243
Committed: https://opendev.org/openstack/tripleo-upgrade/commit/c04b8e8b006925d8bece0a7dbfa5edd537fba758
Submitter: "Zuul (22348)"
Branch: stable/train

commit c04b8e8b006925d8bece0a7dbfa5edd537fba758
Author: Oliver Walsh <email address hidden>
Date: Thu Oct 20 12:46:35 2022 +0100

    Create entry for empty groups in inventory_rolemap

    When a group is a child of another group then the child groups role mappings
    are added to the parent group role mappings. This which fails with a
    KeyError when the child is an empty group as no mapping is created.

    Conflicts:
            filter_plugins/tripleo_upgrade.py

    Closes-bug: #1994081
    Related: rhbz#2089512
    Change-Id: I05f4989b0f14d56d3c33f91b3cccb85b729987cb
    (cherry picked from commit 2eea005773a5d9b2a32c88e1427d839788d00dd6)
    (cherry picked from commit 73ec7f09f4e35f1906f6fd5632aaaada72552284)

tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to tripleo-ansible (stable/train)

Related fix proposed to branch: stable/train
Review: https://review.opendev.org/c/openstack/tripleo-ansible/+/865977

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on tripleo-ansible (stable/train)

Change abandoned by "Sofer Athlan-Guyot <email address hidden>" on branch: stable/train
Review: https://review.opendev.org/c/openstack/tripleo-ansible/+/865977
Reason: https://review.opendev.org/c/openstack/tripleo-ansible/+/866010

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on tripleo-upgrade (stable/train)

Change abandoned by "Sofer Athlan-Guyot <email address hidden>" on branch: stable/train
Review: https://review.opendev.org/c/openstack/tripleo-upgrade/+/862541

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.