X-Git-Url: https://gerrit.akraino.org/r/gitweb?a=blobdiff_plain;f=deploy%2Fmetal3%2Fscripts%2F01_metal3.sh;h=d419b82f76e72a8ac3cc33677a443649a63e64d8;hb=03f301ffa25a248fdd8f17d210b20ace4d1bf42f;hp=27a668536e6dcfee5187dc742cfc2c8b2389f359;hpb=99ab423be0ac03c1c23e1129a96b75b3ce7269ce;p=icn.git diff --git a/deploy/metal3/scripts/01_metal3.sh b/deploy/metal3/scripts/01_metal3.sh index 27a6685..d419b82 100755 --- a/deploy/metal3/scripts/01_metal3.sh +++ b/deploy/metal3/scripts/01_metal3.sh @@ -59,8 +59,10 @@ EOF function deprovision_compute_node { name="$1" - kubectl patch baremetalhost $name -n metal3 --type merge \ - -p '{"spec":{"image":{"url":"","checksum":""}}}' + if kubectl get baremetalhost $name -n metal3 &>/dev/null; then + kubectl patch baremetalhost $name -n metal3 --type merge \ + -p '{"spec":{"image":{"url":"","checksum":""}}}' + fi } function set_compute_ssh_config { @@ -239,9 +241,9 @@ function remove_bm_hosts { function cleanup { while IFS=',' read -r name ipmi_username ipmi_password ipmi_address os_username os_password os_image_name; do - kubectl delete bmh $name -n metal3 - kubectl delete secrets $name-bmc-secret -n metal3 - kubectl delete secrets $name-user-data -n metal3 + kubectl delete --ignore-not-found=true bmh $name -n metal3 + kubectl delete --ignore-not-found=true secrets $name-bmc-secret -n metal3 + kubectl delete --ignore-not-found=true secrets $name-user-data -n metal3 if [ -f $name-bm-node.yaml ]; then rm -rf $name-bm-node.yaml fi