AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/cloudinit/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/cloudinit/__pycache__/socket.cpython-310.pyc
o

x[h��@srdZddlZddlZddlZddlZddlmZddlmZddl	m
Z
e�e�Z
defdd�ZGd	d
�d
�ZdS)z#A module for common socket helpers.�N)�suppress)�performance)�DEFAULT_RUN_DIR�messagecCs�tj�dd�}|sdS|ddkr|�ddd�n
|ddkr#td	��t�tjtjtjB��}t	�
d
t|��|�|�|�
|�d��Wd�dS1sOwYdS)z[Send a sd_notify message.

    :param message: sd-notify message (must be valid ascii)
    �
NOTIFY_SOCKET�Nr�@���/zUnsupported socket typezSending sd_notify(%s)�ascii)�os�environ�get�replace�OSError�socket�AF_UNIX�
SOCK_DGRAM�SOCK_CLOEXEC�LOG�info�str�connect�sendall�encode)r�socket_path�sock�r�2/usr/lib/python3/dist-packages/cloudinit/socket.py�	sd_notifys�
"�r c@s<eZdZdZdefdd�Zdefdd�Zdd	�Zd
d�ZdS)
�
SocketSyncz<A two way synchronization protocol over Unix domain sockets.�namesc	Gs�d|_d|_d|_d|_d|_dd�|D�|_tjt�d�ddd	�|j�	�D]*\}}t�d
|�d�}t
t��
t�|�Wd�n1sGwY|�
|�q'dS)
anInitialize a synchronization context.

        1) Ensure that the socket directory exists.
        2) Bind a socket for each stage.

        Binding the sockets on initialization allows receipt of stage
        "start" notifications prior to the cloud-init stage being ready to
        start.

        :param names: stage names, used as a unique identifiers
        rrFcSs$i|]}|t�tjtjtjB��qSr)rrrr)�.0�namerrr�
<dictcomp>>s���z'SocketSync.__init__.<locals>.<dictcomp>z/sharei�T)�mode�exist_ok�/share/z.sockN)�stage�remote�first_exception�systemd_exit_code�experienced_any_error�socketsr
�makedirsr�itemsr�FileNotFoundError�remove�bind)�selfr"r$rrrrr�__init__-s �
��zSocketSync.__init__r)cCs"||jvrtd|����||_|S)a�Set the stage before entering context.

        This enables the context manager to be initialized separately from
        each stage synchronization.

        :param stage: the name of a stage to synchronize

        Example:
            sync = SocketSync("stage 1", "stage 2"):
            with sync("stage 1"):
                pass
            with sync("stage 2"):
                pass
        zInvalid stage name: )r.�
ValueErrorr))r4r)rrr�__call__Ms
zSocketSync.__call__cCs�t�tj���rt�d�dSd|_td|j	�d��|j
|j	}t�d|j	����|�
d�\}|_Wd�n1s=wYd|krW|�ddd�td	t|��d
���t�d|j	�d�t|j�krt|�ddd�td
|j����td|j	�d��|S)z�Wait until a message has been received on this stage's socket.

        Once the message has been received, enter the context.
        z:Stdin is a tty, so skipping stage synchronization protocolNrzDSTATUS=Waiting on external services to complete before starting the z stage.zWaiting to start stage �sstartzReceived invalid message: [�]r(z-return.sockz Unexpected path to unix socket: zSTATUS=Running (z stage))r
�isatty�sys�stdin�filenorrr,r r)r.r�Timed�recvfromr*�__exit__r6rr)r4r�chunkrrr�	__enter__as2���	��zSocketSync.__enter__cCs�d|j��}|r,d|_d|_t|��d|j��}d}|js ||_t�|�td|���|jp3t	|j�|_|j
|j}|�|j�|�
d|�d|j�d	����|��dS)
z.Notify the socket that this stage is complete.z,Completed socket interaction for boot stage r
Tz in zkfatal error, run "systemctl status cloud-init-main.service" and "cloud-init status --long" for more detailszSTATUS=zecho 'z'; exit �;)r)r,r-�repr�tb_framer+r�fatalr �boolr.rr*rr�close)r4�exc_type�exc_val�exc_tbr�statusrrrrr@�s*�
��zSocketSync.__exit__N)	�__name__�
__module__�__qualname__�__doc__rr5r7rBr@rrrrr!*s 'r!)rP�loggingr
rr;�
contextlibr�	cloudinitr�cloudinit.settingsr�	getLoggerrMrrr r!rrrr�<module>s


Anon7 - 2022
AnonSec Team