Your IP : 216.73.216.31


Current Path : /lib/python3/dist-packages/cloudinit/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/cloudinit/__pycache__/event.cpython-38.pyc

U

�Ad1�@svdZddlmZddlmZmZddlmZe�	e
�ZGdd�de�ZGdd�de�Z
eeeee
fd	�d
d�ZdS)
z0Classes and functions related to event handling.�)�Enum)�Dict�Set)�logc@seZdZdZdd�ZdS)�
EventScopeZnetworkcCs|jS�N��value��self�r�1/usr/lib/python3/dist-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-instancezboot-legacyZhotplugcCs|jSrrr
rrr
r#szEventType.__str__N)	rrr�__doc__ZBOOTZBOOT_NEW_INSTANCEZBOOT_LEGACYZHOTPLUGrrrrr
rsr)�user_config�returncCs�i}|��D]�\}}zt|�}Wn<tk
r\}zt�dt|�|�WY�qW5d}~XYnXzdd�|dD�}Wn8tk
r�}zt�dt|�|�g}W5d}~XYnXt|�||<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
�
<listcomp>>sz&userdata_to_events.<locals>.<listcomp>Zwhen)�itemsr�
ValueError�LOGZwarning�str�set)rZ
update_configZscopeZ
scope_listZ	new_scope�eZ
new_valuesrrr
�userdata_to_events's,��rN)r�enumr�typingrrZ	cloudinitrZloggingZ	getLoggerrrrr�dictrrrrr
�<module>s