403Webshell
Server IP : 159.69.118.108  /  Your IP : 216.73.216.231
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ubuntu-4gb-fsn1-1 6.8.0-90-generic #91-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 18 13:53:54 UTC 2025 aarch64
User : root ( 0)
PHP Version : 8.2.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/cloudinit/reporting/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/cloudinit/reporting/__pycache__/events.cpython-312.pyc
�

��im&��$�dZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZmZddl
mZdZdZd	Zej$e�ZGd
�de�Zed�ZGd
�d�ZGd�de�Zdd�Zej6dfd�Zd�ZGd�d�Zd�Zy)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��eZdZd�Zy)�_namesetc�*�||vr|Std|z��)Nz%s not a valid value)�AttributeError)�self�names  �</usr/lib/python3/dist-packages/cloudinit/reporting/events.py�__getattr__z_nameset.__getattr__ s���4�<��K��3�d�:�;�;�N)�__name__�
__module__�__qualname__r�rrrrs��<rr)�SUCCESS�WARN�FAILc�(�eZdZdZedfd�Zd�Zd�Zy)�ReportingEventz"Encapsulation of event formatting.Nc�v�||_||_||_||_|�t	j�}||_y�N)�
event_typer�description�origin�time�	timestamp)rrrr r!r#s      r�__init__zReportingEvent.__init__,s9��%�����	�&���������	�	��I�"��rc�d�dj|j|j|j�S)z"The event represented as a string.z
{0}: {1}: {2})�formatrrr �rs r�	as_stringzReportingEvent.as_string<s*���%�%��O�O�T�Y�Y��(8�(8�
�	
rc�v�|j|j|j|j|jd�S)z&The event represented as a dictionary.�rr rr!r#r*r's r�as_dictzReportingEvent.as_dictBs3���I�I��+�+��/�/��k�k����
�	
r)rrr�__doc__�DEFAULT_EVENT_ORIGINr$r(r+rrrrr)s��,�$��
#� 
�
rrc�H��eZdZejdf�fd�	Zd�Z�fd�Z�xZS)�FinishReportingEventNc���tt|�t||�||_|�g}||_||_|tvrtd|z��y)NzInvalid result: %s)	�superr/r$�FINISH_EVENT_TYPE�result�
post_files�duration�status�
ValueError)rrr r5r3r4�	__class__s      �rr$zFinishReportingEvent.__init__Ns\���	�"�D�2��t�[�	
�������J�$��� ��
�����1�F�:�;�;� rc��dj|j|j|j|j|j
�S)Nz'{0}: {1}: {2}: {3} (duration: {4:.3f}s))r&rrr3r r5r's rr(zFinishReportingEvent.as_stringas:��8�?�?��O�O��I�I��K�K�����M�M�
�	
rc����tt|��}|j|d<t	|j
d�|d<|jrt|j�|d<|S)z'The event represented as json friendly.r3�r5�files)r1r/r+r3�roundr5r4�_collect_file_info)r�datar8s  �rr+zFinishReportingEvent.as_dictjsS����)�4�8�:������X�� �����2��Z���?�?�.�t���?�D��M��r)	rrrr6rr$r(r+�
__classcell__)r8s@rr/r/Ms#����~�~��
<�&
��rr/c��|si}tjj�D��chc]\}}||vr|��
}}}ttjj��}|D]!}t
|�|vr�|j|��#ycc}}w)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_eventrOts���"�!#��$6�#F�#F�#L�#L�#N� ��I�x��.�.�	� �� �(,�%�6�6�=�=�?�(�H��%����=�4�4�����e�$�%�� s�Bc�8�t|||||��}t|�S)zVReport a "finish" event.

    See :py:func:`.report_event` for parameter details.
    )r4)r/rO)�
