behaviour in face of invalid config is incomprehensible

Bug #1642782 reported by Michael Hudson-Doyle
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
curtin
Confirmed
Medium
Unassigned

Bug Description

I ran this command:

./tools/launch $BOOTIMG --publish $ROOTTGZ -- curtin -v -v -v install --set 'json:network={"version":1}' "PUBURL/${ROOTTGZ##*/}"

Whether or not this should work (you need to add "config=[]" to the network field to do what I wanted) the failure mode was super confusing:

finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: SUCCESS: finished: writing config files and configuring apt
Running command ['chroot', '/tmp/tmpJKr_pw/target', 'dpkg-query', '--list'] with allowed return codes [0] (shell=False, capture=True)
finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: failed: curtin command curthooks
'config'
builtin command failed
finish: cmd-install/stage-curthooks/builtin: FAIL: failed: running 'curtin curthooks'
builtin took 0.545 seconds
stage_curthooks took 0.546 seconds
finish: cmd-install/stage-curthooks: FAIL: failed: configuring installed system
Installation failed with exception: Unexpected error while running command.
Command: ['curtin', 'curthooks']
Exit code: 3
Reason: -
Stdout: "start: cmd-install/stage-curthooks/builtin/cmd-curthooks: started: curtin command curthooks\nstart: cmd-install/stage-curthooks/builtin/cmd-curthooks: started: writing config files and configuring apt\ncurthooks handling apt to target /tmp/tmpJKr_pw/target with config {}\nRunning command ['chroot', '/tmp/tmpJKr_pw/target', 'lsb_release', '--all'] with allowed return codes [0] (shell=False, capture=True)\nRunning command ['chroot', '/tmp/tmpJKr_pw/target', 'dpkg', '--print-architecture'] with allowed return codes [0] (shell=False, capture=True)\ngot primary mirror: None\ngot security mirror: None\nApt Mirror info: {'SECURITY': 'http://security.ubuntu.com/ubuntu/', 'PRIMARY': 'http://archive.ubuntu.com/ubuntu/', 'MIRROR': 'http://archive.ubuntu.com/ubuntu/'}\ndebconf_selections was not set in config\nrenaming /tmp/tmpJKr_pw/target/etc/overlayroot.local.conf to /tmp/tmpJKr_pw/target/etc/overlayroot.local.conf.old\nfinish: cmd-install/stage-curthooks/builtin/cmd-curthooks: SUCCESS: finished: writing config files and configuring apt\nRunning command ['chroot', '/tmp/tmpJKr_pw/target', 'dpkg-query', '--list'] with allowed return codes [0] (shell=False, capture=True)\nfinish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: failed: curtin command curthooks\n'config'\n"

This is because install_missing_packages in curthooks.py makes all sorts of assumptions about what config contains (there are other ways to break it too!). Shouldn't the config be validated against a schema (in some sense) fairly early on and rejected if it doesn't meet expectations?

summary: - behaviour in face of invalid config is incomprehensibe
+ behaviour in face of invalid config is incomprehensible
Scott Moser (smoser)
Changed in curtin:
status: New → Confirmed
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.