a '¡Dgã@srdZddlZddlmZddlmZmZe e¡Z Gdd„deƒZ Gdd„deƒZ e ee ee fd œd d „Z dS) z0Classes and functions related to event handling.éN)ÚEnum)ÚDictÚSetc@seZdZdZdd„ZdS)Ú EventScopeÚnetworkcCs|jS©N©Úvalue©Úself©r ú3/usr/lib/python3.9/site-packages/cloudinit/event.pyÚ__str__szEventScope.__str__N)Ú__name__Ú __module__Ú __qualname__ZNETWORKrr r r r r src@s(eZdZdZdZdZdZdZdd„ZdS) Ú EventTypezCEvent types which can generate maintenance requests for cloud-init.Zbootzboot-new-instancez boot-legacyZhotplugcCs|jSrrr r r r r"szEventType.__str__N) rrrÚ__doc__ZBOOTZBOOT_NEW_INSTANCEZ BOOT_LEGACYZHOTPLUGrr r r r rs r)Ú user_configÚreturnc CsÈi}| ¡D]¶\}}z t|ƒ}WnBtyb}z*t dt|ƒ|¡WYd}~q WYd}~n d}~00zdd„|dDƒ}Wn:ty´}z"t dt|ƒ|¡g}WYd}~n d}~00t|ƒ||<q |S)aConvert userdata into update config format defined on datasource. Userdata is in the form of (e.g): {'network': {'when': ['boot']}} DataSource config is in the form of: {EventScope.Network: {EventType.BOOT}} Take the first and return the second z.%s! Update data will be ignored for '%s' scopeNcSsg|] }t|ƒ‘qSr )r)Ú.0Úxr r r Ú =óz&userdata_to_events..Zwhen)ÚitemsrÚ ValueErrorÚLOGZwarningÚstrÚset)rZ update_configZscopeZ scope_listZ new_scopeÚeZ new_valuesr r r Úuserdata_to_events&s,  ý"ýr )rZloggingÚenumrÚtypingrrZ getLoggerrrrrÚdictr r r r r Ús