CasperSecurity

Current Path : /lib/python3/dist-packages/uaclient/clouds/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/uaclient/clouds/__pycache__/lxd.cpython-310.pyc

o

��Jh,
�@sdddlZddlmZmZmZmZmZmZddlm	Z	e�
e�e��Z
dZdZdZGdd�de	�ZdS)	�N)�config�
exceptions�http�log�secret_manager�util)�AutoAttachInstancez
/dev/lxd/sockz/1.0/ubuntu-proz/1.0/ubuntu-pro/tokenc@sReZdZedefdd��Zdefdd�Zdedefdd�Zd	ej	de
fd
d�ZdS)
�LXDAutoAttachInstance�returncC�dS)NT���selfrr�5/usr/lib/python3/dist-packages/uaclient/clouds/lxd.py�	is_viableszLXDAutoAttachInstance.is_viablecCr)zSYes, but only once - is_pro_license_present doesn't
        support wait_for_changeTrr
rrr�should_poll_for_pro_licensesz1LXDAutoAttachInstance.should_poll_for_pro_license�wait_for_changecCsh|rt���t�tdt�}|jdkr"tjdt	j
|j|jd�d�dS|j�
dd�d	kr2t�d
�dSdS)N�GET��z4LXD instance API returned error for ubuntu-pro query)�code�body)�extraF�guest_attach�off�onzNguest_attach config is not turned on. The machine will not try to auto-attach.T)r�CancelProLicensePollingr�unix_socket_request�LXD_INSTANCE_API_SOCKET_PATH�$LXD_INSTANCE_API_ENDPOINT_UBUNTU_PROr�LOG�errorrrr�	json_dict�get�info)rr�resprrr�is_pro_license_presents&�
��z,LXDAutoAttachInstance.is_pro_license_present�cfgcCsvt�tdt�}|jdkrt���|jdkrt���|jdkr,tj|jd�	tt�|j
d��|j�dd�}t
j�|�|S)	z{
        Cloud-specific implementation of acquiring the pro token using whatever
        method suits the platform
        �POSTi�i�rzunix://{}{})r�urlr�guest_token�)rrr�0LXD_INSTANCE_API_ENDPOINT_UBUNTU_PRO_GUEST_TOKENrr�LXDAutoAttachNotAvailable�LXDAutoAttachNotAllowed�ExternalAPIError�formatrr!r"r�secrets�
add_secret)rr&r$r)rrr�acquire_pro_token1s*�


��z'LXDAutoAttachInstance.acquire_pro_tokenN)�__name__�
__module__�__qualname__�property�boolrrr%r�UAConfig�strr2rrrrr	
sr	)�logging�uaclientrrrrrr�uaclient.cloudsr�	getLogger�replace_top_level_logger_namer3rrrr+r	rrrr�<module>s 
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY