1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Sat, 5 Aug 2017 02:03:01 +0200
3 Subject: [PATCH] maas: region: force artifact download
5 MaaS configuration fails until all required artifacts are in place,
6 including bootloaders and target images.
8 Hack around this by forcing an explicit artifact sync.
10 NOTE: This is probably achievable through existing maas salt custom
11 module (py) and/or minor rework on that.
12 This fixup should be temporary at best.
14 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
17 diff --git a/maas/region.sls b/maas/region.sls
22 - name: "maas-region apikey --username {{ region.admin.username }} > /var/lib/maas/.maas_credentials"
24 +maas_force_artifact_sync:
26 + - name: salt://maas/files/maas-artifact-sync.sh
30 + - cmd: maas_login_admin
34 - name: maas.process_maas_config
36 - - cmd: maas_login_admin
37 + - cmd: maas_force_artifact_sync
39 maas_commissioning_scripts:
41 diff --git a/maas/files/maas-artifact-sync.sh b/maas/files/maas-artifact-sync.sh
44 +++ b/maas/files/maas-artifact-sync.sh
46 +{%- from "maas/map.jinja" import region with context %}
49 + local total_attempts=$1; shift
52 + echo -e "\n[NOTE] Waiting for cmd to return success: ${cmdstr}\n"
53 + for attempt in $(seq "${total_attempts}"); do
54 + eval "${cmdstr}" && break || true
55 + echo -n '.'; sleep "${sleep_time}"
58 +maas login {{ region.admin.username }} \
59 + http://{{ region.bind.host }}:5240/MAAS/api/2.0 - < \
60 + /var/lib/maas/.maas_credentials || exit 1
61 +# wait max 15 min for service up / image download, 5 min region to rack sync
62 +wait_for 90 "grep -qzE '(Unable to probe for DHCP servers|DHCP probe complete).*Rack controller' /var/log/maas/rackd.log"
63 +maas opnfv boot-resources import || exit 2
64 +wait_for 90 "! maas opnfv boot-resources is-importing | grep -q 'true'"
65 +maas opnfv rack-controllers import-boot-images || exit 3
66 +wait_for 30 "test -d /var/lib/maas/boot-resources/current/ubuntu/amd64"