aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2018-04-26 19:25:21 +0200
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>2018-04-26 19:25:21 +0200
commitd7ab894b988d8dd6fe49714e0d8d6077e08ebb16 (patch)
treee589b39e23774266a5ec876a45d055477a921b73
parent2e4aa7c2e95a4eaee40a0a10e107a75494d76a5c (diff)
[maas] Make boot-source-selection ops idempotent
- add `unless` clause; - instead of adding a new boot sources, update the existing one, assuming standard MaaS installation (always updates id '1'); Change-Id: I2db92a3b14d0588095c69545cbb6977ca109613e Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
-rw-r--r--mcp/patches/0016-Set-boot-source-selections.patch6
1 files changed, 3 insertions, 3 deletions
diff --git a/mcp/patches/0016-Set-boot-source-selections.patch b/mcp/patches/0016-Set-boot-source-selections.patch
index 73bdc90e9..ff52681d2 100644
--- a/mcp/patches/0016-Set-boot-source-selections.patch
+++ b/mcp/patches/0016-Set-boot-source-selections.patch
@@ -13,18 +13,18 @@ Subject: [PATCH] Set boot source selections
Change-Id: I8dc738b3e6e6f1bfcc1348873f162651aff8bbdf
diff --git a/maas/region.sls b/maas/region.sls
-index 39844bd..e231795 100644
--- a/maas/region.sls
+++ b/maas/region.sls
-@@ -171,6 +171,12 @@ maas_login_admin:
+@@ -171,6 +171,13 @@ maas_login_admin:
cmd.run:
- name: "maas-region apikey --username {{ region.admin.username }} > /var/lib/maas/.maas_credentials"
+boot_source_selections:
+ cmd.run:
-+ - name: "maas login {{ region.admin.username }} http://{{ region.bind.host }}:5240/MAAS/api/2.0 - < /var/lib/maas/.maas_credentials && maas opnfv boot-source-selections create 1 os='ubuntu' release='{{ region.maas_config.default_distro_series }}' arches='{{ pillar._param.opnfv_maas_node01_architecture.split('/')[0] }}' subarches='*' labels='*'"
++ - name: "maas login {{ region.admin.username }} http://{{ region.bind.host }}:5240/MAAS/api/2.0 - < /var/lib/maas/.maas_credentials && maas opnfv boot-source-selection update 1 1 release='{{ region.maas_config.default_distro_series }}'"
+ - require:
+ - cmd: maas_login_admin
++ - unless: "maas login {{ region.admin.username }} http://{{ region.bind.host }}:5240/MAAS/api/2.0 - < /var/lib/maas/.maas_credentials && maas opnfv boot-source-selections read 1 | grep -q {{ region.maas_config.default_distro_series }}"
+
maas_force_artifact_sync:
cmd.script: