%PDF- %PDF-
Mini Shell

Mini Shell

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

�

�(�fD��,�ddlZddlZddlmZmZmZmZmZddlm	Z	m
Z
mZmZm
Z
mZmZmZmZmZddlmZmZddlmZmZmZddlmZmZddlmZddlm Z dd	l!m"Z"m#Z#m$Z$dd
l%m&Z&ejNejPe)��Z*edde+fd
e+fdeee,effg�Z-	d=de
j\de+dee	j^fd�Z0de
j\de,deedeede,de,de,fd�Z1de+dee,efdee,dee,deee,efdeee,efde+fd �Z2de
j\d!e,de,de+d"e+de+d#eee,deedeed$e-fd%�Z3e jhe jje jle jn�d$e8fd&����Z9e$d'ejtejve9e&jxd(e#e"dejzj}d)jej�e
j\��*���+�d,d-�.�e"d/ej�j}d'�0�d1�2�e"d3ej�d1�2�e"d4ej�d1�2�e"d5ej�j}d6�7�d,d6d8gd6�9�e"d:ej�d,�2�g�;�g�<�ZFy)>�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)�ProArgument�ProArgumentGroup�
ProCommand)�HelpCategory�_EnableOneServiceResult�success�needs_reboot�error�cfg�access_only�progress_objectc���tj|�}tj|d||��}d}d}	t	j
d��5|j
|��\}}ddd�|sB|�|j�
|j}	ntj}	tjd|	���tdggdg�	�S#1swY�]xYw#t$r}t	j�|�d}~wwxYw)
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)
r#r$r)r%r+r'r �fail_reason�er-s
          �5/usr/lib/python3/dist-packages/uaclient/cli/enable.py�_enable_landscaper=/s���"�"�?�3�H��1�1�����	�I��G��K��
�^�^�6�
�	G�$-�#3�#3�X�#3�#F� �G�[�	G���"�{�':�':�'F� �(�(�F��3�3�F��3�3���
�	
���
��E�B���!	G�	G�����'�'�)�����s/�C�
B<� C�<C�C�	C,�C'�'C,r,�all_dependencies�enabled_servicesr(�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�sr,s  �r<�	<genexpr>z1prompt_for_dependency_handling.<locals>.<genexpr>is�����:�q����'�(9��:�s��z features.block_disable_on_enable)r	�
path_to_value)�service_being_enabled�incompatible_service)�msg)rJ�required_servicec3�v�K�|]0}|j�k(r|jr|j�k7r|���2y�wrD�rE�variant_enabled�variant_name)rFrGr,r@s  ��r<rHz1prompt_for_dependency_handling.<locals>.<genexpr>�s:�����	
���v�v�� ��!�!����'�)�	
�	
�s�69)rE�next�incompatible_with�
depends_onr�is_config_value_truer#r�	get_titler�INCOMPATIBLE_SERVICE�format�prompt_for_confirmationr
�IncompatibleServiceStopsEnable�REQUIRED_SERVICE�RequiredServiceStopsEnablerQ)r#r,r>r?r(r@rA�incompatible_services�required_servicesrG�enabled_service_names�dependenciesrK�cfg_block_disable_on_enable�incompatible_service_title�user_msgrM�required_service_titlerP�to_be_enabled_title�enabled_variant_titles `   `               r<�prompt_for_dependency_handlingrg[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�warningsc���|rm|j�|j�|rdnd|d<||d<||d<||d<||d<ttj|tj
d�	��yy)
Nr �failure�resultrjrkrlrmT)�cls�	sort_keys)�sort�print�json�dumpsr�DatetimeAwareJSONEncoder)rhrirjrkrlrmr s       r<�_print_json_outputrx�s������!�����/6�)�I�
�h��.@�
�*�+�+:�
�'�(�"(�
�h��$,�
�j�!�
��J�J���1�1��
�	
���ent_name�
assume_yesr)�returnc	����tj|�}	tj||�||��}
|
j�|
j
}t
��fd�|D�d�}|�tjj|��}
|	|
j�|	tjj|���tddd||
j|
jd���S|s	t|�|||�|��	|rd}ntj$|�	�}�d
k(rt'||||��}nt)t+|�|��||�
�}t-j,|��|r'|	tj.j|���n&|	tj0j|���|j2}|r&|	tj4jd���|jD]
}|	|��td|d��S#tj$re}t j#|�|	|j�|	tjj|���tddd��cYd}~Sd}~wwxYw#tj6$rj}|j8d}|d}|d}|d}|	|�|	tjj|���tddd||||d���cYd}~Sd}~wtj$rt}|	|j�|	tjj|���tddd||j|j:|j8d���cYd}~Sd}~wwxYw)N)r@r$r)c3�z�K�|]2}|j�k(r!�r|jr|j�k(r|���4y�wrDrO)rFrG�	real_namer@s  ��r<rHz&_enable_one_service.<locals>.<genexpr>�s<�����	
���v�v��"���%�%�!�.�.�G�*C�
�	
�s�8;)�titleFr,)�typer,r7�message_code)r r!r")r(r@rA)r{r')r)r%)r,r@r$)r%�r#�install)�	operationTr-�coder��additional_info�r�r,r7r�r�)r�&create_interactive_only_print_functionr�entitlement_factoryrEr�rRr�ALREADY_ENABLEDrXrL�
ENABLE_FAILEDrrgr
�UbuntuProError�LOG�	exception�CLIEnableDisableProgressr=rrr�ACCESS_ENABLED_TMPL�ENABLED_TMPLr0�ENABLE_REBOOT_REQUIRED_TMPLr9r��msg_code)r#rzr@r$r{rhr)r?r>�interactive_only_print�ent�	ent_title�already_enabledrLr;r+�
enable_resultr!r7r-�err_code�err_msg�err_infors  `                    @r<�_enable_one_servicer��s����&�L�L�����
*�
*�������C����I��	�	�I��	
�%�	
�	
��O��"��&�&�-�-�I�-�>���s�w�w�'��x�5�5�<�<�9�<�M�N�&���!�#��7�7� #���	�	
�		
��	�*��� � �$��'�
�*S
���H��8�8�J�O�H���#�-���%� (�	�M�$��$�#� +��
� (��M�	�
�
�#���"��,�,�3�3�)�3�D�
�
#��%�%�,�,�9�,�=�
�%�4�4���"��4�4�;�;�'�<��
�%�-�-�	,�G�"�7�+�	,�'��%��
�	
��u�(�(�
	��M�M�!��"�1�5�5�)�"��&�&�-�-�I�-�>�
�+��"���
��
	��@�0�0�
��"�"�8�,���&�>����/���+�,���w�'��x�5�5�<�<�9�<�M�N�&���!�#�"� (�#+��

�
	
���$�$�

��q�u�u�%��x�5�5�<�<�9�<�M�N�&���!�#��5�5� !�
�
�#$�#4�#4��

�
	
��

�sR�$H�7D	I<�I9�AI4�.I9�4I9�<M>�AK4�.M>�4M>�
A)M9�3M>�9M>c��g}g}g}g}tjdd�}|jdk(}tj|�}	t|dd�}
|j}|j}|
r|rtjdd���|	tj�	tj|�t-|�j.sbtj0�}
|	|
j(�|j%d|
j(|
j2d
��t5||||||d��yt|dg�}t7j8||�\}}t;|�j<}t?|�j@}d
}t7jB||�D]�}tE|||
||||jGd�||�	}|jHr$|j%|�|jJs�Od
|d<�Ud}|j%|�|jL��u|j%|jL���|red}||z
}t7jN||��}|	|j(�|j%dd|j(|j2|jPd��tjR|�}|jU�t5|||||||��|rdSdS#tjtjf$r`t j#d	d
��|j%dtj&j(tj&j*d
��Y���wxYw)z^Perform the enable action on a named entitlement.

    @return: 0 on success, 1 otherwise
    F)�_schema_versionr!rur@��
--access-only�	--variant)�option1�option2zFailed to refresh contractT)�exc_info�system)r�r7r�)r �r,r)r!Nr�r�r)+r�JSON_SCHEMA_VERSIONrXrr��getattrr$r{r
�InvalidOptionCombinationr�REFRESH_CONTRACT_ENABLEr
�refresh�ConnectivityErrorr�r��warning�append�E_REFRESH_CONTRACT_FAILURErLrEr�is_attached_and_contract_valid�ContractExpiredErrorr�rxr�get_valid_entitlement_namesrr?r�services�order_entitlements_for_enablingr��getr r!r"�*create_enable_entitlements_not_found_errorr��UAContractClient�update_activity_token)�argsr#�kwargsrjrkrlrmrirhr�r@r$r{�expired_err�names�entitlements_found�entitlements_not_foundr?r>�retrzrp�err�contract_clients                        r<�
action_enabler�us9�����O�
�F��H�(�;�;���M�
�+�+��'�K�
&�L�L�����d�I�r�*�G��"�"�K����J��;��1�1�#�[�
�	
��8�;�;�<�
���������;�;� �5�5�7���{���/��
�
� �&�?�?� +� 4� 4�
�	
�	��������	
���D�)�R�(�E�	�0�0���<����(��-�>�>��$�S�)�2�2��
�C� �@�@��
��,��%��������J�J�|�$���

���>�>��%�%�h�/��"�"�04�
�n�-��C��"�"�8�,��|�|�'��
�
�f�l�l�+�-,�0����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�
�	
�	
�s�K�A?M�Mr4�z, r�)�options�store�+)�help�action�nargsz--assume-yes)�command�
store_true)r�r�r�z--betaz--format�cli)�defaultru)r�r��choicesr�r�)�	arguments)r��descriptionr��
help_category�
help_position�argument_groupsrD)Gru�logging�typingrrrrr�uaclientrr	r
rrr
rrrr�+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.clir�uaclient.cli.commandsrrr�uaclient.cli.parserr�	getLogger�replace_top_level_logger_name�__name__r��bool�strr�UAConfig�AbstractProgressr=rgrxr��verify_json_format_args�assert_root�assert_attached�&_raise_enable_disable_unattached_error�intr��CLI_ROOT_ENABLE�CLI_ENABLE_DESC�
QUICKSTART�CLI_ENABLE_SERVICErX�join�valid_services�CLI_ASSUME_YES�CLI_ENABLE_ACCESS_ONLY�CLI_ENABLE_BETA�CLI_FORMAT_DESC�CLI_ENABLE_VARIANT�enable_command�ryr<�<module>r�s�����8�8�������
�B�!�K�K�,��g���:��:�:�8�D�E��$��	�D��	���	�(�4��S��>�*�+����7;�	)�	���)��)��c�2�2�3�	)�XY�	���Y�
�Y��2�3�Y��>�*�	Y�
�Y��
Y��Y�x
��
���S��>�
��S�	�
��#�Y�	
�

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

��
�8_
�	���_
��_
��_
��	_
�
�_
��
_
���c��#�_
��>�*�_
��2�3�_
��_
�D
�!�!�	�������(�I�I�J�C�S�C�K��"�C�L��	�	!�	!��(�(���)�)�����!�4�4�;�;� $�	�	�7�L�7�7�O�F�O�O�<M�N�!�<��
#��	��"�!�0�0�7�7��7�I�'��
�#�!�8�8�'��
��!�1�1�'��
��!�1�1�8�8��8�G�"�"�F�O�!����!�4�4�"��C&�(	
�*�2�ry

Zerion Mini Shell 1.0