[akraino] Add IEC K8-calico scenarios
[fuel.git] / mcp / config / states / virtual_init
1 #!/bin/bash -e
2 # shellcheck disable=SC1090
3 ##############################################################################
4 # Copyright (c) 2018 Mirantis Inc., Enea AB and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
12
13 # shellcheck disable=SC1090
14 source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/lib.sh"
15 source "$(dirname "${BASH_SOURCE[0]}")/../../scripts/xdf_data.sh"
16
17 CI_DEBUG=${CI_DEBUG:-0}; [[ "${CI_DEBUG}" =~ (false|0) ]] || set -x
18 # shellcheck disable=SC2154,SC2086,SC2116
19 LOCAL_VIRT_NODES=$(echo ${virtual_nodes[*]}) # unquoted to filter space
20 [[ ! "${cluster_states[*]}" =~ maas ]] || LOCAL_VIRT_NODES='mas01'
21 NODE_MASK="${LOCAL_VIRT_NODES// /|}"
22
23 wait_for 5.0 "salt-call state.sls reclass,linux.network,salt.minion \
24               exclude='[{id: reclass_packages}, {id: /etc/reclass/reclass-config.yml}]'"
25 wait_for 3.0 "salt -C 'E@^(${NODE_MASK}).*' saltutil.refresh_pillar"
26
27 # NOTE: domain name changes are not yet supported without a clean redeploy
28
29 # Init specific to VMs on FN (all for virtual, mas for baremetal)
30 wait_for 3.0 "(for n in ${LOCAL_VIRT_NODES}; do salt -C \${n}.* test.ping || exit; done)"
31 wait_for 3.0 "salt -C 'E@^(${NODE_MASK}).*' saltutil.sync_all"
32 [[ ! "${NODE_MASK}" =~ mas01 ]] || exit 0
33
34 wait_for 3.0 "salt -C 'E@^(${NODE_MASK}).*' state.sls linux"
35
36 salt -C "E@^(${NODE_MASK}).*" cmd.run 'reboot'
37 wait_for 90.0 "salt -C 'E@^(${NODE_MASK}).*' test.ping"
38 wait_for 3.0 "salt -C 'E@^(${NODE_MASK}).*' pkg.upgrade refresh=False dist_upgrade=True"
39 wait_for 3.0 "salt -C 'E@^(${NODE_MASK}).*' state.apply salt,ntp"