+
    ˜qgjm&  ã                   ó*  € R t ^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	 ^ RI
HtHt ^ RIHt RtRtRt]P$                  ! ]4      t ! R	 R
]4      t]! R4      t ! R R4      t ! R R]4      tRR lt]P6                  R3R ltR t ! R R4      tR tR# )z�
events for reporting.

The events here are designed to be used with reporting.
They can be published to registered handlers with report_event.
N)ÚList)Úperformance)Úavailable_handlersÚinstantiated_handler_registry)ÚReportingHandlerÚfinishÚstartÚ	cloudinitc                   ó&   a € ] tR t^t o R tRtV tR# )Ú_namesetc                ó6   € W9   d   V# \        R V,          4      h)z%s not a valid value)ÚAttributeError)ÚselfÚnames   &&Ú</usr/lib/python3/dist-packages/cloudinit/reporting/events.pyÚ__getattr__Ú_nameset.__getattr__    s   € ØŒ<ØˆKÜÐ3°dÕ:Ó;Ð;ó    © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__r   Ú__static_attributes__Ú__classdictcell__©Ú__classdict__s   @r   r   r      s   ø‡ € ÷<ð <r   r   c                   ó>   a € ] tR t^)t o Rt]R3R ltR tR tRt	V t
R# )ÚReportingEventz"Encapsulation of event formatting.Nc                ót   € Wn         W n        W0n        W@n        Vf   \        P                  ! 4       pWPn        R # ©N)Ú
event_typer   ÚdescriptionÚoriginÚtimeÚ	timestamp)r   r!   r   r"   r#   r%   s   &&&&&&r   Ú__init__ÚReportingEvent.__init__,   s/   € ð %ŒØŒ	Ø&ÔØŒØÒÜŸ	š	›ˆIØ"Žr   c                ód   € RP                  V P                  V P                  V P                  4      # )z"The event represented as a string.z{0}: {1}: {2})Úformatr!   r   r"   ©r   s   &r   Ú	as_stringÚReportingEvent.as_string<   s*   € à×%Ñ%Ø�O‰O˜TŸY™Y¨×(8Ñ(8ó
ð 	
r   c           
     ó~   € RV P                   RV P                  RV P                  RV P                  RV P                  /# )z&The event represented as a dictionary.r   r"   r!   r#   r%   )r   r"   r!   r#   r%   r*   s   &r   Úas_dictÚReportingEvent.as_dictB   s=   € ð �D—I‘IØ˜4×+Ñ+Ø˜$Ÿ/™/Ø�d—k‘kØ˜Ÿ™ð
ð 	
r   )r"   r!   r   r#   r%   )r   r   r   r   Ú__doc__ÚDEFAULT_EVENT_ORIGINr&   r+   r.   r   r   r   s   @r   r   r   )   s$   ø‡ € Ù,ð $Øô#ò 
÷
ð 
r   r   c                   ó`   a a€ ] tR t^Mt o]P
                  R3V 3R lltR tV 3R ltRt	Vt
V ;t# )ÚFinishReportingEventNc                ó¢   <€ \         \        V `  \        W4       W@n        Vf   . pWPn        W0n        V\        9  d   \        RV,          4      hR # )NzInvalid result: %s)	Úsuperr3   r&   ÚFINISH_EVENT_TYPEÚresultÚ
post_filesÚdurationÚstatusÚ
ValueError)r   r   r"   r9   r7   r8   Ú	__class__s   &&&&&&€r   r&   ÚFinishReportingEvent.__init__N   sT   ø€ ô 	Ô" DÑ2Ü˜tô	
ð ŒØÒØˆJØ$ŒØ ŒØœÔÜÐ1°FÕ:Ó;Ð;ñ  r   c                ó�   € R P                  V P                  V P                  V P                  V P                  V P
                  4      # )z'{0}: {1}: {2}: {3} (duration: {4:.3f}s))r)   r!   r   r7   r"   r9   r*   s   &r   r+   ÚFinishReportingEvent.as_stringa   s:   € Ø8×?Ñ?Ø�O‰OØ�I‰IØ�K‰KØ×ÑØ�M‰Mó
