CasperSecurity

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

o

��Jh�*�@s�ddlmZmZmZmZmZmZmZddlm	Z	ddl
mZddlm
Z
ddlmZmZmZddlmZddlmZddlmZdd	lmZdd
lmZmZddlmZmZe� �Z!dd
�Z"dd�Z#e
j$dd��Z%e
j$dd��Z&edej'ej'e#eedej(dd�gd�gd�Z)edej*ej*e%eedej+j,d�-ej.�d�d�gd�gd�Z/edej0ej0e&eedej1j,d�-ej.�d�dd �gd�gd�Z2ed!ej3ej4e"ej5e)e/e2gd"�Z6d#S)$�)�apt_news�config�entitlements�event_logger�
exceptions�http�messages)�_is_attached)�
AptProxyScope)�cli_util)�ProArgument�ProArgumentGroup�
ProCommand)�HelpCategory)�ApplicationStatus)�state_files)�LXDGuestAttachEnum)�configure_livepatch_proxy�unconfigure_livepatch_proxy)�configure_snap_proxy�unconfigure_snap_proxycKsddlm}|��d�dS)Nr��
get_parserr)�uaclient.clir�print_help_for_command)�args�cfg�kwargsr�r�5/usr/lib/python3/dist-packages/uaclient/cli/config.py�
action_configsr cKs�|jr)|jtjvrtjd�|j�d�tj�d��tdj|jt||jd�d��dSt	t
dd	�tjD��d
�}d|d}tjD]}t|j|t||d�d��q@|jsV|jrc|j
s\|jrettj�dSdSdS)
z�Perform the 'config show' action optionally limit output to a single key

    :return: 0 on success
    :raise UbuntuProError: on invalid keys
    z'{}'�, ��arg�choicesz
{key} {value}N��key�valuercSsg|]}t|��qSr)�len)�.0�xrrr�
<listcomp>6sz&action_config_show.<locals>.<listcomp>�z{key: <z	} {value})r&r�UA_CONFIGURABLE_KEYSr�InvalidArgChoice�format�join�print�getattr�str�max�global_apt_http_proxy�global_apt_https_proxy�ua_apt_http_proxy�ua_apt_https_proxyr�CLI_CONFIG_GLOBAL_XOR_UA_PROXY)rrr�	col_width�row_tmplr&rrr�action_config_show#s.

���
���r<c
Ksvddlm}|�}z
|j�d�\}}Wnty'|�d�tjd|jd��w|tj	vr=|�d�tj
dd�tj	�d	��|��sL|�d�tj
|d
��tt||d��tkri|��dvrctj
d
dd	��|��dk}|dvr�|�d�d}|dkr|tj}ntj}t�|||�||i}td#i|��tj�|�}	|	��\}
}|
tjkr�td#i|���n||jvr�|�d�d}|dkr�tj}ntj }t�|||�t|j!p�|j"�}|r�t#t$j%j&ddd��t'�(|t)j*||�d|_!d|_"n�||j+|j,v�rQd|vr�dnd}|dk�rtj}ntj }||j+v�r$t#t$j-j&d�&|�d�&|�d��d|}t�|||�t|j.�p2|j/�}|�rAt#t$j%j&ddd��t'�(|t)j0||�d|_.d|_/nb|dv�r�zt1|�}|dk�rgtd�&|���WnJt�y�|�d�t#d�tj2||d��w|d k�r�|�r�t3�4|�n$t5j6�7�n|d!k�r�t8|�j9�s�t�:��t5j;�<t5j=t>�?|���d"��t@|||�dS)$zMPerform the 'config set' action.

    @return: 0 on success, 1 otherwise
    rr�=z
config setz
<key>=<value>)�expected�actual�<key>r!r")r#N)�true�falsez<value>ztrue, falserA��
http_proxy�https_proxy�_r�zpro scoped aptz
global apt)�
current_proxy�previous_proxy�https�apt_{}_proxy�global_apt_{}_proxy��old�new�global_)�update_messaging_timer�metering_timerzInvalid interval for {}�r%r�lxd_guest_attach��guest_attachr)Arr�key_value_pair�split�
ValueErrorrr�GenericInvalidFormatrr-r.r0�strip�EmptyConfigValue�typer2�bool�lowerr�PROXY_VALIDATION_SNAP_HTTP_URL�PROXY_VALIDATION_SNAP_HTTPS_URL�validate_proxyrr�	livepatch�LivepatchEntitlement�application_statusr�ENABLEDr�ua_scoped_proxy_options�PROXY_VALIDATION_APT_HTTP_URL�PROXY_VALIDATION_APT_HTTPS_URLr5r6r1r�WARNING_APT_PROXY_OVERWRITEr/r�configure_apt_proxyr
�UACLIENT�&deprecated_global_scoped_proxy_options�global_scoped_proxy_options�WARNING_CONFIG_FIELD_RENAMEr7r8�GLOBAL�int�InvalidPosIntConfigValuer�update_apt_newsr�apt_news_contents_file�deleter	�is_attached�UnattachedError�lxd_pro_config_file�write�LXDProConfigr�
from_value�setattr)
rrrr�parser�set_key�	set_value�
protocol_type�validate_url�entitlement�livepatch_statusrF�
unset_currentrrr�action_config_setBs�
��

�
�
�

���
���
����
�

�
��

��r�c	KsXddlm}|jtjvr|�}|�d�tjdd�tj�d��|jdvrH|j�	d�d}t
|d	�tj�
|�}|��\}}|tjkrGt|d	�n[|j|jvrYt�|tj|jd
�nJ|j|j|jvr�|j|jvr�d|jvrodnd}t�tjjd
�|�d�|�d��d|j|_t�|tj|jd
�n|jdkr�tj �!tj"t#j$d��t%||jd
�dS)zOPerform the 'config unset' action.

    @return: 0 on success, 1 otherwise
    rrzconfig unsetr@r!r"rCrF)r�NrJrrKrLrMrPrTrU)&rrr&rr-rrr.r0rXrrrcrdrerrfrrgrrkr
rlrmrn�event�inforror/rprrxryrzr�OFFr|)	rrrrr}r�r�r�rFrrr�action_config_unset�sP
�



������
�r��showr&�?)�help�nargs)�	arguments)r��description�action�argument_groups�setrWr!)�options)r��unset)r��metavarr)r�r�r��
help_category�subcommandsN)7�uaclientrrrrrrr�(uaclient.api.u.pro.status.is_attached.v1r	�uaclient.aptr
rr�uaclient.cli.commandsrr
r�uaclient.cli.parserr�(uaclient.entitlements.entitlement_statusr�uaclient.filesr�uaclient.files.user_config_filer�uaclient.livepatchrr�
uaclient.snaprr�get_event_loggerr�r r<�assert_rootr�r��CLI_CONFIG_SHOW_DESC�CLI_CONFIG_SHOW_KEY�show_subcommand�CLI_CONFIG_SET_DESC�CLI_CONFIG_SET_KEY_VALUEr/r0r-�set_subcommand�CLI_CONFIG_UNSET_DESC�CLI_CONFIG_UNSET_KEY�unset_subcommand�CLI_ROOT_CONFIG�CLI_CONFIG_DESC�OTHER�config_commandrrrr�<module>s�$	

0�����
������
������
�
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