From 77942178b3aff6adc83b5f83645acfff467fa76a Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Sat, 18 Nov 2017 20:46:05 +0100 Subject: ci/deploy.sh: Add new `-E` arg for env erase NOTE: In order to undefine VCP VMs with NVRAM (e.g. AArch64 VMs using AAVMF), an additional parameter should be passed to libvirt by Salt virt core module (equivalent to `virsh undefine --nvram`). While at it, pass CI_DEBUG, ERASE_ENV enviroment variables to state execution, and stop force-applying patches. Also refactor the rsync between foundation node and Salt master, so the whole git repo is copied as , and becomes a link to it; useful for Armband, where 'fuel' is a git submodule. Fix .git paths after rsync, so git submodules work as expected in cfg01 repos. JIRA: FUEL-307 Change-Id: Ic62f03e786581c019168c50ccc50107238021d7f Signed-off-by: Alexandru Avadanii --- mcp/config/states/maas | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'mcp/config/states/maas') diff --git a/mcp/config/states/maas b/mcp/config/states/maas index eea3e0ef6..7ccf0188e 100755 --- a/mcp/config/states/maas +++ b/mcp/config/states/maas @@ -8,6 +8,7 @@ ############################################################################## CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x +ERASE_ENV=${ERASE_ENV:-0} # shellcheck disable=SC1090 source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh" @@ -52,6 +53,17 @@ function maas_fixup() { return 0 } +# Optionally destroy MaaS machines from a previous run +if [ "${ERASE_ENV}" -gt 1 ]; then + dnodes=$(salt 'mas01*' --out yaml state.apply maas.machines.status | \ + grep -Pzo '\s+system_id: \K.+\n') + for node_system_id in ${dnodes}; do + salt -C 'mas01*' state.apply maas.machines.delete \ + pillar="{'system_id': '${node_system_id}'}" + sleep 30 + done +fi + # MaaS rack/region controller, node commissioning salt -C 'mas01*' cmd.run "add-apt-repository ppa:maas/stable" -- cgit 1.2.3-korg