ð 	
r   c                óÐ   <€ \         \        V `  4       pV P                  VR&   \	        V P
                  ^4      VR&   V P                  '       d   \        V P                  4      VR&   V# )z'The event represented as json friendly.r7   r9   Úfiles)r5   r3   r.   r7   Úroundr9   r8   Ú_collect_file_info)r   Údatar<   s   & €r   r.   ÚFinishReportingEvent.as_dictj   sU   ø€ äÔ)¨4Ñ8Ó:ˆØŸ™ˆˆX‰Ü  §¡°Ó2ˆˆZÑØ�?�?ˆ?Ü.¨t¯©Ó?ˆD�‰MØˆr   )r9   r8   r7   )r   r   r   r   r:   ÚSUCCESSr&   r+   r.   r   r   Ú__classcell__)r<   r   s   @@r   r3   r3   M   s%   ù‡ € ð �~‰~Ø÷<ò&
÷õ r   r3   c                ó>  € V'       g   / p\         P                  P                  4        UUu0 uF  w  r#W!9   g   K  VkK  	  ppp\        \        P                  P                  4       4      pV F&  p\        V4      V9   d   K  VP                  V 4       K(  	  R# u uppi )a‹  Report an event to all registered event handlers
except those whose type is in excluded_handler_types.

This should generally be called via one of the other functions in
the reporting module.

:param excluded_handler_types:
     List of handlers types to exclude from reporting the event to.
:param event_type:
    The type of the event; this should be a constant from the
    reporting module.
N)r   Úregistered_itemsÚitemsÚlistr   ÚvaluesÚtypeÚpublish_event)ÚeventÚexcluded_handler_typesÚ	hndl_typeÚhndl_clsÚexcluded_handler_classesÚhandlersÚhandlers   &&     r   Úreport_eventrV   t   s–   € ÷ "Ø!#Ðô $6×#FÑ#F×#LÑ#LÔ#Nô á#NÑˆIØÑ.÷ 	ˆÙ#Nð ñ  ô (,Ü%×6Ñ6×=Ñ=Ó?ó(€Hó ˆÜ�‹=Ð4Ô4ÙØ×Ñ˜eÖ$ó ùó s
   ¬
B»Bc                ó4   € \        WW#VR7      p\        V4      # )zNReport a "finish" event.

See :py:func:`.report_event` for parameter details.
)r8   )r3   rV   )Ú
event_nameÚevent_descriptionr9   r7   r8   rO   s   &&&&& r   Úreport_finish_eventrZ   “   s"   € ô !Ø xÀJô€Eô ˜ÓÐr   c                ó8   € \        \        W4      p\        V4      # )a  Report a "start" event.

:param event_name:
    The name of the event; this should be a topic which events would
    share (e.g. it will be the same for start and finish events).

:param event_description:
    A human-readable description of the event that has occurred.
)r   ÚSTART_EVENT_TYPErV   )rX   rY   rO   s   && r   Úreport_start_eventr]   ¤   s   € ô Ô+¨ZÓK€EÜ˜ÓÐr   c                   óÒ   a € ] tR t^²t o RtRRR]P                  R3R ltR tR t	R t
]R 4       t]P                  R 4       t]R	 4       t]P                  R
 4       tR tR tRtV tR# )ÚReportEventStackaÛ  Context Manager for using :py:func:`report_event`

This enables calling :py:func:`report_start_event` and
:py:func:`report_finish_event` through a context manager.

:param name:
    the name of the event

:param description:
    the event's description, passed on to :py:func:`report_start_event`

:param message:
    the description to use for the finish event. defaults to
    :param:description.

:param parent:
:type parent: :py:class:ReportEventStack or None
    The parent of this event.  The parent is populated with
    results of all its children.  The name used in reporting
    is <parent.name>/<name>

:param reporting_enabled:
    Indicates if reporting events should be generated.
    If not provided, defaults to the parent's value, or True if no parent
    is provided.

:param result_on_exception:
    The result value to set if an exception is caught. default
    value is FAIL.

:param post_files:
    Can hold filepaths of files that are to get posted/created
    regarding a given event. Something like success or failure information
    in a given log file. For each filepath, if it's a valid regular file
    it will get: read & encoded as base64 at the close of the event.
    Default value, if None, is an empty list.
Nc                óZ  € W@n         Wn        W n        W0n        W`n        \
        P                  V n        R V n        Vf   . pWpn	        Vf   V'       d   VP                  pMRpWPn
        V'       d$   RP                  VP                  V34      V n        MV P                  V n        / V n        R # )NTÚ/)Úparentr   r"   ÚmessageÚresult_on_exceptionr:   rF   r7   Ústart_timestampr8   Úreporting_enabledÚjoinÚfullnameÚchildren)r   r   r"   rc   rb   rf   rd   r8   s   &&&&&&&&r   r&   ÚReportEventStack.__init__Ù   s›   € ð ŒØŒ	Ø&ÔØŒØ#6Ô Ü—n‘nˆŒØ#ˆÔØÒØˆJØ$Œð Ò$ßØ$*×$<Ñ$<Ñ!à$(Ð!Ø!2ÔçØŸH™Hà—O‘OØðóˆD�Mð !ŸI™IˆDŒMØˆŽr   c                ó\   € R V P                   : RV P                  : RV P                  : R2# )zReportEventStack(z, z, reporting_enabled=Ú))r   r"   rf   r*   s   &r   Ú__repr__ÚReportEventStack.__repr__  s%   � à�IŒIØ×ÔØ×"Ô"ð
