subiquity icon indicating copy to clipboard operation
subiquity copied to clipboard

subiquitymodel: validate merged cloud-config userdata_raw before reboot

Open blackboxsw opened this issue 3 years ago • 1 comments

This will raise noisy SchemaValidationErrors if either deprecated keys or schema errors are provided in autoinstall.user-data or in the merged userdata_raw provided to cloud-init in the installed target.

This is part of a series of PRs to support cloud-init/subiquity live-installer usability:

  1. Add /etc/cloud-init/clean.d/90-installer script to allow cloud-init clean to remove any installer artifacts for golden image creation
  2. subiquity to read /run/cloud-init/instance-data-sensitive.json for autoinstall: config directives instead of initializing Init.read_cfg()
  3. [This PR] Perform schema initial validation on merged userdata_raw config within the installer environment to catch cloud-init-related user misconfiguration before final target system reboot
  4. TBD ubuntu-desktop-installer to disable cloud-init after installed system reboot via write_files directive
  5. TBD Consume cloud-init status --format (json/yaml) machine readable output to report more succinct status of cloud-init

blackboxsw avatar Jul 19 '22 20:07 blackboxsw

Something very strange is happening when I VM test this branch with autoinstall. Using a fairly boring autoinstall set https://gist.github.com/dbungert/a48ea4d6291daa2e2bc53fbd2056a33b, one that works fine with main branch, on this branch I see curtin throwing schema validation errors from block probing, which makes no sense whatsoever.

@blackboxsw - would you run a VM test from this branch and throw some autoinstall at it?

dbungert avatar Aug 02 '22 20:08 dbungert

We determined that the 'old' non-distro version of jsonschema pip installed in the subiquity snap was incompatible with cloud-init. Dan put up https://github.com/canonical/subiquity/pull/1396 to remove that duplicate version of jsonschema and I validated that this PR works in a locally built snap based on this branch and 1396. Expectation is that we only want to merge this PR once 1396 lands.

blackboxsw avatar Aug 31 '22 21:08 blackboxsw