a '¡Dgò ã@s¨UdZddlZddlZddlmZmZddlmZddlm Z ddl m Z m Z m Z ddlmZe e¡Zdd ged gd œZe ed <d Zee eeddœdd„Zdd„ZdS)z;Autoinstall: Support ubuntu live-server autoinstall syntax.éN)ÚsubpÚutil)ÚCloud)ÚConfig)Ú MetaSchemaÚ SchemaProblemÚSchemaValidationError)ÚPER_ONCEZcc_ubuntu_autoinstallZubuntuÚ autoinstall)ÚidZdistrosZ frequencyZactivate_by_schema_keysÚmeta)Z subiquityzubuntu-desktop-installer)ÚnameÚcfgÚcloudÚargsÚreturncCs„d|vrt d|¡dSt |¡t ddg¡\}}d}tD]}t ||¡r<|}q<|slt dd  t¡¡dSt |ƒt d|¡dS)Nr z?Skipping module named %s, no 'autoinstall' key in configurationZsnapÚlistzaSkipping autoinstall module. Expected one of the Ubuntu installer snap packages to be present: %sz, z8Valid autoinstall schema. Config will be processed by %s) ÚLOGÚdebugrZwait_for_snap_seededrÚLIVE_INSTALLER_SNAPSÚreÚsearchZwarningÚjoinÚvalidate_config_schema)r rrrZ snap_listÚ_Zinstaller_presentZ snap_name©rúJ/usr/lib/python3.9/site-packages/cloudinit/config/cc_ubuntu_autoinstall.pyÚhandles.þ  ýþrcCs||d}t|tƒs.ttddt|ƒj›�ƒgƒ‚d|vrHttddƒgƒ‚n0t| d¡tƒsxttddt|dƒj›�ƒgƒ‚dS)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)Ú isinstanceÚdictrrÚtypeÚ__name__ÚgetÚint)rZautoinstall_cfgrrrr<s2 ÿþÿÿ  ÿ ÿþÿÿr)Ú__doc__ZloggingrZ cloudinitrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarrrZcloudinit.settingsr Z getLoggerr"rr Ú__annotations__rÚstrrrrrrrrÚs     ü