ð 	
r   c                ó2  € \         P                  V n        \        P                  ! 4       V n        V P                  '       d!   \        V P                  V P                  4       V P                  '       d$   RV P                  P                  V P                  &   V # )N)NN)r:   rF   r7   r$   Ú	monotonicre   rf   r]   rh   r"   rb   ri   r   r*   s   &r   Ú	__enter__ÚReportEventStack.__enter__  sb   € Ü—n‘nˆŒÜ#Ÿ~š~Ó/ˆÔØ×!×!Ð!Ü˜tŸ}™}¨d×.>Ñ.>Ô?Ø�;�;ˆ;Ø.:ˆD�K‰K× Ñ  §¡Ñ+Øˆr   c                óú   € \         P                  \         P                  3 F@  pV P                  P	                  4        F  w  pw  r4W18X  g   K  W0P
                  3u u # 	  KB  	  V P                  V P
                  3# r    )r:   ÚFAILÚWARNri   rJ   rc   r7   )r   Úcand_resultÚ_nameÚvalueÚ_msgs   &    r   Ú_childrens_finish_infoÚ'ReportEventStack._childrens_finish_info  s_   € Ü"ŸK™K¬¯©Ó5ˆKØ(,¯©×(;Ñ(;Ö(=Ñ$�‘}˜ØÖ'Ø!§<¡<Ð0Ô0ó )>ñ 6ð —‘˜TŸ\™\Ð*Ð*r   c                ó   € V P                   # r    )Ú_resultr*   s   &r   r7   ÚReportEventStack.result  s   € à�|‰|Ðr   c                óL   € V\         9  d   \        R V,          4      hWn        R# )z'%s' not a valid resultN)r:   r;   r}   ©r   rx   s   &&r   r7   r~     s    € àœÔÜÐ6¸Õ>Ó?Ð?ØŽr   c                óN   € V P                   e   V P                   # V P                  # r    )Ú_messager"   r*   s   &r   rc   ÚReportEventStack.message"  s"   € à�=‰=Ò$Ø—=‘=Ð Ø×ÑÐr   c                ó   € Wn         R # r    )r‚   r€   s   &&r   rc   rƒ   (  s   € àŽr   c                ób   € V'       d   V P                   V P                  3# V P                  4       # r    )rd   rc   rz   )r   Úexcs   &&r   Ú_finish_infoÚReportEventStack._finish_info,  s)   € çØ×,Ñ,¨d¯l©lÐ;Ð;Ø×*Ñ*Ó,Ð,r   c                óv  € V P                  V4      w  rEV P                  '       d%   WE3V P                  P                  V P                  &   V P                  '       d^   V P
                  e(   \        P                  ! 4       V P
                  ,
          pMRp\        V P                  VVVV P                  R7       R # R # )Ng        )r9   r7   r8   )r‡   rb   ri   r   rf   re   r$   rp   rZ   rh   r8   )r   Úexc_typeÚ	exc_valueÚ	tracebackr7   Úmsgr9   s   &&&&   r   Ú__exit__ÚReportEventStack.__exit__2  s�   € Ø×)Ñ)¨)Ó4‰ˆØ�;�;ˆ;Ø/5¨mˆD�K‰K× Ñ  §¡Ñ+Ø×!×!Ð!Ø×#Ñ#Ò/ÜŸ>š>Ó+¨d×.BÑ.BÕB‘à�ÜØ—‘ØØ!ØØŸ?™?÷ñ "r   )r‚   r}   ri   r"   rh   rc   r   rb   r8   rf   r7   rd   re   )r   r   r   r   r0   r:   rt   r&   rm   rq   rz   Úpropertyr7   Úsetterrc   r‡   rŽ   r   r   r   s   @r   r_   r_   ²   sœ   ø‡ € ñ$ðT ØØØ"ŸK™KØô&òP
òò+ð ñó ðð ‡]�]ñó ðð
 ñ ó ð ð
 ‡^�^ñó ðò-÷ð r   r_   c           
      óì  € V '       g   R # . pV  F»  p\         P                  P                  V4      '       g   R pMy\        P                  ! RV 24      ;_uu_ 4        \        VR4      ;_uu_ 4       p\        P                  ! VP                  4       4      P                  4       pR R R 4       R R R 4       VP                  RVRXRR/4       K½  	  V#   + '       g   i     L5; i  + '       g   i     L@; i)NzReading ÚrbÚpathÚcontentÚencodingÚbase64)Úosr”   Úisfiler   ÚTimedÚopenr—   Ú	b64encodeÚreadÚdecodeÚappend)rA   ÚretÚfnamer•   Úfps   &    r   rC   rC   D  s¶   € ßÙØ
€CÛˆÜ�w‰w�~‰~˜e×$Ò$Ø‰Gä×"Ò" X¨e¨WÐ#5×6Õ6¼Ø�t÷9ô 9àÜ ×*Ò*¨2¯7©7«9Ó5×<Ñ<Ó>�÷9×6ð 	�
‰
�F˜E 9¨g°zÀ8ÐLÖMñ ð €J÷9÷ 9ú×6×6ús$   ÁC#Á03CÂ#C#ÃC ÃC#Ã#C3)rF   ru   rt   r    ) r0   r—   ÚloggingÚos.pathr˜   r$   Útypingr   r	   r   Úcloudinit.reportingr   r   Úcloudinit.reporting.handlersr   r6   r\   r1   Ú	getLoggerr   ÚLOGÚsetr   r:   r   r3   rV   rF   rZ   r]   r_   rC   r   r   r   Ú<module>r«      s©   ðñ
ó Û Û Û Ý å !÷õ :àÐ ØÐ à"Ð Ø×Ò˜Ó!€ô<ˆsô <ñ 
Ð-Ó	.€÷!
ñ !
ôH$˜>ô $ôN%ðF �>‰>Øôò"÷Oñ Oôdr   