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/uaclient/cli/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/uaclient/cli/__pycache__/enable.cpython-310.pyc
o

���f�B�@sddlZddlZddlmZmZmZmZmZddlm	Z	m
Z
mZmZm
Z
mZmZmZmZmZddlmZmZddlmZmZmZddlmZmZddlmZddlm Z m!Z!e�"e�#e$��Z%ed	d
e&fde&fdeee'effg�Z(	d,d
e
j)de&dee	j*fdd�Z+d
e
j)de'deedeede'de'de'fdd�Z,de&dee'efdee'dee'deee'efdeee'efd
e&fd d!�Z-d
e
j)d"e'de'de&d#e&de&d$eee'deedeed%e(fd&d'�Z.e j/e j0e �1e j2�d%e3fd(d)����Z4d
e
j)fd*d+�Z5dS)-�N)�Any�Dict�List�
NamedTuple�Optional)
�api�config�contract�entitlements�event_logger�
exceptions�lock�messages�status�util)�ServiceWithDependencies�
_dependencies)�
EnableOptions�EnableResult�_enable)�EnabledService�_enabled_services)�_is_attached)�cli_util�	constants�_EnableOneServiceResult�success�needs_reboot�error�cfg�access_only�progress_objectc

Cs�t�|�}tj|d||d�}d}d}z tjdd��|j|d�\}}Wd�n1s,wYWntyD}zt��|�d}~ww|s^|durT|j	durT|j	}	nt
j}	tj
d|	d��tdggdgd	�S)
a
    Landscape gets special treatment because it currently not supported by our
    enable API. This function is a temporary workaround until we have a proper
    API for enabling landscape, which will happen after Landscape is fully
    integrated with the contracts backend.
    �	landscape)�called_namer �
extra_argsFNzcli.enable._enable_landscape)�lock_holder)�progress)�service�reason)�enabled�disabled�reboot_requiredr)r�ProgressWrapperr
�LandscapeEntitlementr
�	RetryLock�enable�	Exception�clear_lock_file_if_present�messager�GENERIC_UNKNOWN_ISSUEr�EntitlementNotEnabledErrorr)
rr r$r!r&r"r�fail_reason�er(�r7�5/usr/lib/python3/dist-packages/uaclient/cli/enable.py�_enable_landscape-s>
�������
�r9r'�all_dependencies�enabled_servicesr#�variant�
service_titlecs�g}g}dd�|D��t�fdd�|D�d�}	|	dur/�fdd�|	jD�}�fdd�|	jD�}|D]'}
tj|jdd�}t�||
�}tj	j
||d	�}
|sQtj|
d
�sXtj
||d	��q1|D]}t�||�}tjj
||d�}
tj|
d
�sxtj||d��q[t��fdd�|D�d�}|dur��dur�t�|���}t�|�|j�}tj|jdd�}tj	j
||d	�}
|s�tj|
d
�s�tj
||d	��dSdSdS)
NcSsg|]}|j�qSr7��name��.0�sr7r7r8�
<listcomp>dsz2prompt_for_dependency_handling.<locals>.<listcomp>c3s�|]
}|j�kr|VqdS�Nr>r@)r'r7r8�	<genexpr>gs�z1prompt_for_dependency_handling.<locals>.<genexpr>csg|]
}|j�vr|j�qSr7r>r@��enabled_service_namesr7r8rCj�

