Skip to content

Commit ecc15f5

Browse files
committed
Fix Rabbit upgrade script conditional evaluation
1 parent 4cd6277 commit ecc15f5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tools/rabbitmq-quorum-migration.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ fi
1313

1414
if [[ ! "$1" = "--skip-checks" ]]; then
1515
# Fail if clocks are not synced
16-
if ! kayobe overcloud host command run -l controllers -b --command "timedatectl status | grep 'synchronized: yes'"; then
16+
if ! ( kayobe overcloud host command run -l controllers -b --command "timedatectl status | grep 'synchronized: yes'" ); then
1717
echo "Failed precheck: Time not synced on controllers"
1818
echo "Use 'timedatectl status' to check sync state"
1919
echo "Either wait for sync or use 'chronyc makestep'"
2020
exit 1
2121
fi
2222
kayobe overcloud service configuration generate --node-config-dir /tmp/rabbit-migration --kolla-tags none
2323
# Fail if HA is set or quorum is not
24-
if ! grep 'om_enable_rabbitmq_quorum_queues: true' $KOLLA_CONFIG_PATH/globals.yml || grep 'om_enable_rabbitmq_high_availability: true' $KOLLA_CONFIG_PATH/globals.yml; then
24+
if ! ( grep 'om_enable_rabbitmq_quorum_queues: true' $KOLLA_CONFIG_PATH/globals.yml || grep 'om_enable_rabbitmq_high_availability: true' $KOLLA_CONFIG_PATH/globals.yml ); then
2525
echo "Failed precheck: om_enable_rabbitmq_quorum_queues must be enabled, om_enable_rabbitmq_high_availability must be disabled"
2626
exit 1
2727
fi
@@ -35,12 +35,12 @@ kayobe kolla ansible run rabbitmq-reset-state
3535
if [[ ! "$1" = "--skip-checks" ]]; then
3636
# Fail if any queues still exist
3737
sleep 20
38-
if kayobe overcloud host command run -l controllers -b --command "docker exec $RABBITMQ_CONTAINER_NAME rabbitmqctl list_queues name --silent | grep -v '^$'"; then
38+
if ( kayobe overcloud host command run -l controllers -b --command "docker exec $RABBITMQ_CONTAINER_NAME rabbitmqctl list_queues name --silent | grep -v '^$'" ); then
3939
echo "Failed check: RabbitMQ has not stopped properly, queues still exist"
4040
exit 1
4141
fi
4242
# Fail if any exchanges still exist (excluding those starting with 'amq.')
43-
if kayobe overcloud host command run -l controllers -b --command "docker exec $RABBITMQ_CONTAINER_NAME rabbitmqctl list_exchanges name --silent | grep -v '^$' | grep -v '^amq.'"; then
43+
if ( kayobe overcloud host command run -l controllers -b --command "docker exec $RABBITMQ_CONTAINER_NAME rabbitmqctl list_exchanges name --silent | grep -v '^$' | grep -v '^amq.'" ); then
4444
echo "Failed check: RabbitMQ has not stopped properly, exchanges still exist"
4545
exit 1
4646
fi
@@ -52,7 +52,7 @@ kayobe kolla ansible run deploy-containers -kt $RABBITMQ_SERVICES_TO_RESTART
5252
if [[ ! "$1" = "--skip-checks" ]]; then
5353
sleep 20
5454
# Assert that at least one quorum queue exists on each controller
55-
if kayobe overcloud host command run -l controllers -b --command "docker exec $RABBITMQ_CONTAINER_NAME rabbitmqctl list_queues type | grep quorum"; then
55+
if ( kayobe overcloud host command run -l controllers -b --command "docker exec $RABBITMQ_CONTAINER_NAME rabbitmqctl list_queues type | grep quorum" ); then
5656
echo "Queues migrated successfully"
5757
else
5858
echo "Failed post-check: A controller does not have any quorum queues"

0 commit comments

Comments
 (0)