tripleo-packages upgrade_task conditional ordering leads to error

Bug #1732888 reported by Lee Yarwood on 2017-11-17
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
tripleo
High
Lee Yarwood

Bug Description

Description
===========

The following error is seen when attempting to run the major upgrade playbook after downloading it via `openstack overcloud config download`:

$ ansible-playbook -i /usr/bin/tripleo-ansible-inventory $config_path/upgrade-playbook.yaml
[..]
TASK [Upgrade os-net-config] *****************************************************************************************************************************************************************************************************************
fatal: [192.168.24.15]: FAILED! => {"failed": true, "msg": "The conditional check 'not os_net_config_need_upgrade.stdout and os_net_config_has_config.rc == 0' failed. The error was: error while evaluating conditional (not os_net_config_need_upgrade.stdout and os_net_config_has_config.rc == 0): 'dict object' has no attribute 'stdout'\n\nThe error appears to have been in '/home/stack/tripleo-1KXpHF-config/Controller/upgrade_tasks.yaml': line 241, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n- block:\n - name: Upgrade os-net-config\n ^ here\n"}

This is due to the following block task attempting to check the value of os_net_config_need_upgrade.stdout before it has been set in a previous step:

- block:
  - name: Upgrade os-net-config
    yum: name=os-net-config state=latest
  - changed_when: os_net_config_upgrade.rc == 2
    command: os-net-config --no-activate -c /etc/os-net-config/config.json -v --detailed-exit-codes
    failed_when: os_net_config_upgrade.rc not in [0,2]
    name: take new os-net-config parameters into account now
    register: os_net_config_upgrade
  tags: step3
  when:
  - not os_net_config_need_upgrade.stdout and os_net_config_has_config.rc == 0
  - step|int == 3

This tasks comes from puppet/services/tripleo-packages.yaml [1] with the step conditional dynamically added during the config download by tripleo-common [2].

The step conditional should always come first for these upgrade_tasks.

[1] https://github.com/openstack/tripleo-heat-templates/blob/49341d6a9a15b519456ce72cbcae47a01302c847/puppet/services/tripleo-packages.yaml#L66-L75
[2] https://github.com/openstack/tripleo-common/blob/a8caa24f1b84af1ae2fde7946e543b23175c7343/tripleo_common/utils/config.py#L141

Steps to reproduce
==================

$ openstack overcloud config download
$ ansible-playbook -i /usr/bin/tripleo-ansible-inventory $config_path/upgrade-playbook.yaml

Expected result
===============

Upgrade tasks are completed.

Actual result
=============

Upgrade tasks bail out with the above error.

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

Changed in tripleo:
assignee: nobody → Lee Yarwood (lyarwood)
status: New → In Progress
Changed in tripleo:
milestone: none → queens-2
importance: Undecided → High

Reviewed: https://review.openstack.org/521060
Committed: https://git.openstack.org/cgit/openstack/tripleo-common/commit/?id=78a5bc0554f7571bce9794618e3c653c109a90b1
Submitter: Zuul
Branch: master

commit 78a5bc0554f7571bce9794618e3c653c109a90b1
Author: Lee Yarwood <email address hidden>
Date: Fri Nov 17 10:48:48 2017 +0000

    config: Always add step conditional first for upgrade_tasks

    This is required to ensure conditionals using variables set by prior
    steps are not evaluated prior to these steps running.

    Closes-bug: #1732888
    Change-Id: I9f6d60f22ef4c057a0d5f47ac2bd4f08520faeec

Changed in tripleo:
status: In Progress → Fix Released

Reviewed: https://review.openstack.org/522831
Committed: https://git.openstack.org/cgit/openstack/tripleo-common/commit/?id=1b8af1e043e7f7181fcfa4784584d36b72785b8a
Submitter: Zuul
Branch: stable/pike

commit 1b8af1e043e7f7181fcfa4784584d36b72785b8a
Author: Lee Yarwood <email address hidden>
Date: Fri Nov 17 10:48:48 2017 +0000

    config: Always add step conditional first for upgrade_tasks

    This is required to ensure conditionals using variables set by prior
    steps are not evaluated prior to these steps running.

    Closes-bug: #1732888
    Change-Id: I9f6d60f22ef4c057a0d5f47ac2bd4f08520faeec
    (cherry picked from commit 78a5bc0554f7571bce9794618e3c653c109a90b1)

tags: added: in-stable-pike

This issue was fixed in the openstack/tripleo-common 8.2.0 release.

This issue was fixed in the openstack/tripleo-common 7.6.6 release.

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

Other bug subscribers