�csg|]
}|j�vr|j�qSr7r>r@rFr7r8rCorHz features.block_disable_on_enable)r�
path_to_value)�service_being_enabled�incompatible_service)�msg)rJ�required_servicec3s.�|]}|j�kr|jr|j�kr|VqdSrD�r?�variant_enabled�variant_namer@)r'r<r7r8rE�s�
�
��)�next�incompatible_with�
depends_onr�is_config_value_truerr
�	get_titler�INCOMPATIBLE_SERVICE�format�prompt_for_confirmationr�IncompatibleServiceStopsEnable�REQUIRED_SERVICE�RequiredServiceStopsEnablerP)rr'r:r;r#r<r=�incompatible_services�required_services�dependenciesrK�cfg_block_disable_on_enable�incompatible_service_title�user_msgrM�required_service_titlerO�to_be_enabled_title�enabled_variant_titler7)rGr'r<r8�prompt_for_dependency_handlingYs�	�
�
������������
������
re�json_output�
json_response�processed_services�failed_services�errors�warningscCsb|r/|��|��|rdnd|d<||d<||d<||d<||d<ttj|tjdd	��dSdS)
Nr�failure�resultrhrirjrkT)�cls�	sort_keys)�sort�print�json�dumpsr�DatetimeAwareJSONEncoder)rfrgrhrirjrkrr7r7r8�_print_json_output�s 	���ru�ent_name�
assume_yesr$�returnc	s�t�|�}	tj||�||d�}
|
j�|
j}t��fdd�|D�d�}|durItjj	|d�}
|	|
j
�|	tjj	|d��tddd||
j
|
jd�d�S|s�z
t
|�|||�|d	�Wn-tjy�}z t�|�|	|j
�|	tjj	|d��tdddd�WYd}~Sd}~wwz_|r�d}ntj|d
�}�dkr�t||||d�}ntt|�|d
�||d�}tj|d�|r�|	tjj	|d��n	|	tjj	|d��|j}|r�|	tjj	dd��|jD]}|	|�q�td|dd�WStj�y$}z1|jd}|d}|d}|d}|	|�|	tjj	|d��tddd||||d�d�WYd}~Sd}~wtj�yU}z$|	|j
�|	tjj	|d��tddd||j
|j|jd�d�WYd}~Sd}~ww)N)r<r r$c3s2�|]}|j�kr�r|jr|j�kr|VqdSrDrNr@��	real_namer<r7r8rE�s�
��
��z&_enable_one_service.<locals>.<genexpr>)�titleFr')�typer'r2�message_code)rrr)r#r<r=)rwr")r$r!)r'r<r )r!�r�install)�	operationTr(�coder{�additional_info�r|r'r2r}r�)r�&create_interactive_only_print_functionr
�entitlement_factoryr?r{rQr�ALREADY_ENABLEDrWrL�
ENABLE_FAILEDrrer�UbuntuProError�LOG�	exception�CLIEnableDisableProgressr9rrr�ACCESS_ENABLED_TMPL�ENABLED_TMPLr+�ENABLE_REBOOT_REQUIRED_TMPLr4r��msg_code)rrvr<r rwrfr$r;r:�interactive_only_print�ent�	ent_title�already_enabledrLr6r&�
enable_resultrr2r(�err_code�err_msg�err_infor7ryr8�_enable_one_service�s���	�
��
�	

�������
����

�
���
����r�cKs(g}g}g}g}tjdd�}|jdk}t�|�}	t|dd�}
|j}|j}|
r/|r/tj	ddd��|	t
j�zt�
|�Wn!tjtjfy\tjd	d
d�|�dt
jjt
jjd
��Ynwt|�js�t��}
|	|
j�|�d|
j|
jd
��t||||||dd�dSt|dg�}t�||�\}}t|�j}t|�j }d
}t�!||�D]3}t"|||
||||�#d�||�	}|j$r�|�|�|j%r�d
|d<q�d}|�|�|j&dur�|�|j&�q�|r�d}||7}tj'||d�}|	|j�|�dd|j|j|j(d��t�)|�}|�*�t|||||||d�|�rdSdS)z^Perform the enable action on a named entitlement.

    @return: 0 on success, 1 otherwise
    F)�_schema_versionrrrr<��
--access-only�	--variant)�option1�option2zFailed to refresh contractT)�exc_info�system)r|r2r})r�r'r$rNr~r�r)+r�JSON_SCHEMA_VERSIONrWrr��getattrr rwr�InvalidOptionCombinationr�REFRESH_CONTRACT_ENABLEr	�refresh�ConnectivityErrorr�r��warning�append�E_REFRESH_CONTRACT_FAILURErLr?r�is_attached_and_contract_valid�ContractExpiredErrorr�rur
�get_valid_entitlement_namesrr;r�services�order_entitlements_for_enablingr��getrrr�*create_enable_entitlements_not_found_errorr��UAContractClient�update_activity_token)�argsr�kwargsrhrirjrkrgrfr�r<r rw�expired_err�names�entitlements_found�entitlements_not_foundr;r:�retrvrm�err�contract_clientr7r7r8�
action_enabless��
��
���

���	
�

��
�

��
��

�
r�c
Cs�|jdtjd�}|jtd�tj|_tjj	tj
dd�|_d|_tj
|j_tj|j_|jdddtjj	d	�tj|d
��d�d�|jd
dtjj	dd�d�|jddtjd�|jddtjd�|jddddgdtjj	dd�d�|jddtjd�|S)Nr/)�help)�actionzenable <service> [<service>])r?�commandr'�store�+z, r~)�options)r��nargsr�z--assume-yes�
store_true)r�)r�r�r�z--betaz--format�clirr)�default)r��choicesr�r�r�)�
add_parserr�CLI_ROOT_ENABLE�set_defaultsr��CLI_ENABLE_DESC�descriptionr�
USAGE_TMPLrW�NAME�usage�prog�CLI_ARGS�_positionalsr{�	CLI_FLAGS�
_optionals�add_argument�CLI_ENABLE_SERVICE�joinr
�valid_services�CLI_ASSUME_YES�CLI_ENABLE_ACCESS_ONLY�CLI_ENABLE_BETA�CLI_FORMAT_DESC�CLI_ENABLE_VARIANT)�
subparsersr�parserr7r7r8r��sR�

��
�����r�rD)6rr�logging�typingrrrrr�uaclientrrr	r
rrr
rrr�+uaclient.api.u.pro.services.dependencies.v1rr�%uaclient.api.u.pro.services.enable.v1rrr�-uaclient.api.u.pro.status.enabled_services.v1rr�(uaclient.api.u.pro.status.is_attached.v1r�uaclient.clirr�	getLogger�replace_top_level_logger_name�__name__r��bool�strr�UAConfig�AbstractProgressr9rerur��verify_json_format_args�assert_root�assert_attached�&_raise_enable_disable_unattached_error�intr�r�r7r7r7r8�<module>s�0�����
�,������
�\�
�����
�������
��	�

�#


Spamworldpro Mini