FFU upgrade issue with the release loop var.

We get those warnings because of the name variable collusion[1]
    primary | TASK [tripleo-upgrade : create fast forward upgrade scripts] *******************
    primary | Thursday 01 March 2018  18:30:47 +0000 (0:00:05.084)       0:05:11.729 ********
    primary |  [WARNING]: The loop variable 'release' is already in use. You should set the
    primary | `loop_var` value in the `loop_control` option for the task to something else to
    primary | avoid variable collisions and unexpected behavior.
    primary | included: /home/zuul/workspace/.quickstart/usr/local/share/ansible/roles/tripleo-upgrade/tasks/fast-forward-upgrade/create-ffu-scripts.yaml for undercloud
    primary | included: /home/zuul/workspace/.quickstart/usr/local/share/ansible/roles/tripleo-upgrade/tasks/fast-forward-upgrade/create-ffu-scripts.yaml for undercloud
    primary | included: /home/zuul/workspace/.quickstart/usr/local/share/ansible/roles/tripleo-upgrade/tasks/fast-forward-upgrade/create-ffu-scripts.yaml for undercloud

which lead to

    tripleo-upgrade : create master undercloud upgrade script

repeated 3 times instead of ocata/pike/queens because release is used
by quickstart and is set in this job to master, ie the local loop
values are overridden.

Bottom line is that we can't use release as a loop variable at all in
tripleo-upgrade as it will be overwritten by oooq.

[1] http://logs.openstack.org/70/546670/20/experimental/tripleo-ci-centos-7-scenario001-multinode-ffu-upgrade/9d5c123/job-output.txt.gz#_2018-03-01_18_30_47_403272
[2] http://logs.openstack.org/70/546670/20/experimental/tripleo-ci-centos-7-scenario001-multinode-ffu-upgrade/9d5c123/job-output.txt.gz#_2018-03-01_18_30_50_060695

Change-Id: I4b9d6f627b230f9a453b273e5fa543fa68adb990
This commit is contained in:
Sofer Athlan-Guyot 2018-03-07 14:59:04 +01:00 committed by Marius Cornea
parent 688679d602
commit 29aa28128d
6 changed files with 25 additions and 24 deletions

View File

@ -1,21 +1,21 @@
- name: create {{ release }} undercloud upgrade script
- name: create {{ current_release }} undercloud upgrade script
template:
src: templates/fast-forward-upgrade/undercloud_upgrade.sh.j2
dest: "{{ working_dir }}/undercloud_upgrade_{{ release }}.sh"
dest: "{{ working_dir }}/undercloud_upgrade_{{ current_release }}.sh"
mode: 0775
vars:
cmd_args: "{{ ffu_undercloud_repo_args['tripleo_repos'][release]|default('') }}"
cmd_args: "{{ ffu_undercloud_repo_args['tripleo_repos'][current_release]|default('') }}"
- name: create {{ release }} pre undercloud upgrade workaround script
- name: create {{ current_release }} pre undercloud upgrade workaround script
template:
src: fast-forward-upgrade/undercloud_workarounds_pre.sh.j2
dest: "{{ working_dir }}/pre_undercloud_upgrade_{{ release }}_workarounds.sh"
dest: "{{ working_dir }}/pre_undercloud_upgrade_{{ current_release }}_workarounds.sh"
mode: 0775
when: ffu_upgrade_workarounds
- name: create {{ release }} post undercloud upgrade workaround script
- name: create {{ current_release }} post undercloud upgrade workaround script
template:
src: fast-forward-upgrade/undercloud_workarounds_post.sh.j2
dest: "{{ working_dir }}/post_undercloud_upgrade_{{ release }}_workarounds.sh"
dest: "{{ working_dir }}/post_undercloud_upgrade_{{ current_release }}_workarounds.sh"
mode: 0775
when: ffu_upgrade_workarounds

View File

@ -6,7 +6,7 @@
include: create-ffu-scripts.yaml
tags: create_ffu_scripts
loop_control:
loop_var: release
loop_var: current_release
with_items: "{{ ffu_undercloud_releases }}"
when: ffu_noop|bool or ffu_undercloud_upgrade|bool or ffu_overcloud_upgrade|bool
@ -14,7 +14,7 @@
- name: ffu undercloud upgrade
include: undercloud-upgrade.yml
loop_control:
loop_var: release
loop_var: current_release
with_items: "{{ ffu_undercloud_releases }}"
- name: apply post ffu undercloud upgrade workarounds

View File

