Merge "maas: region: credentials workaround, force sync"
[fuel.git] / mcp / patches / 0003-maas-region-force-artifact-download.patch
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
4
5 MaaS configuration fails until all required artifacts are in place,
6 including bootloaders and target images.
7
8 Hack around this by forcing an explicit artifact sync.
9
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.
13
14 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
15 ---
16
17 diff --git a/maas/region.sls b/maas/region.sls
18 index d3227ca..8a2243d 100644
19 --- a/maas/region.sls
20 +++ b/maas/region.sls
21 @@ -109,11 +109,17 @@
22    cmd.run:
23    - name: "maas-region apikey --username {{ region.admin.username }} > /var/lib/maas/.maas_credentials"
24
25 +maas_force_artifact_sync:
26 +  cmd.run:
27 +  - name: "maas login {{ region.admin.username }} http://{{ region.bind.host }}/MAAS/api/2.0 - < /var/lib/maas/.maas_credentials && while ! grep -qzE '(Unable to probe for DHCP servers|DHCP probe complete).*Rack controller' /var/log/maas/rackd.log; do sleep 5; echo -n '.'; done && maas opnfv boot-resources import && while maas opnfv boot-resources is-importing | grep -q -e 'true'; do sleep 5; echo -n '.'; done && maas opnfv rack-controllers import-boot-images && while ! test -d /var/lib/maas/boot-resources/current/ubuntu; do sleep 5; echo -n '.'; done"
28 +  - require:
29 +    - cmd: maas_login_admin
30 +
31  maas_config:
32    module.run:
33    - name: maas.process_maas_config
34    - require:
35 -    - cmd: maas_login_admin
36 +    - cmd: maas_force_artifact_sync
37
38  maas_commissioning_scripts:
39    module.run: