diff options
author | Alexandru Avadanii <Alexandru.Avadanii@enea.com> | 2017-11-22 14:57:27 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2017-11-22 14:57:27 +0000 |
commit | e92a846313d0ff7a1b0b75e1551fd053621a921d (patch) | |
tree | 6cb26c9a65816e81127386c2958c14ee284751e9 /mcp/config/states/maas | |
parent | 246928006daf99de2317dc8d171c2b0735a3c605 (diff) | |
parent | 77942178b3aff6adc83b5f83645acfff467fa76a (diff) |
Merge "ci/deploy.sh: Add new `-E` arg for env erase"
Diffstat (limited to 'mcp/config/states/maas')
-rwxr-xr-x | mcp/config/states/maas | 12 |
1 files changed, 12 insertions, 0 deletions
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" |