Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.52 (Ubuntu)
System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64
User : www-data ( 33)
PHP Version : 8.1.2-1ubuntu2.21
Disable Function : NONE
Directory :  /lib/python3/dist-packages/cloudinit/sources/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

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

}��f(#�@s`ddlZddlmZmZmZmZmZmZddlm	Z	e�
e�ZdZ
dZdZdZdZd	ZGd
d�dej�ZeejejffgZdd
�Ze
eeeefdd�Ze
eeeefdd�Zedkr�ddlZejdd�Zejddde
d�ejddded�ejddeded�ejd ded!ed�ejd"d#ed$ed�e� �Z!ee!j"e!j#e!j$e!j%e!j&d%�Z'e(e�)e'��dSdS)&�N)�
atomic_helper�dmi�helpers�sources�
url_helper�util)�ec2zhttp://169.254.169.254z1.0i��
��ExoscalecsXeZdZdZdZ�fdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
edd��Z�Z
S)�DataSourceExoscaler�xcs|tt|��|||�t�d�|j�dt�|_|j�dt	�|_
t|j�dt��|_
|j�dt�|_|j�dt�|_i|_dS)Nz$Initializing the Exoscale datasource�metadata_url�api_version�password_server_port�timeout�retries)�superr�__init__�LOG�debug�ds_cfg�get�METADATA_URLr�API_VERSIONr�int�PASSWORD_SERVER_PORTr�URL_TIMEOUT�url_timeout�URL_RETRIES�url_retries�extra_config)�self�sys_cfg�distro�paths��	__class__��F/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceExoscale.pyrs
�
zDataSourceExoscale.__init__cCs<d}|j�d�}t�|�}|�d|d�rt�d�dSdS)z<Adjust set_passwords module to run 'always' during each boot�
set_passwords�sem�config_Nz5Overriding module set_passwords with frequency always)r%�
get_ipath_curr�FileSemaphores�clearrr)r"�cfg�is_new_instance�mod�sem_path�
sem_helperr(r(r)�activate*s	
�zDataSourceExoscale.activatecCs6d�|j|j�}tj|g|j|jtjd�\}}t	|�S)z.Wait for the metadata service to be reachable.z{}/{}/meta-data/instance-id)�urls�max_waitr�	status_cb)
�formatrrr�wait_for_url�url_max_waitrr�critical�bool)r"r�url�	_responser(r(r)�wait_for_metadata_service9s�
�z,DataSourceExoscale.wait_for_metadata_servicecCs6tjtjd|jd�}|siSt|j|j|j|j	|j
�S)zw
        Crawl the metadata service when available.

        @returns: Dictionary of crawled metadata content.
        z waiting for the metadata service��logfunc�msg�func)r�log_timer�infor@�
read_metadatarrrrr )r"�metadata_readyr(r(r)�crawl_metadataIs��z!DataSourceExoscale.crawl_metadatacCshtjtjd|jd�}|sdS|d|_|d|_|�d�}i}|r)d|ddid	�}t�|j	|g�|_	dS)
z�Fetch the user data, the metadata and the VM password
        from the metadata service.

        Please refer to the datasource documentation for details on how the
        metadata server and password server are crawled.
        zCrawl of metadata servicerAF�	user-data�	meta-data�passwordT�expire)�
ssh_pwauthrL�chpasswd)
rrErrrI�userdata_raw�metadatar�
mergemanydictr!)r"�datarL�password_configr(r(r)�	_get_data`s*�


��	�zDataSourceExoscale._get_datacCs|jS�N)r!)r"r(r(r)�get_config_obj�sz!DataSourceExoscale.get_config_objcCst�d��t�S)Nzsystem-product-name)r�
read_dmi_data�
startswith�EXOSCALE_DMI_NAMEr(r(r(r)�	ds_detect�s
�zDataSourceExoscale.ds_detect)�__name__�
__module__�__qualname__�dsnamer;rr5r@rIrUrW�staticmethodr[�
__classcell__r(r(r&r)rs
+rcCst�|t�SrV)r�list_from_depends�datasources)�dependsr(r(r)�get_datasource_list�srecCsZd�|||�}tj|dddi||d�}|j�d�}|dvrdStj|dddi||d�|S)	z�Obtain the VM's password if set.

    Once fetched the password is marked saved. Future calls to this method may
    return empty string or 'saved_password'.z	{}:{}/{}/N�DomU_Request�send_my_password)�ssl_details�headersrrzutf-8)��saved_passwordrk)r9r�read_file_or_url�contents�decode)rrrrr �password_url�responserLr(r(r)�get_password�s*���rqc
Cs�i}||d<ztj||||d�|d<tj||||d�|d<Wnty:}zt�td||�iWYd}~Sd}~wwzt|||||d�|d<W|Stye}zt�td	|||�WYd}~|Sd}~ww)
z8Query the metadata server and return the retrieved data.�_metadata_api_version)rrrJrKz(failed reading from metadata url %s (%s)N)rrrr rrLz2failed to read from password server url %s:%s (%s))r�get_instance_userdata�get_instance_metadata�	Exceptionr�logexcrrq)rrrrr �crawled_metadata�er(r(r)rG�sH
����������rG�__main__zQuery Exoscale Metadata)�descriptionz
--endpoint�URLz The url of the metadata service.)�metavar�help�defaultz	--version�VERSIONz.The version of the metadata endpoint to query.z	--retries�NUMz,The number of retries querying the endpoint.)r|�typer}r~z	--timeoutz.The time in seconds to wait before timing out.z--password-port�PORTz/The port on which the password endpoint listens)rrrrr )*�logging�	cloudinitrrrrrr�cloudinit.sources.helpersr�	getLoggerr\rrrrrrrZ�
DataSourcer�DEP_FILESYSTEM�DEP_NETWORKrcrerqrG�argparse�ArgumentParser�parser�add_argumentr�
parse_args�args�endpoint�version�
password_portrrrS�print�
json_dumpsr(r(r(r)�<module>s� 
�
�'
�+�������

Spamworldpro Mini