9ceca92d20
Sometimes, CLI may return error earlier than grep catches up its query results. With bash pipefail set, this ends up with grep --yes omitted and the wrong command executed (without --yes). Set pipefail only after the --yes argument evaluated by grep. Change-Id: I22a998e0cf3b04ef51a51478fc6576324a931dcb Co-Authored-By: Sergii Golovatouk <sgolovat@redhat.com> Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
140 lines
3.8 KiB
Django/Jinja
140 lines
3.8 KiB
Django/Jinja
#!/bin/env bash
|
|
#
|
|
# Run major upgrade on overcloud nodes
|
|
#
|
|
set -euo pipefail
|
|
|
|
{% if overcloud_upgrade_multibooks|bool %}
|
|
|
|
{%- for playbook in overcloud_upgrade_playbooks -%}
|
|
|
|
{% if l3_agent_connectivity_check|bool %}
|
|
if [[ -e {{ working_dir }}/l3_agent_start_ping.sh ]]; then
|
|
source {{ overcloud_rc }}
|
|
bash {{ working_dir }}/l3_agent_start_ping.sh
|
|
fi
|
|
{% endif %}
|
|
|
|
{% if l3_agent_failover_check|bool %}
|
|
if [[ -e {{ working_dir }}/l3_agent_failover_pre.sh ]]; then
|
|
source {{ overcloud_rc }}
|
|
bash {{ working_dir }}/l3_agent_failover_pre.sh
|
|
fi
|
|
{% endif %}
|
|
|
|
{% if fip_http_check|bool %}
|
|
source {{ overcloud_rc }}
|
|
kill -9 $( lsof -t {{ working_dir }}/fip_http_check_start.sh ) || :
|
|
bash {{ working_dir }}/fip_http_check_start.sh &
|
|
{% endif %}
|
|
|
|
source {{ undercloud_rc }}
|
|
|
|
set +o pipefail
|
|
RUN_ANSWER=""
|
|
if openstack overcloud upgrade run --help | grep -qe "--yes"; then
|
|
RUN_ANSWER="--yes"
|
|
fi
|
|
set -o pipefail
|
|
|
|
echo "[$(date)] Running major upgrade {{ playbook }} playbook for {{ item }} role"
|
|
openstack overcloud upgrade run ${RUN_ANSWER} \
|
|
--stack {{ overcloud_stack_name }} \
|
|
{% if tripleo_upgrade_debug|bool -%}
|
|
--debug \
|
|
{% endif -%}
|
|
--limit {{ item }} --playbook {{ playbook }} 2>&1
|
|
|
|
echo "[$(date)] Finished major upgrade {{ playbook }} playbook for {{ item }} role"
|
|
|
|
{%- endfor %}
|
|
{# validation scripts should run after all playbooks are finished #}
|
|
{% if l3_agent_connectivity_check|bool %}
|
|
if [[ -e {{ working_dir }}/l3_agent_stop_ping.sh ]]; then
|
|
source {{ overcloud_rc }}
|
|
bash {{ working_dir }}/l3_agent_stop_ping.sh
|
|
fi
|
|
{% endif %}
|
|
|
|
{% if l3_agent_failover_check|bool %}
|
|
if [[ -e {{ working_dir }}/l3_agent_failover_post.sh ]]; then
|
|
source {{ overcloud_rc }}
|
|
bash {{ working_dir }}/l3_agent_failover_post.sh
|
|
fi
|
|
{% endif %}
|
|
|
|
{% if fip_http_check|bool %}
|
|
source {{ overcloud_rc }}
|
|
kill -9 $( lsof -t {{ working_dir }}/fip_http_check_start.sh )
|
|
bash {{ working_dir }}/fip_http_check_stop.sh
|
|
{% endif %}
|
|
|
|
{% if launch_sanity_workload|bool %}
|
|
bash {{ working_dir }}/workload_launch.sh 'sanity'
|
|
{% endif %}
|
|
{# finished overcloud_upgrade_multibooks section #}
|
|
{% else %}
|
|
|
|
{% if l3_agent_connectivity_check|bool %}
|
|
if [[ -e {{ working_dir }}/l3_agent_start_ping.sh ]]; then
|
|
source {{ overcloud_rc }}
|
|
bash {{ working_dir }}/l3_agent_start_ping.sh
|
|
fi
|
|
{% endif %}
|
|
|
|
{% if l3_agent_failover_check|bool %}
|
|
if [[ -e {{ working_dir }}/l3_agent_failover_pre.sh ]]; then
|
|
source {{ overcloud_rc }}
|
|
bash {{ working_dir }}/l3_agent_failover_pre.sh
|
|
fi
|
|
{% endif %}
|
|
|
|
{% if fip_http_check|bool %}
|
|
source {{ overcloud_rc }}
|
|
kill -9 $( lsof -t {{ working_dir }}/fip_http_check_start.sh ) || :
|
|
bash {{ working_dir }}/fip_http_check_start.sh &
|
|
{% endif %}
|
|
|
|
source {{ undercloud_rc }}
|
|
|
|
set +o pipefail
|
|
RUN_ANSWER=""
|
|
if openstack overcloud upgrade run --help | grep -qe "--yes"; then
|
|
RUN_ANSWER="--yes"
|
|
fi
|
|
set -o pipefail
|
|
|
|
echo "[$(date)] Running major upgrade for {{ item }} role"
|
|
openstack overcloud upgrade run ${RUN_ANSWER} \
|
|
--stack {{ overcloud_stack_name }} \
|
|
{% if tripleo_upgrade_debug|bool %}
|
|
--debug \
|
|
{% endif -%}
|
|
--limit {{ item }} --playbook all 2>&1
|
|
|
|
echo "[$(date)] Finished major upgrade for {{ item }} role"
|
|
|
|
{% if l3_agent_connectivity_check|bool %}
|
|
if [[ -e {{ working_dir }}/l3_agent_stop_ping.sh ]]; then
|
|
source {{ overcloud_rc }}
|
|
bash {{ working_dir }}/l3_agent_stop_ping.sh
|
|
fi
|
|
{% endif %}
|
|
|
|
{% if l3_agent_failover_check|bool %}
|
|
if [[ -e {{ working_dir }}/l3_agent_failover_post.sh ]]; then
|
|
source {{ overcloud_rc }}
|
|
bash {{ working_dir }}/l3_agent_failover_post.sh
|
|
fi
|
|
{% endif %}
|
|
|
|
{% if fip_http_check|bool %}
|
|
source {{ overcloud_rc }}
|
|
kill -9 $( lsof -t {{ working_dir }}/fip_http_check_start.sh )
|
|
bash {{ working_dir }}/fip_http_check_stop.sh
|
|
{% endif %}
|
|
{% if launch_sanity_workload|bool %}
|
|
bash {{ working_dir }}/workload_launch.sh 'sanity'
|
|
{% endif %}
|
|
{% endif %}
|