a -@=j @sUdZddlZddlmZmZddlmZddlmZddl m Z ddl m Z e eZdd d Zd gd e d gdZe ed<ddZeeeeddddZdS)z"Resolv Conf: configure resolv.confN) templaterutil)Cloud)Config) MetaSchema) PER_INSTANCEz resolv.confzsystemd.resolved.conf)z/etc/resolv.confz/etc/systemd/resolved.confZcc_resolv_conf)Z almalinuxZ cloudlinuxZalpineZ azurelinuxZfedoraZmarinerZopensusez opensuse-leapzopensuse-microoszopensuse-tumbleweedZphotonZrhelZsle_hpcz sle-microZslesZ openeulermanage_resolv_conf)idZdistrosZ frequencyZactivate_by_schema_keysmetacCsg}g}d|vrJ|dD],\}}t|tr|r>||q||q||D]}|d|=qR|dsti|d<||d<td|t|||dS)Noptionsflagsz$Writing resolv.conf from template %s) items isinstanceboolappendgetLOGdebugrZrender_to_file) template_fnparams target_fnamer Z false_flagskeyvalflagrC/usr/lib/python3.9/site-packages/cloudinit/config/cc_resolv_conf.pygenerate_resolv_conf3s       r)namecfgcloudargsreturncCsd|vrtd|dSt|dds6td|dSd|vrLtddSz|t|jj}Wnt ytdYdS0t ||d|jjd dS) a[ Handler for resolv.conf @param name: The module name "resolv_conf" from cloud.cfg @param cfg: A nested dict containing the entire cloud config contents. @param cloud: The L{CloudInit} object in use. @param log: Pre-initialized Python logger object to use for logging. @param args: Any module arguments from cloud.cfg rzFSkipping module named %s, no 'manage_resolv_conf' key in configurationNFzGSkipping module named %s, 'manage_resolv_conf' present but set to FalseZ resolv_confz3manage_resolv_conf True but no parameters provided!z0No template found, not rendering resolve configs)rrr) rrrZget_cfg_option_boolZwarningZget_template_filenameRESOLVE_CONFIG_TEMPLATE_MAPZdistroZresolve_conf_fnKeyErrorr)rrrr rrrrhandleJs8     r$)__doc__ZloggingZ cloudinitrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarZcloudinit.settingsrZ getLogger__name__rr"r __annotations__rstrlistr$rrrr s"