From d7ab894b988d8dd6fe49714e0d8d6077e08ebb16 Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Thu, 26 Apr 2018 19:25:21 +0200 Subject: [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 --- mcp/patches/0016-Set-boot-source-selections.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mcp') 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: -- cgit 1.2.3-korg