From 924b23cb7edf1edcfd4468495fa2fe9cfb6504ca Mon Sep 17 00:00:00 2001 From: Zheng Xiao Mei Date: Tue, 18 Jun 2024 15:13:33 +0800 Subject: [PATCH] Fix no name_prefix issue. Signed-off-by: Zheng Xiao Mei --- .../ocp_upi/tools/generate-bootstrap-ignitionshim.py | 6 +++++- .../ocp_upi/tools/generate-master-ignition.sh | 7 +++---- .../ocp_upi/tools/generate-worker-ignition.sh | 7 +++---- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/tools/generate-bootstrap-ignitionshim.py b/z_infra_provisioning/cloud_infra_center/ocp_upi/tools/generate-bootstrap-ignitionshim.py index 8a35d2266..863d1a0cf 100755 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/tools/generate-bootstrap-ignitionshim.py +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/tools/generate-bootstrap-ignitionshim.py @@ -54,7 +54,11 @@ } }) -name_prefix = sys.argv[4] +if len(sys.argv) > 4: + name_prefix = sys.argv[4] +else: + name_prefix = '' + if name_prefix: name_prefix_byte = name_prefix.encode() bootstrap_hostname = base64.standard_b64encode(name_prefix_byte).decode().strip() diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/tools/generate-master-ignition.sh b/z_infra_provisioning/cloud_infra_center/ocp_upi/tools/generate-master-ignition.sh index af752715e..f3f57234c 100755 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/tools/generate-master-ignition.sh +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/tools/generate-master-ignition.sh @@ -10,12 +10,11 @@ infra_id=$1 master_end=$(($2 - 1)) -name_prefix=$3 for index in $( seq 0 $master_end); do - if [ -n "$name_prefix" ]; then - MASTER_HOSTNAME="$name_prefix-$index\n" - IGNITION_NAME="$name_prefix-$index" + if [ -n "$3" ]; then + MASTER_HOSTNAME="$3-$index\n" + IGNITION_NAME="$3-$index" else MASTER_HOSTNAME="$infra_id-master-$index\n" IGNITION_NAME="$infra_id-master-$index" diff --git a/z_infra_provisioning/cloud_infra_center/ocp_upi/tools/generate-worker-ignition.sh b/z_infra_provisioning/cloud_infra_center/ocp_upi/tools/generate-worker-ignition.sh index fdc3d540c..694d81a05 100755 --- a/z_infra_provisioning/cloud_infra_center/ocp_upi/tools/generate-worker-ignition.sh +++ b/z_infra_provisioning/cloud_infra_center/ocp_upi/tools/generate-worker-ignition.sh @@ -9,12 +9,11 @@ # ================================================================= infra_id=$1 worker_end=$(($2 - 1)) -name_prefix=$3 for index in $( seq 0 $worker_end); do - if [ -n "$name_prefix" ]; then - WORKER_HOSTNAME="$name_prefix-$index\n" - IGNITION_NAME="$name_prefix-$index" + if [ -n "$3" ]; then + WORKER_HOSTNAME="$3-$index\n" + IGNITION_NAME="$3-$index" else WORKER_HOSTNAME="$infra_id-worker-$index\n" IGNITION_NAME="$infra_id-worker-$index"