o x[hã@stdZddlZddlmZddlmZmZe e¡Z Gdd„deƒZ Gdd„deƒZ d e d ee ee ffd d „Z dS) z0Classes and functions related to event handling.éN)ÚEnum)ÚDictÚSetc@seZdZdZdd„ZdS)Ú EventScopeÚnetworkcCó|jS©N©Úvalue©Úself©r ú1/usr/lib/python3/dist-packages/cloudinit/event.pyÚ__str__ózEventScope.__str__N)Ú__name__Ú __module__Ú __qualname__ÚNETWORKrr r r rr s rc@s(eZdZdZdZdZdZdZdd„ZdS) Ú EventTypezCEvent types which can generate maintenance requests for cloud-init.Úbootzboot-new-instancez boot-legacyÚhotplugcCrrr r r r rr"rzEventType.__str__N) rrrÚ__doc__ÚBOOTÚBOOT_NEW_INSTANCEÚ BOOT_LEGACYÚHOTPLUGrr r r rrs rÚ user_configÚreturnc Cs¼i}| ¡D]U\}}zt|ƒ}Wnty+}zt dt|ƒ|¡WYd}~qd}~wwz dd„|dDƒ}WntyT}zt dt|ƒ|¡g}WYd}~nd}~wwt|ƒ||<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Ú =sz&userdata_to_events..Úwhen)ÚitemsrÚ ValueErrorÚLOGÚwarningÚstrÚset)rÚ update_configÚscopeÚ scope_listÚ new_scopeÚeÚ new_valuesr r rÚuserdata_to_events&s4  ý €úý€úr/)rÚloggingÚenumrÚtypingrrÚ getLoggerrr%rrÚdictr/r r r rÚs   "