CasperSecurity

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

o

��Jh�*�@s�ddlZddlZddlZddlmZmZmZddlmZm	Z	m
Z
mZmZm
Z
mZmZddlmZddlmZmZddlmZddlmZddlmZmZmZdd	lmZdd
lm Z e�!�Z"e�#e�$e%��Z&dej'de(d
eedee(de(de(fdd�Z)dd�dd�Z*ej+ej,e�-ej.�e�/d�dd�����Z0ede
j1e
j2e0ej3eede
j4j5d�6e
j7e�'�d��d�ddd �ed!e
j8j5dd"�d#d$�ed%e
j9j5d&d'�dd&d(gd&d)�ed*e
j:d#d$�gd+�gd,�Z;dS)-�N)�Any�Dict�List)�config�contract�entitlements�event_logger�
exceptions�messages�status�util)�ProgressWrapper)�ServiceWithDependencies�
_dependencies)�_enabled_services)�cli_util)�ProArgument�ProArgumentGroup�
ProCommand)�HelpCategory)�CanDisableFailure�cfg�service�all_dependencies�enabled_service_names�called_name�
service_titlecCs�g}|D]}|j|ks|j|vrq|jD]
}|j|kr!|�|j�qq|D]}	t�||	�}
tjj||
d�}tj	|d�sBt
j||
d��q%dS)N)�service_being_disabled�dependent_service)�msg)�name�
depends_on�appendr�	get_titler
�DEPENDENT_SERVICE�formatr�prompt_for_confirmationr	�DependentServiceStopsDisable)rrrrrr�dependent_services�s�requirementr�dependent_service_title�user_msg�r-�6/usr/lib/python3/dist-packages/uaclient/cli/disable.py�prompt_for_dependency_handlings0

�������r/T)�
update_statusc	Cs�|j}|dur	|}|rt�}nttj|d��}|�|�\}}|sIt�|j�|durHt|t	�rH|j
durHt�|j
j�tj
|j
j|j
j|jd�nt�|j�|rWtj|d�|S)aPerform the disable action on a named entitlement.

    :param entitlement_name: the name of the entitlement to enable
    :param cfg: the UAConfig to pass to the entitlement
    :param json_output: output should be json only

    @return: True on success, False otherwise
    N��
assume_yes)�	error_msg�
error_coder�r)�enabled_variantr
r�CLIEnableDisableProgress�disable�event�service_failedr �
isinstancer�message�infor�error�service_processedr)	�entitlementr�json_outputr2r0�variant�progress�ret�reasonr-r-r.�perform_disable>s0

�
��rFzpro disablecKsfg}g}g}g}tjddd�}|jdk}|j}	t�|�}
|jr(|	r(tjddd��t	|dg�}t
�||�\}}
d	d
�t|�j
D�}t|�j}d}|D]�}t
j|||jd�}|j}|d
ur]|}|	s�zt||j||||jd�Wn)tjy�}zt�|�|
|j�|
tjj|jd��d}WYd
}~qId
}~ww|r�t�}nttj|	d��}|��|_zT|�|�\}}t j |d�|s�d}|�!|�|d
ur�t"|t#�r�|j$d
ur�|
|j$j�|�!d|j|j$j|j$jd��n|�!|�|�%�}|r�d|d<|
tj&jdd��WqItj�y7}z+d}|�!|�|
|j�|
tj'j|jd��|�!d|j|j|j(|j)d��WYd
}~qId
}~ww|
�rtd}dd�*t
j+|d��d}d�*t,j-|dddd��}tj.dd�*|
�|d�}|
|j�|�!dd
|j|j(|j)d��t/�0|�}|�1�|�r�|�2�|�2�|�r�dnd |d!<||d"<||d#<||d$<||d%<t3t4j5|t6j7dd&��|�r�d'Sd(S))zbPerform the disable action on a list of entitlements.

    @return: 0 on success, 1 otherwise
    �successF)�_schema_version�result�needs_reboot�json�--purge�--assume-yes)�option1�option2rcSsg|]}|j�qSr-)r )�.0r)r-r-r.�
<listcomp>�s�z"action_disable.<locals>.<listcomp>T)rr �purgeN)rr)�titler1r5)�typerr<�message_coderJzdisable operation)�	operation)rTrr<rU�additional_infozTry �, �.�
�P)�width�break_long_words�break_on_hyphensr8)rV�invalid_service�service_msg�system�failurerI�processed_services�failed_services�errors�warnings)�cls�	sort_keysr�)8r�JSON_SCHEMA_VERSIONr%r2r�&create_interactive_only_print_functionrRr	�InvalidOptionCombination�getattrr�get_valid_entitlement_namesr�enabled_servicesr�services�entitlement_factoryr6r/r rS�UbuntuProError�LOG�	exceptionrr
�
ENABLE_FAILEDr
r7�calculate_total_disable_steps�total_stepsr8rr"r;rr<�_check_for_reboot�ENABLE_REBOOT_REQUIRED_TMPL�DISABLE_FAILED_TMPL�msg_coderW�join�valid_services�textwrap�wrap�InvalidServiceOpErrorr�UAContractClient�update_activity_token�sort�printrK�dumpsr�DatetimeAwareJSONEncoder)�argsr�kwargsrcrdrerf�
json_responserAr2�interactive_only_print�names�entitlements_found�entitlements_not_foundrrrD�ent_name�entrB�erC�disable_retrE�ent_reboot_required�valid_namesr`�err�contract_clientr-r-r.�action_disablels0	�
�
�
��
�
�

���	
�


�
���
	���

���������
��

��r�r8rXr5)�options�store�+)�help�action�nargsrM)�command�
store_true)r�r�z--format�cli)�defaultrK)r�r��choicesr�rL)�	arguments)r��descriptionr��
help_category�argument_groups)<rK�loggingr~�typingrrr�uaclientrrrrr	r
rr�uaclient.apir
�+uaclient.api.u.pro.services.dependencies.v1rr�-uaclient.api.u.pro.status.enabled_services.v1r�uaclient.clir�uaclient.cli.commandsrrr�uaclient.cli.parserr�(uaclient.entitlements.entitlement_statusr�get_event_loggerr9�	getLogger�replace_top_level_logger_name�__name__rs�UAConfig�strr/rF�verify_json_format_args�assert_root�assert_attached�&_raise_enable_disable_unattached_error�assert_lock_filer��CLI_ROOT_DISABLE�CLI_DISABLE_DESC�OTHER�CLI_DISABLE_SERVICEr%r|r}�CLI_ASSUME_YES�CLI_FORMAT_DESC�	CLI_PURGE�disable_commandr-r-r-r.�<module>s�(
�����
� �.
6���
������
�
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