a 'Dg @sUdZddlZddlZddlmZmZddlmZddlm Z ddl m Z m Z m Z ddlmZeeZdd ged gd Ze ed <d Zee eeddddZddZdS)z;Autoinstall: Support ubuntu live-server autoinstall syntax.N)subputil)Cloud)Config) MetaSchema SchemaProblemSchemaValidationError)PER_ONCEZcc_ubuntu_autoinstallZubuntu autoinstall)idZdistrosZ frequencyZactivate_by_schema_keysmeta)Z subiquityzubuntu-desktop-installer)namecfgcloudargsreturncCsd|vrtd|dSt|tddg\}}d}tD]}t||r<|}q<|sltdd tdSt |td|dS)Nr z?Skipping module named %s, no 'autoinstall' key in configurationZsnaplistzaSkipping autoinstall module. Expected one of the Ubuntu installer snap packages to be present: %sz, z8Valid autoinstall schema. Config will be processed by %s) LOGdebugrZwait_for_snap_seededrLIVE_INSTALLER_SNAPSresearchZwarningjoinvalidate_config_schema)r rrrZ snap_list_Zinstaller_presentZ snap_namerJ/usr/lib/python3.9/site-packages/cloudinit/config/cc_ubuntu_autoinstall.pyhandles.  rcCs||d}t|ts.ttddt|jgd|vrHttddgn0t|dtsxttddt|djgdS)a>Supplemental runtime schema validation for autoinstall yaml. Schema validation issues currently result in a warning log currently which can be easily ignored because warnings do not bubble up to cloud-init status output. In the case of the live-installer, we want cloud-init to raise an error to set overall cloud-init status to 'error' so it is more discoverable in installer environments. # TODO(Drop this validation When cloud-init schema is strict and errors) :raise: SchemaValidationError if any known schema values are present. r zExpected dict type but found: versionzMissing required 'version' keyzautoinstall.versionzExpected int type but found: N) isinstancedictrrtype__name__getint)rZautoinstall_cfgrrrr<s2    r)__doc__ZloggingrZ cloudinitrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarrrZcloudinit.settingsr Z getLoggerr"rr __annotations__rstrrrrrrrrs