event_name�event_descriptionr5r3r4rHs      r�report_finish_eventrS�s'��
!��%�x��J�
�E����rc�:�tt||�}t|�S)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_TYPErO)rQrRrHs   r�report_start_eventrV�s��
�+�Z�9J�K�E����rc��eZdZdZdddej
dfd�Zd�Zd�Zd�Z	e
d��Zejd��Ze
d	��Z
e
jd
��Z
d�Zd�Zy)
�ReportEventStackaKContext 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�T�||_||_||_||_||_t
j|_d|_|�g}||_	|�|r
|j}nd}||_
|r*dj|j|f�|_i|_
y|j|_i|_
y)NT�/)�parentrr �message�result_on_exceptionr6rr3�start_timestampr4�reporting_enabled�join�fullname�children)rrr r\r[r_r]r4s        rr$zReportEventStack.__init__�s��������	�&������#6�� ��n�n���#������J�$����$��$*�$<�$<�!�$(�!�!2�����H�H��O�O����D�M���
�!�I�I�D�M���
rc�V�d|j�d|j�d|j�d�S)NzReportEventStack(z, z, reporting_enabled=�))rr r_r's r�__repr__zReportEventStack.__repr__s%���I�I�����"�"�
�	
rc��tj|_tj�|_|jr t|j|j�|jr#d|jj|j<|S)N)NN)
r6rr3r"�	monotonicr^r_rVrar r[rbrr's r�	__enter__zReportEventStack.__enter__s]���n�n���#�~�~�/����!�!��t�}�}�d�.>�.>�?��;�;�.:�D�K�K� � ����+��rc���tjtjfD]>}|jj	�D]\}\}}||k(s�||j
fccS�@|j|j
fSr)r6rrrbrCr\r3)r�cand_result�_name�value�_msgs     r�_childrens_finish_infoz'ReportEventStack._childrens_finish_infoso��"�K�K����5�	1�K�(,�
�
�(;�(;�(=�
1�$��}��t��K�'�!�4�<�<�0�0�
1�	1����T�\�\�*�*rc��|jSr)�_resultr's rr3zReportEventStack.results���|�|�rc�>�|tvrtd|z��||_y)Nz'%s' not a valid result)r6r7rp�rrls  rr3zReportEventStack.results"������6��>�?�?���rc�J�|j�|jS|jSr)�_messager r's rr\zReportEventStack.message"s"���=�=�$��=�=� ����rc��||_yr)rtrrs  rr\zReportEventStack.message(s	����
rc�V�|r|j|jfS|j�Sr)r]r\rn)r�excs  r�_finish_infozReportEventStack._finish_info,s)����,�,�d�l�l�;�;��*�*�,�,rc�P�|j|�\}}|jr%||f|jj|j<|jrU|j
�"t
j�|j
z
}nd}t|j||||j��yy)Ng)r5r3r4)rxr[rbrr_r^r"rgrSrar4)r�exc_type�	exc_value�	tracebackr3�msgr5s       r�__exit__zReportEventStack.__exit__2s����)�)�)�4�
����;�;�/5�s�m�D�K�K� � ����+��!�!��#�#�/��>�>�+�d�.B�.B�B������
�
��!���?�?�
�"r)rrrr,r6rr$rerhrn�propertyr3�setterr\rxr~rrrrXrX�s���$�T���"�K�K��&�P
��+������]�]����
� �� �

�^�^����-�rrXc��|syg}|D]�}tjj|�sd}ngtjd|���5t|d�5}t
j|j��j�}ddd�ddd�|j|dd����|S#1swY�*xYw#1swY�.xYw)NzReading �rb�base64)�path�content�encoding)�osr��isfiler�Timed�openr��	b64encode�read�decode�append)r<�ret�fnamer��fps     rr>r>Ds�����
�C��N���w�w�~�~�e�$��G��"�"�X�e�W�#5�6�
?���t�9�
?�� �*�*�2�7�7�9�5�<�<�>��
?�
?�	�
�
�E�g�8�L�M�N��J�
?�
?��
?�
?�s$�
B9�2B-�B9�-B6�2B9�9C	r) r,r��logging�os.pathr�r"�typingrr
r�cloudinit.reportingrr�cloudinit.reporting.handlersrr2rUr-�	getLoggerr�LOG�setrr6rr/rOrrSrVrXr>rrr�<module>r�s���
������!��:�����"���g����!��<�s�<�
�-�	.��!
�!
�H$�>�$�N%�F�>�>���"�O�O�d
r

Youez - 2016 - github.com/yon3zu
LinuXploit