HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/uaclient/api/u/pro/detach/__pycache__/v1.cpython-310.pyc
o

��Jh�@s,ddlmZddlmZmZmZmZmZmZm	Z	ddl
mZddlm
Z
ddlmZmZddlmZddlmZddlmZdd	lmZmZmZmZmZdd
lmZmZm Z ddl!m"Z"Gdd
�d
ee�Z#de#fdd�Z$dede#fdd�Z%dede#fdd�Z&e
dde%dd�Z'ddde#ej(dfgddd �Z)dS)!�)�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@sBeZdZedee�dd�ededd�gZdee	de
fdd�ZdS)	�DetachResult�disabledz1The services disabled during the detach operation)�doc�reboot_requiredz?True if the system requires a reboot after the detach operationcCs||_||_dS�N�rr)�selfrr�r!�>/usr/lib/python3/dist-packages/uaclient/api/u/pro/detach/v1.py�__init__0s
zDetachResult.__init__N)�__name__�
__module__�__qualname__rrrr�fieldsr�str�boolr#r!r!r!r"rs���r�returncCs
tt��Sr)�_detachrr!r!r!r"�detach5s
r,�cfgc
Csrt��stj�ztjdd��t|�}Wd�W|S1swYW|Sty8}zt��|�d}~ww)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)r-�ret�er!r!r"r+9s �
�����r+c
	Cs2t|�jstgdd�Sg}g}t�|�D]S}z	tj||d�}Wn
tjy)Yqw|jdd�\}}|rg|�	t
��\}}|sb|rL|jrL|jj}	|jj
}
n	tjj|d�}	d}
|�t|	|
d|id	��q|�|�qt�tjj�t��t����t|�t��t� �t!|�}tt"|�|j#d
kd�}||_$|S)NFr)r-�nameT)�ignore_dependent_services)�title��service)r9�code�meta�yes)%r�is_attachedrr�entitlements_disable_order�entitlement_factoryr�EntitlementNotFoundError�can_disable�disabler
�message�msgr7r�DISABLE_FAILED_TMPL�format�appendr
r�remove�Notice�LIMITED_TO_RELEASEr�delete_state_filesr�get_machine_token_file�deleterr�startr�stopr�sortedr�warnings)
r-rrS�ent_name�entrC�_r5�reasonrFr<�reboot_required_result�resultr!r!r"r2LsX
��

��
��r2�v1�DetachN)�versionr7�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�uaclientrrrrrrr	�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_messagingrrr,r+r2�endpointr0�_docr!r!r!r"�<module>s@$	9���
