%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/uaclient/cli/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/uaclient/cli/__pycache__/enable.cpython-312.pyc

�

�Hcf8��R�ddlZddlZddlmZmZmZddlmZmZm	Z	m
Z
mZmZm
Z
mZmZddlmZmZddlmZmZddlmZddlmZmZddlmZmZej<ej>e ��Z!d	ejDd
e#deedeed
e#de#de#fd�Z$de%dee#efdee#dee#deee#efdeee#efde%fd�Z&ejNejPejRejT�ejVd�de,fd�����Z-d	ejDfd�Z.y)�N)�Any�Dict�List)	�api�config�contract�entitlements�event_logger�
exceptions�messages�status�util)�ServiceWithDependencies�
_dependencies)�EnabledService�_enabled_services)�_is_attached)�cli_util�	constants)�CanEnableFailure�CanEnableFailureReason�cfg�service�all_dependencies�enabled_services�called_name�variant�
service_titlec�����g}g}|D�	cgc]}	|	j��}
}	t�fd�|D�d�}|�b|jD�	cgc]}	|	j|
vr|	j��}}	|jD�	cgc]}	|	j|
vr|	j��}}	|D]�}t	j
|jd��}
tj||�}tjj||��}|
st	j|��r�ttj||���|D]f}tj||�}tjj||��}t	j|��r�Qtj ||���t��fd�|D�d�}|�����tj|���}tj|�|j"�}t	j
|jd��}
tjj||��}|
st	j|��stj||���yyycc}	wcc}	wcc}	w)Nc3�B�K�|]}|j�k(s�|���y�w�N)�name)�.0�srs  ��5/usr/lib/python3/dist-packages/uaclient/cli/enable.py�	<genexpr>z1prompt_for_dependency_handling.<locals>.<genexpr>0s�����:�q����'�(9��:�s��z features.block_disable_on_enable)r�
path_to_value)�service_being_enabled�incompatible_service)�msg)r(�required_servicec3�v�K�|]0}|j�k(r|jr|j�k7r|���2y�wr!)r"�variant_enabled�variant_name)r#r$rrs  ��r%r&z1prompt_for_dependency_handling.<locals>.<genexpr>_s:�����	
���v�v�� ��!�!����'�)�	
�	
�s�69)r"�next�incompatible_with�
depends_onr�is_config_value_truerr	�	get_titler�INCOMPATIBLE_SERVICE�format�prompt_for_confirmationr�IncompatibleServiceStopsEnable�REQUIRED_SERVICE�RequiredServiceStopsEnabler.)rrrrrrr�incompatible_services�required_servicesr$�enabled_service_names�dependenciesr)�cfg_block_disable_on_enable�incompatible_service_title�user_msgr+�required_service_titler-�to_be_enabled_title�enabled_variant_titles `   `               r%�prompt_for_dependency_handlingrD"s��������-=�>��Q�V�V�>��>��:�$�:�D��L���"�3�3�!
���v�v�.�.�
�F�F�!
��!
�"�,�,�
���v�v�2�2�
�F�F�
��
�!6���&*�&?�&?��7�7�<�'
�#�&2�%;�%;��%�&
�"��0�0�7�7�"/�!;�8�
��'�d�.J�.J��/
��;�;�&3�%?��
��(.�
��!-�!7�!7��=M�!N���,�,�3�3�"/�3�4�
���+�+��9��7�7�&3�!7��
�
��	
�%�	
�	
�	�O��"�w�':�*�4�4�S�'�7�K�� ,� 6� 6���/�6�6�!
��'+�&?�&?��7�7�<�'
�#��0�0�7�7�"5�!6�8�
��'�d�.J�.J��/
��;�;�&9�%:��
�/
�(;�"��w?��!
��

s�I�!I�6!I"�json_output�
json_response�processed_services�failed_services�errors�warnings�successc���|rm|j�|j�|rdnd|d<||d<||d<||d<||d<ttj|tj
d�	��yy)
NrK�failure�resultrGrHrIrJT)�cls�	sort_keys)�sort�print�json�dumpsr�DatetimeAwareJSONEncoder)rErFrGrHrIrJrKs       r%�print_json_outputrV~s������!�����/6�)�I�
�h��.@�
�*�+�+:�
�'�(�"(�
�h��$,�
�j�!�
��J�J���1�1��
�	
��z
pro enable�returnc�&�g}g}g}g}tjddd�}|jdk(}tj|�}	t|dd�}
|j}|
r|rtjdd�	��|	tj�	tj|�t+|�j,sbtj.�}|	|j&�|j#d
|j&|j0d��t3||||||d��yt|dg�}
t5j6|
|�\}}t9|�j:}t=|�j>}d}t5j@||�D�]I}t5jB|||
��||jD|jF|||jId���}tjKd|�tjKd|
�|j(}|jL}|jDs	tO||||||
|��	|rtUjV�}n'tUjVtjX��}|j[�|_.|j_|�\}}taj`|��|s�|��tc|td�r�|jf�k|	|jfj&�|j#|�|j#d||jfj&|jfj(d��|jhtjjlk(r|j#|�|	tjRj|jL����n.|r�|j#|�|jr1|	tjnj|jL���n0|	tjpj|jL���|js�}|r+d|d<|	tjtjd���|jwd|jxjId ��nE|sC|�A|j#|�|	tjRj|jL���||z}��L|rpd}||z
}t5j||||jF�"�}|	|j&�|j#d
d|j&|j0|jzd!��tj~|�}|j��t3|||||||��|rd#SdS#tjtjf$r`tj!d
d��|j#d
tj$j&tj$j(d��Y��]wxYw#tj$rZ}tjQ|�|	|j&�|	tjRj|���d}Yd}~���d}~wwxYw#tj$r�}|j#|�|	|j&�|	tjRj|���|j#d||j&|j0|jzd!��d}Yd}~���d}~wwxYw)$z^Perform the enable action on a named entitlement.

    @return: 0 on success, 1 otherwise
    rKF)�_schema_versionrN�needs_rebootrSr��
--access-only�	--variant)�option1�option2zFailed to refresh contractT)�exc_info�system)�type�message�message_code)rK�r)r�
extra_args)�
assume_yes�
allow_betar�access_onlyrgzEnabling entitlement %szVariant: %s)rrr)�titleN�r)rcrrdrer[�install)�	operation�message_operation�post_enable)rcrrdre�additional_info)rrir)Ar
�JSON_SCHEMA_VERSIONr5r�&create_interactive_only_print_function�getattrrjr�InvalidOptionCombinationr�REFRESH_CONTRACT_ENABLEr�refresh�ConnectivityError�UbuntuProError�LOG�warning�append�E_REFRESH_CONTRACT_FAILUREr*r"r�is_attached_and_contract_valid�ContractExpiredError�msg_coderVr	�get_valid_entitlement_namesrrr�services�order_entitlements_for_enabling�entitlement_factoryrh�beta�get�debugrkrD�	exception�
ENABLE_FAILEDr�ProgressWrapper�CLIEnableDisableProgress�calculate_total_enable_steps�total_steps�enabler
�
isinstancerrd�reasonr�IS_BETA�ACCESS_ENABLED_TMPL�ENABLED_TMPL�_check_for_reboot�ENABLE_REBOOT_REQUIRED_TMPL�emit�	messagingrq�*create_enable_entitlements_not_found_error�UAContractClient�update_activity_token)�argsr�kwargsrGrHrIrJrFrE�interactive_only_printrrj�expired_err�names�entitlements_found�entitlements_not_foundrr�ret�ent_name�ent�	real_name�	ent_title�e�progress�ent_retr��ent_reboot_required�err�contract_clients                              r%�
action_enabler��s]�����O�
�F��H�(�;�;����M��+�+��'�K�
&�L�L�����d�I�r�*�G��"�"�K��;��1�1�#�[�
�	
��8�;�;�<�
���������;�;� �5�5�7���{���/��
�
� �&�?�?� +� 4� 4�
�	
�	��������	
���D�)�R�(�E�	�0�0���<����(��-�>�>��$�S�)�2�2��
�C� �@�@��
��u��O�l�.�.�s�H�g�N������y�y� �#��z�z�,�/�

��	�	�	�+�X�6��	�	�-��)��H�H�	��I�I�	����
�.���$�$� )�#�"+��$O	���.�.�0���.�.��5�5�7���$'�#C�#C�#E�H� �!�j�j��2�O�G�V��M�M�c�"���&��v�'7�8��>�>�-�*�6�>�>�+=�+=�>�#�*�*�8�4��M�M�$-�'/�'-�~�~�'9�'9�,2�N�N�,?�,?�	���=�=�$:�$B�$B�B�+�1�1�(�;�&��*�*�1�1��	�	�1�B���"�)�)�(�3��#�#�*� �4�4�;�;�#�)�)�;�L��+� �-�-�4�4�3�9�9�4�E��'*�&;�&;�&=�#�&�48�M�.�1�*� �<�<�C�C�&/�D���
�
�
�'����):�):�=�)I������&�&�x�0�&��*�*�1�1��	�	�1�B��
�7�N�C�Ku�n����1�1���E�E�"���	�	�
��	�s�w�w�'��
�
� ���7�7� #���#&�#6�#6�
�	
��/�/��4�O��)�)�+�����������1�����}
�(�(�*�*C�*C�D�	
����0�4��@���� �#�>�>�B�B� (� C� C� H� H�
�	
�	
��L�,�,�
��
�
�a� �&�q�u�u�-�&��*�*�1�1�	�1�B������
��R�(�(�	��"�"�8�,�"�1�5�5�)�"��&�&�-�-�I�-�>�
�
�M�M�%�'� �u�u�$%�J�J�'(�'8�'8��
��C��	�sF�U<�X�/JY2�<A?W?�>W?�Y/�AY*�*Y/�2\�B\�\c���|jdtj��}|jt��tj
|_tjjtjd��|_d|_tj|j_tj |j"_|j%dddtj&jd	j)t+j,|�
������|j%d
dtj.jd����|j%ddtj0��|j%ddtj2��|j%ddddgdtj4jd����|j%ddtj6��|S)Nr�)�help)�actionzenable <service> [<service>])r"�commandr�store�+z, rl)�options)r��nargsr�z--assume-yes�
store_true)r�)r�r�r]z--betaz--format�clirS)�default)r��choicesr�r�r^)�
add_parserr�CLI_ROOT_ENABLE�set_defaultsr��CLI_ENABLE_DESC�descriptionr�
USAGE_TMPLr5�NAME�usage�prog�CLI_ARGS�_positionalsrk�	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�parsers   r%r�r��s���
�
"�
"�8�(�2J�2J�
"�
K�F�
���}��-�!�1�1�F���'�'�.�.�
�^�^�%C�/��F�L��F�K� (� 1� 1�F����&�0�0�F����
�������'�'�.�.��	�	�,�"=�"=�#�"F�G�
/�
��	������
�
$�
$�
+�
+�H�
+�
=���
�����
�
,�
,���
�����H�,D�,D������������
�
%�
%�
,�
,�U�
,�
;�������G�(�*E�*E����MrW)/rS�logging�typingrrr�uaclientrrrr	r
rrr
r�+uaclient.api.u.pro.services.dependencies.v1rr�-uaclient.api.u.pro.status.enabled_services.v1rr�(uaclient.api.u.pro.status.is_attached.v1r�uaclient.clirr�(uaclient.entitlements.entitlement_statusrr�	getLogger�replace_top_level_logger_name�__name__rz�UAConfig�strrD�boolrV�verify_json_format_args�assert_root�assert_attached�&_raise_enable_disable_unattached_error�assert_lock_file�intr�r��rWr%�<module>r�s�����"�"�
�
�
���B�,��
�g���:��:�:�8�D�E��Y�	���Y�
�Y��2�3�Y��>�*�	Y�
�Y��
Y��Y�x
��
���S��>�
��S�	�
��#�Y�	
�

��c�3�h�� �
��4��S��>�"�

��
�8
�!�!�	�������(�I�I�J�����<�(�b�S�b�)�K��"�b�J+����+rW

Zerion Mini Shell 1.0