Comment 0 for bug 1734274

Revision history for this message
Ondrej Kuchar (ondrej-kuchar) wrote : curtin fails to deploy on empty config values

curtin version:
root@ba0b1a:~# dpkg -l | grep -i curtin
ii curtin-common 0.1.0~bzr532-0ubuntu1~16.04.1 all Library and tools for curtin installer
ii python3-curtin 0.1.0~bzr532-0ubuntu1~16.04.1 all Library and tools for curtin installer

curtin fails with this error

curtin: Installation started. (0.1.0~bzr532-0ubuntu1~16.04.1)
curtin: Installation failed with exception: 'NoneType' object has no attribute 'keys'

when the test in early_commands is not true
root@ba0b1a:~# cat /etc/maas/preseeds/curtin_userdata
#cloud-config
debconf_selections:
 maas: |
  {{for line in str(curtin_preseed).splitlines()}}
  {{line}}
  {{endfor}}
early_commands:
# disable_reboot: touch /run/block-curtin-poweroff /tmp/block-poweroff /tmp/block-reboot
{{if third_party_drivers and driver}}
  {{py: key_string = ''.join(['\\x%x' % x for x in map(ord, driver['key_binary'])])}}
  driver_00_get_key: /bin/echo -en '{{key_string}}' > /tmp/maas-{{driver['package']}}.gpg
  driver_01_add_key: ["apt-key", "add", "/tmp/maas-{{driver['package']}}.gpg"]
  driver_02_add: ["add-apt-repository", "-y", "deb {{driver['repository']}} {{node.get_distro_series()}} main"]
  driver_03_update_install: ["sh", "-c", "apt-get update --quiet && apt-get --assume-yes install {{driver['package']}}"]
  driver_04_load: ["sh", "-c", "depmod && modprobe {{driver['module']}}"]
{{endif}}

workaround was to add placeholder to early_commands
root@ba0b1a-mgm231maasregion-sk:~# cat /etc/maas/preseeds/curtin_userdata
#cloud-config
debconf_selections:
 maas: |
  {{for line in str(curtin_preseed).splitlines()}}
  {{line}}
  {{endfor}}
early_commands:
# disable_reboot: touch /run/block-curtin-poweroff /tmp/block-poweroff /tmp/block-reboot
  dummy_placeholder: echo just a placeholder
{{if third_party_drivers and driver}}
  {{py: key_string = ''.join(['\\x%x' % x for x in map(ord, driver['key_binary'])])}}
  driver_00_get_key: /bin/echo -en '{{key_string}}' > /tmp/maas-{{driver['package']}}.gpg
  driver_01_add_key: ["apt-key", "add", "/tmp/maas-{{driver['package']}}.gpg"]
  driver_02_add: ["add-apt-repository", "-y", "deb {{driver['repository']}} {{node.get_distro_series()}} main"]
  driver_03_update_install: ["sh", "-c", "apt-get update --quiet && apt-get --assume-yes install {{driver['package']}}"]
  driver_04_load: ["sh", "-c", "depmod && modprobe {{driver['module']}}"]
{{endif}}