From ccf8e71efa3f91433a3db0e369ef5bb099503150 Mon Sep 17 00:00:00 2001 From: yatinkarel Date: Wed, 30 Mar 2022 12:53:52 +0530 Subject: [PATCH] ovn migration: Fix check for stack name [1] Updated the migration script to check for config-download directory instead of stack, but missed update the Error message. check_stack function is renamed to check_source_inventory as now it only checks for source inventory instead of heat stack. If source inventory file doesn't exist the script will report Error message and exit. This is follow up of [1]. [1] https://review.opendev.org/c/openstack/neutron/+/834925 Related-Bug: #1966099 Change-Id: I2416fba50fc495da4d59a3f335f33d831ca6e91d --- .../tripleo_environment/ovn_migration.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/ovn_migration/tripleo_environment/ovn_migration.sh b/tools/ovn_migration/tripleo_environment/ovn_migration.sh index 58219b80617..2c64960b1e8 100644 --- a/tools/ovn_migration/tripleo_environment/ovn_migration.sh +++ b/tools/ovn_migration/tripleo_environment/ovn_migration.sh @@ -146,6 +146,7 @@ EOF } # Generate the inventory file for ansible migration playbook. +# It uses tripleo-ansible-inventory.yaml which was used during deployment as source inventory generate_ansible_inventory_file() { local dhcp_nodes local inventory_file="$OOO_WORKDIR/$STACK_NAME/config-download/$STACK_NAME/tripleo-ansible-inventory.yaml" @@ -224,11 +225,12 @@ EOF echo "Please review the file before running the next command - setup-mtu-t1" } -# Check if the stack exists -function check_stack { - if [ ! -d $OOO_WORKDIR/$STACK_NAME/config-download/$STACK_NAME ]; then - echo "ERROR: STACK_NAME=${STACK_NAME} does not exist. Please provide the stack name or its ID " - echo " via STACK_NAME environment variable." +# Check if source inventory exists +function check_source_inventory { + local inventory_file="$OOO_WORKDIR/$STACK_NAME/config-download/$STACK_NAME/tripleo-ansible-inventory.yaml" + if [ ! -f $inventory_file ]; then + echo "ERROR: Source Inventory File ${inventory_file} does not exist. Please provide the Stack Name and TripleO Workdir" + echo " via STACK_NAME and OOO_WORKDIR environment variables." exit 1 fi } @@ -352,7 +354,7 @@ command=$1 ret_val=0 case $command in generate-inventory) - check_stack + check_source_inventory oc_check_public_network generate_ansible_inventory_file generate_ansible_config_file