Current File : //usr/lib/python3/dist-packages/uaclient/api/u/pro/detach/__pycache__/v1.cpython-312.pyc
�

Uٵg��F�ddlmZddlmZmZmZmZmZmZm	Z	ddl
mZddlm
Z
ddlmZmZddlmZddlmZddlmZdd	lmZmZmZmZmZdd
lmZmZm Z ddl!m"Z"Gd�d
ee�Z#de#fd�Z$dede#fd�Z%dede#fd�Z&e
dde%d��Z'ddde#ejPdfgddd�Z)y)�)�List)�daemon�entitlements�
exceptions�lock�messages�timer�util)�ProgressWrapper)�APIEndpoint)�AdditionalInfo�ErrorWarningObject)�_reboot_required)�_is_attached)�UAConfig)�
BoolDataValue�
DataObject�Field�StringDataValue�	data_list)�
machine_token�notices�state_files)�update_motd_messagesc�Z�eZdZedee�d��eded��gZdee	de
fd�Zy)�DetachResult�disabledz1The services disabled during the detach operation)�doc�reboot_requiredz?True if the system requires a reboot after the detach operationc� �||_||_y�N�rr)�selfrrs   �>/usr/lib/python3/dist-packages/uaclient/api/u/pro/detach/v1.py�__init__zDetachResult.__init__0s�� ��
�.���N)�__name__�
__module__�__qualname__rrrr�fieldsr�str�boolr%�r&r$rrsK��
���o�&�C�	
�
	����		
�
�F� /��c��/�T�/r&r�returnc�(�tt��Sr!)�_detachrr-r&r$�detachr15s���8�:��r&�cfgc��tj�stj�	t	j
d��5t
|�}ddd�|S#1swYSxYw#t$r}t	j�|�d}~wwxYw)zZ
    This endpoint allows the user to detach the machine from a Pro
    subscription.
    zpro.api.u.pro.detach.v1)�lock_holderN)	r
�we_are_currently_rootr�NonRootUserErrorr�	RetryLock�_detach_in_lock�	Exception�clear_lock_file_if_present)r2�ret�es   r$r0r09s|��
�%�%�'��)�)�)��
�^�^�1�
�	'�"�#�&�C�	'��J�	'��J�����'�'�)�����s4�A�A�A�A�A�A�	B�(A>�>Bc	��t|�js
tgd��Sg}g}tj|�D]�}	tj
||��}|jd��\}}|s�3|jt��\}}|s}|r9|jr-|jj}	|jj}
n"tjj!|��}	d}
|j#t%|	|
d|i�	����|j#|���t'j(t&j*j,�t/j0�t3j4�j7�t9|�t;j<�t?j@�tC|�}ttE|�|jFd
k(��}||_$|S#tj$rY���wxYw)NFr")r2�nameT)�ignore_dependent_services)�title��service)r@�code�meta�yes)%r�is_attachedrr�entitlements_disable_order�entitlement_factoryr�EntitlementNotFoundError�can_disable�disabler�message�msgr>r�DISABLE_FAILED_TMPL�format�appendrr�remove�Notice�LIMITED_TO_RELEASEr�delete_state_filesr�get_machine_token_file�deleterr�startr	�stopr�sortedr�warnings)
r2rrZ�ent_name�entrJ�_r;�reasonrMrC�reboot_required_result�results
             r$r8r8Ls������(�(���!�
�	
�
�H��H� �;�;�C�@�*��	��2�2�s��J�C����4��H���Q���+�+�o�&7�8�K�C����f�n�n� �.�.�,�,�C�!�>�>�.�.�D�"�6�6�=�=�H�=�M�C��D����&�!�!�'��2�������)�9*�<�N�N�7�>�>�4�4�5��"�"�$��(�(�*�1�1�3����
�L�L�N�	�J�J�L�-�c�2��
���!�.�>�>�%�G��F��F�O��M��U�2�2�	��	�s�G*�*H�H�v1�DetachN)�versionr>�fn�options_cls�32TzD
from uaclient.api.u.pro.detach.v1 import detach

result = detach()
z1Raised if a non-root user executes this endpoint.zpro api u.pro.detach.v1zL
{
    "disabled": ["service1", "service2"],
    "reboot_required": false
}
)�
introduced_in�requires_network�example_python�result_classr�example_cli�example_json)*�typingr�uaclientrrrrrr	r
�uaclient.apir�uaclient.api.apir�uaclient.api.data_typesr
r�5uaclient.api.u.pro.security.status.reboot_required.v1r�(uaclient.api.u.pro.status.is_attached.v1r�uaclient.configr�uaclient.data_typesrrrrr�uaclient.filesrrr�uaclient.timer.update_messagingrrr1r0r8�endpointr6�_docr-r&r$�<module>rzs�������)�(�F��B�$���?�>�@�/�:�~�/�,������l��&6��6�l�6�r��	���	�����
!�
�'�'�
@�	
��-��!�r&