From 09019f1ffa8590c3d5ab6a9a779d9d11e2ec6e79 Mon Sep 17 00:00:00 2001 From: "Vincent S. Cojot" Date: Wed, 6 Oct 2021 19:14:32 -0400 Subject: [PATCH] Enhanced set of warnings if an answers file or a templates directory is used. Change-Id: I66074cab1692c7a9ad520148a3c7898a91589c7e --- .../tripleo_environment/ovn_migration.sh | 44 +++++++++++++------ 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/tools/ovn_migration/tripleo_environment/ovn_migration.sh b/tools/ovn_migration/tripleo_environment/ovn_migration.sh index 0d9ce66ed35..416696c4048 100644 --- a/tools/ovn_migration/tripleo_environment/ovn_migration.sh +++ b/tools/ovn_migration/tripleo_environment/ovn_migration.sh @@ -53,27 +53,45 @@ check_for_necessary_files() { if [ ! -e $OVERCLOUD_OVN_DEPLOY_SCRIPT ]; then echo "overcloud deploy migration script :" \ "$OVERCLOUD_OVN_DEPLOY_SCRIPT is not present. Please" \ - "make sure you generate that file before running this" + "make sure you create that file before running this script." exit 1 fi - cat $OVERCLOUD_OVN_DEPLOY_SCRIPT | grep neutron-ovn >/dev/null - if [ "$?" == "1" ]; then - echo "OVN t-h-t environment file seems to be missing in \ -$OVERCLOUD_OVN_DEPLOY_SCRIPT. Please check the $OVERCLOUD_OVN_DEPLOY_SCRIPT \ -file again." - exit 1 + grep -q -- '--answers-file' $OVERCLOUD_OVN_DEPLOY_SCRIPT || grep -q -- '--environment-directory' $OVERCLOUD_OVN_DEPLOY_SCRIPT + answers_templates_check=$? + + grep -q -- 'neutron-ovn' $OVERCLOUD_OVN_DEPLOY_SCRIPT + if [[ $? -eq 1 ]]; then + if [[ $answers_templates_check -eq 0 ]]; then + echo -e "\nWARNING!!! You are using an answers-file or a templates directory" \ + " ( --answers-file/--environment-directory) " \ + "\nYou MUST make sure the proper OVN files are included in the templates called by your deploy script" + else + echo -e "OVN t-h-t environment file(s) seems to be missing in " \ + "$OVERCLOUD_OVN_DEPLOY_SCRIPT. Please check the $OVERCLOUD_OVN_DEPLOY_SCRIPT" \ + "file again." + exit 1 + fi fi - cat $OVERCLOUD_OVN_DEPLOY_SCRIPT | grep \$HOME/ovn-extras.yaml >/dev/null + grep -q \$HOME/ovn-extras.yaml $OVERCLOUD_OVN_DEPLOY_SCRIPT check1=$? - cat $OVERCLOUD_OVN_DEPLOY_SCRIPT | grep $HOME/ovn-extras.yaml >/dev/null + grep -q $HOME/ovn-extras.yaml $OVERCLOUD_OVN_DEPLOY_SCRIPT check2=$? - if [[ "$check1" == "1" && "$check2" == "1" ]]; then - echo "ovn-extras.yaml file is missing in "\ - "$OVERCLOUD_OVN_DEPLOY_SCRIPT. Please add it "\ - "as \" -e \$HOME/ovn-extras.yaml\"" + if [[ $check1 -eq 1 && $check2 -eq 1 ]]; then + # specific case of --answers-file/--environment-directory + if [[ $answers_templates_check -eq 0 ]]; then + echo -e "\nWARNING!!! You are using an answers-file or a templates directory" \ + " ( --answers-file/--environment-directory) " \ + "\nYou MUST add ovn-extras.yaml to your new set of templates for OVN-based deploys." \ + "\n e.g: add \" -e \$HOME/ovn-extras.yaml \" to the deploy command in $OVERCLOUD_OVN_DEPLOY_SCRIPT" \ + "\nOnce OVN migration is finished, ovn-extras.yaml can then be safely removed from your OVN templates." + else + echo "ovn-extras.yaml file is missing in "\ + "$OVERCLOUD_OVN_DEPLOY_SCRIPT. Please add it "\ + "as \" -e \$HOME/ovn-extras.yaml\"" + fi exit 1 fi }