Fix format of curtin:xenial:amd64
Closes-bug: PROD-25243 (PROD:25243)
Change-Id: Ifd5f3f9204f53a322d955f6d33419d6a696bd594
diff --git a/README.rst b/README.rst
index 377f1d2..20da43e 100644
--- a/README.rst
+++ b/README.rst
@@ -528,9 +528,13 @@
amd64:
xenial:
# List of packages, to be installed directly in curtin stage.
- extra_pkgs: [ "linux-headers-generic-hwe-16.04", "linux-image-extra-virtual-hwe-16.04" ]
+ extra_pkgs:
+ enabled: true
+ pkgs: [ "linux-headers-generic-hwe-16.04", "linux-image-extra-virtual-hwe-16.04" ]
# exact kernel pkgs name, to be passed into curtin stage.
- kernel_package: 'linux-image-virtual-hwe-16.04'
+ kernel_package:
+ enabled: true
+ value 'linux-image-virtual-hwe-16.04'
Single MAAS cluster service [multiple racks]
diff --git a/maas/files/curtin_userdata_amd64_generic_xenial b/maas/files/curtin_userdata_amd64_generic_xenial
index 0af7280..98c7758 100644
--- a/maas/files/curtin_userdata_amd64_generic_xenial
+++ b/maas/files/curtin_userdata_amd64_generic_xenial
@@ -19,11 +19,6 @@
maas: [wget, '--no-proxy', {{node_disable_pxe_url|escape.json}}, '--post-data', {{node_disable_pxe_data|escape.json}}, '-O', '/dev/null']
{% endraw %}
-{%- if salt['pillar.get']('maas:cluster:curtin_vars:amd64:xenial:kernel_package') %}
-kernel:
- package: {{ pillar.maas.cluster.curtin_vars.amd64.xenial.kernel_package }}
-{%- endif %}
-
{%- if cluster.get('saltstack_repo_key', False) %}
{% set salt_repo_key = salt['hashutil.base64_b64encode'](cluster.saltstack_repo_key) %}
apt_00_set_gpg: ["curtin", "in-target", "--", "sh", "-c", "echo '{{salt_repo_key}}' | base64 -d | apt-key add -"]
@@ -36,8 +31,10 @@
apt_01_set_repo: ["curtin", "in-target", "--", "sh", "-c", "echo '{{ saltstack_repo }}' >> /etc/apt/sources.list.d/mcp_saltstack.list"]
apt_03_update: ["curtin", "in-target", "--", "apt-get", "update"]
-{%- if salt['pillar.get']('maas:cluster:curtin_vars:amd64:xenial:extra_pkgs') %}
- apt_04_install_pkgs: ["curtin", "in-target", "--", "apt-get", "-y", "install", "{{ pillar.maas.cluster.curtin_vars.amd64.xenial.extra_pkgs|join(' ') }}"]
+{%- if salt['pillar.get']('maas:cluster:curtin_vars:amd64:xenial:extra_pkgs:enabled')|default(false) %}
+ {% for pkg in pillar.maas.cluster.curtin_vars.amd64.xenial.extra_pkgs.pkgs -%}
+ apt_04_install_pkgs_{{ loop.index }}: ["curtin", "in-target", "--", "apt-get", "-y", "install", "{{ pkg }}"]
+ {% endfor %}
{%- endif %}
salt_01_install: ["curtin", "in-target", "--", "apt-get", "-y", "install", "salt-minion"]
salt_02_hostname_set: ["curtin", "in-target", "--", "echo", "{% raw %}{{node.hostname}}{% endraw %}.{{pillar.linux.system.domain}}"]
@@ -51,6 +48,12 @@
salt_10_recon_max: ["curtin", "in-target", "--", "sh", "-c", "echo 'recon_max: 60000' >> /etc/salt/minion.d/minion.conf"]
salt_11_recon_randomize: ["curtin", "in-target", "--", "sh", "-c", "echo 'recon_randomize: True' >> /etc/salt/minion.d/minion.conf"]
salt_12_auth_timeout: ["curtin", "in-target", "--", "sh", "-c", "echo 'auth_timeout: 60' >> /etc/salt/minion.d/minion.conf"]
+
+{%- if salt['pillar.get']('maas:cluster:curtin_vars:amd64:xenial:kernel_package:enabled')|default(false) %}
+kernel:
+ package: {{ pillar.maas.cluster.curtin_vars.amd64.xenial.kernel_package.value }}
+{%- endif %}
+
{% raw %}
{{if third_party_drivers and driver}}
driver_00_key_get: curtin in-target -- sh -c "/bin/echo -en '{{key_string}}' > /tmp/maas-{{driver['package']}}.gpg"
diff --git a/tests/pillar/maas_region.sls b/tests/pillar/maas_region.sls
index d601e91..d3325eb 100644
--- a/tests/pillar/maas_region.sls
+++ b/tests/pillar/maas_region.sls
@@ -10,9 +10,13 @@
curtin_vars:
amd64:
xenial:
- extra_pkgs: [ "curl", "wget" ]
- #kernel_package: 'linux-image-virtual-hwe-16.04'
- kernel_package: 'mc'
+ extra_pkgs:
+ enabled: true
+ pkgs: [ "curl", "wget" ]
+ kernel_package:
+ enabled: true
+ #value: 'linux-image-virtual-hwe-16.04'
+ value: 'mc'
region:
enabled: true
bind: