aboutsummaryrefslogtreecommitdiffstats
path: root/mcp
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2019-01-19 21:10:49 +0100
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>2019-01-19 21:10:49 +0100
commit8de84a06b723a237aa34dd42d020ba06ae57dcf5 (patch)
treea03aaeea40c553f79cbf35c843bb20435d6422f4 /mcp
parent6f51790b669b6d8094ac24055ef0e690913d62aa (diff)
[uefi_cleanup] Use grain targeting
Alternating HA and no-HA scenario deployments on baremetal requires non-hostname targeting for UEFI cleanup (e.g. ctl01/gtw01/kvm01). Change-Id: I9f0e967b500856b65a69ea0ab6ea13e15b327d8b Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Diffstat (limited to 'mcp')
-rw-r--r--mcp/scripts/lib.sh11
1 files changed, 3 insertions, 8 deletions
diff --git a/mcp/scripts/lib.sh b/mcp/scripts/lib.sh
index 85360bf2e..6455a65c0 100644
--- a/mcp/scripts/lib.sh
+++ b/mcp/scripts/lib.sh
@@ -36,22 +36,17 @@ function wait_for {
}
function cleanup_uefi {
- # Clean up Ubuntu boot entry if cfg01, kvm nodes online from previous deploy
+ # Clean up Ubuntu boot entry if cfg01, baremetal nodes online from previous deploy
local cmd_str="ssh ${SSH_OPTS} ${SSH_SALT}"
- local grain_virtual=$(salt -C 'I@nova:compute and *01*' grains.get virtual --out txt | cut -d ' ' -f2)
ping -c 1 -w 1 "${SALT_MASTER}" || return 0
[ ! "$(hostname)" = 'cfg01' ] || cmd_str='eval'
- # NOTE: Targeting nodes by hostname is fragile and should be refactored to
- # also cover corner cases like noha scenarios on AArch64 baremetal's 'ctl01'
- ${cmd_str} "sudo salt -C 'kvm* or cmp*' cmd.run \
+ ${cmd_str} "sudo salt -C 'G@virtual:physical and not cfg01*' cmd.run \
\"which efibootmgr > /dev/null 2>&1 && \
efibootmgr | grep -oP '(?<=Boot)[0-9]+(?=.*ubuntu)' | \
xargs -I{} efibootmgr --delete-bootnum --bootnum {}; \
rm -rf /boot/efi/*\"" || true
- if [ "${grain_virtual}" == physical ]; then
- ${cmd_str} "sudo salt -C 'kvm* or cmp*' cmd.run 'shutdown now'" || true
- fi
+ ${cmd_str} "sudo salt -C 'G@virtual:physical and not cfg01*' cmd.run 'shutdown now'" || true
}
function get_nova_compute_pillar_data {