Bug 1535442

Summary: OSP10 -> OSP13 FFU upgrade: upgrade_steps_playbook.yaml fails: The error was: error while evaluating conditional ((httpd_enabled.rc == 0) and (httpd_running.rc == 0) and (step|int == 2)): 'httpd_enabled' is undefined
Product: Red Hat OpenStack Reporter: Marius Cornea <mcornea>
Component: openstack-tripleo-commonAssignee: Ryan Brady <rbrady>
Status: CLOSED ERRATA QA Contact: Alexander Chuzhoy <sasha>
Severity: urgent Docs Contact:
Priority: high    
Version: 13.0 (Queens)CC: dbecker, jfrancoa, jschluet, mandreou, mbracho, mbultel, mburns, morazi, rhel-osp-director-maint, rhos-flags, sclewis, slinaber
Target Milestone: betaKeywords: Triaged
Target Release: 13.0 (Queens)   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openstack-tripleo-common-8.4.1-0.20180224032817.d51ed49.el7ost Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-27 13:42:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Marius Cornea 2018-01-17 12:03:01 UTC
Description of problem:

OSP10 -> OSP13 FFU upgrade: upgrade_steps_playbook.yaml fails: The error was: error while evaluating conditional ((httpd_enabled.rc == 0) and (httpd_running.rc == 0) and (step|int == 2)): 'httpd_enabled' is undefined

The problems is caused by the upgrade tasks with 'common' tags are rendered _after_ the tasks which use conditions including variables registered by the 'common' tasks.

In this particular case the failure shows:

TASK [Stop and disable aodh service (running under httpd)] ************************************************************************************************************************************************************************************
fatal: [192.168.24.9]: FAILED! => {"failed": true, "msg": "The conditional check '(httpd_enabled.rc == 0) and (httpd_running.rc == 0) and (step|int == 2)' failed. The error was: error while evaluating conditional ((httpd_enabled.rc == 0) and (httpd_running.rc == 0) and (step|int == 2)): 'httpd_enabled' is undefined\n\nThe error appears to have been in '/home/stack/tripleo-40rIhX-config/Controller/upgrade_tasks.yaml': line 1, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Stop and disable aodh service (running under httpd)\n ^ here\n"}

We can see the content of the playbook here: http://paste.openstack.org/show/646497/

The first task( Stop and disable aodh service (running under httpd)) has the following condition:
when: (httpd_enabled.rc == 0) and (httpd_running.rc == 0) and (step|int == 2)

Nor httpd_enabled or are httpd_running defined at this point. They are defined at line 496 and line 501 respectively.

We need to run the tasks with 'common' tags before the reset of the tasks so the vars registered in 'common' tasks are available.

Comment 2 Marios Andreou 2018-01-23 16:57:54 UTC
o/ took this one for triage during the call yesterday. I think the change at https://review.openstack.org/#/c/529369/ is relevant **. From yesterday the output looks like (while it lasts) http://paste.openstack.org/raw/650076/ - scroll to bottom for example sorted_tasks. 

Tasks without a 'when' (like the common ones) come first, then ordering is on the step value.

I will mark as triaged and attach that review for now thanks.

** there is another ordering issue, being addressed by https://review.openstack.org/#/c/536851/ but going on comment #0 here I think /#/c/529369/ is more relevant in this case.

Comment 11 errata-xmlrpc 2018-06-27 13:42:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:2086