@ -1,5 +1,5 @@
- name: Run pre undercloud {{ release }} upgrade workarounds
command: "{{ working_dir }}/pre_undercloud_upgrade_{{ release }}_workarounds.sh"
- name: Run pre undercloud {{ current_release }} upgrade workarounds
command: "{{ working_dir }}/pre_undercloud_upgrade_{{ current_release }}_workarounds.sh"
when: ffu_upgrade_workarounds
- include_role:
@ -10,13 +10,14 @@
mirror: "{{ install.mirror | default(omit) }}"
rr_distro_version: "{{ install.osrelease|default(omit) }}"
rhos_release_rpm: "https://url.corp.redhat.com/rhos-release-latest-rpm"
release: "{{ current_release }}"
become: true
become_user: root
when: ffu_undercloud_repo_type == 'rhos-release'
- name: Upgrade undercloud to {{ release }}
command: "{{ working_dir }}/undercloud_upgrade_{{ release }}.sh"
- name: Upgrade undercloud to {{ current_release }}
command: "{{ working_dir }}/undercloud_upgrade_{{ current_release }}.sh"
- name: Run post undercloud {{ release }} upgrade workarounds
command: "{{ working_dir }}/post_undercloud_upgrade_{{ release }}_workarounds.sh"
command: "{{ working_dir }}/post_undercloud_upgrade_{{ current_release }}_workarounds.sh"
when: ffu_upgrade_workarounds

View File

@ -10,7 +10,7 @@ sudo yum localinstall -y https://trunk.rdoproject.org/centos7/current/${TRIPLEO_
sudo tripleo-repos {{ cmd_args }} ceph
{% endif %}
{% if release == 'ocata' or release == '11' %}
{% if current_release == 'ocata' or current_release == '11' %}
sudo systemctl stop openstack-* neutron-* httpd
sudo yum update -y instack-undercloud openstack-puppet-modules openstack-tripleo-common python-tripleoclient
{% else %}
@ -18,4 +18,4 @@ sudo yum -y install ceph-ansible
sudo yum -y update python-tripleoclient
{% endif %}
openstack undercloud upgrade &> {{ working_dir }}/undercloud_upgrade_{{ release }}.log
openstack undercloud upgrade &> {{ working_dir }}/undercloud_upgrade_{{ current_release }}.log

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
# Apply post undercloud {{ release }} upgrade workarounds
# Apply post undercloud {{ current_release }} upgrade workarounds
set -euo pipefail
function apply_patch {
@ -18,7 +18,7 @@ function apply_patch {
fi
}
{% if release in ffu_undercloud_releases[0] %}
{% if current_release in ffu_undercloud_releases[0] %}
{% for bugs in post_ffu_undercloud_upgrade_1st_release|default([]) %}
{% for key, value in bugs.items() %}
echo {{ key }}
@ -32,7 +32,7 @@ apply_patch {{ value.basedir }} {{ value.id }}
{% endfor %}
{% endfor %}
{% elif release in ffu_undercloud_releases[1] %}
{% elif current_release in ffu_undercloud_releases[1] %}
{% for bugs in post_ffu_undercloud_upgrade_2nd_release|default([]) %}
{% for key, value in bugs.items() %}
echo {{ key }}
@ -46,7 +46,7 @@ apply_patch {{ value.basedir }} {{ value.id }}
{% endfor %}
{% endfor %}
{% elif release in ffu_undercloud_releases[2] %}
{% elif current_release in ffu_undercloud_releases[2] %}
{% for bugs in post_ffu_undercloud_upgrade_3rd_release|default([]) %}
{% for key, value in bugs.items() %}
echo {{ key }}

View File

@ -1,6 +1,6 @@
#!/bin/bash
#
# Apply pre undercloud {{ release }} upgrade workarounds
# Apply pre undercloud {{ current_release }} upgrade workarounds
set -euo pipefail
function apply_patch {
@ -18,7 +18,7 @@ function apply_patch {
fi
}
{% if release in ffu_undercloud_releases[0] %}
{% if current_release in ffu_undercloud_releases[0] %}
{% for bugs in pre_ffu_undercloud_upgrade_1st_release|default([]) %}
{% for key, value in bugs.items() %}
echo {{ key }}
@ -32,7 +32,7 @@ apply_patch {{ value.basedir }} {{ value.id }}
{% endfor %}
{% endfor %}
{% elif release in ffu_undercloud_releases[1] %}
{% elif current_release in ffu_undercloud_releases[1] %}
{% for bugs in pre_ffu_undercloud_upgrade_2nd_release|default([]) %}
{% for key, value in bugs.items() %}
echo {{ key }}
@ -46,7 +46,7 @@ apply_patch {{ value.basedir }} {{ value.id }}
{% endfor %}
{% endfor %}
{% elif release in ffu_undercloud_releases[2] %}
{% elif current_release in ffu_undercloud_releases[2] %}
{% for bugs in pre_ffu_undercloud_upgrade_3rd_release|default([]) %}
{% for key, value in bugs.items() %}
echo {{ key }}