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>
25 lines
740 B
Django/Jinja
25 lines
740 B
Django/Jinja
#!/bin/env bash
|
|
#
|
|
# Run online data migration for OpenStack services
|
|
#
|
|
{% if overcloud_update|bool or update_noop|bool -%}
|
|
{% set operation_type = 'update' -%}
|
|
{% elif overcloud_upgrade|bool or upgrade_noop|bool or ffu_overcloud_upgrade|bool or ffu_noop|bool -%}
|
|
{% set operation_type = 'upgrade' -%}
|
|
{% endif -%}
|
|
set -eu
|
|
|
|
source {{ undercloud_rc }}
|
|
|
|
EXTERNAL_ANSWER=""
|
|
if openstack overcloud external-{{ operation_type }} run --help | grep -qe "--yes"; then
|
|
EXTERNAL_ANSWER="--yes"
|
|
fi
|
|
set -o pipefail
|
|
|
|
echo "[$(date)] Run online data migration for overcloud during {{ operation_type }}"
|
|
|
|
openstack overcloud external-{{ operation_type }} run ${EXTERNAL_ANSWER} \
|
|
--stack {{ overcloud_stack_name }} \
|
|
--tags online_upgrade 2>&1
|