HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/uaclient/entitlements/__pycache__/realtime.cpython-38.pyc
U

��Jhn�@s�ddlZddlmZmZmZmZmZddlmZm	Z	m
Z
mZmZddl
mZddlmZmZddlmZmZmZe	��Ze�e�e��ZddiZGd	d
�d
ej�ZGdd�de�ZGd
d�de�Z Gdd�de�Z!Gdd�de�Z"Gdd�de�Z#dS)�N)�Any�Dict�Optional�Tuple�Type)�apt�event_logger�messages�system�util)�repo)�EntitlementWithMessage�
UAEntitlement)�MessagingOperations�MessagingOperationsDict�StaticAffordanceZGenuineIntelZintelc@s�eZdZdZejZejZej	Z
ejjZ
dZdZdZdZdZed�dd�Zeeeefd�d	d
�Zedd��Zeeed
fd�dd��Zeeed
fd�dd��Z ee!d�dd��Z"dd�dd�Z#dS)�RealtimeKernelEntitlementzrealtime-kernelzubuntu-pro-realtime-kernel.gpgTFZUbuntuRealtimeKernel��returncCs(tjt|j�tdg�d�}t�|�|S)z%Check if system needs to be rebooted.zlinux-.*-realtime)Zinstalled_pkgsZinstalled_pkgs_regex)r
Z
should_reboot�set�packages�eventZneeds_reboot)�selfZreboot_required�r�@/usr/lib/python3/dist-packages/uaclient/entitlements/realtime.py�_check_for_reboots�
z+RealtimeKernelEntitlement._check_for_rebootcCstjttjttjttjtiS�N)�GenericRealtime�variant_name�NvidiaTegraRealtime�RaspberryPiRealtime�IntelIotgRealtime�rrrr�
_get_variants(s�z'RealtimeKernelEntitlement._get_variantscCs|jr
dStSr)�access_onlyrr"rrr�default_variant0sz)RealtimeKernelEntitlement.default_variant.cCs>ddlm}m}ddlm}t|tj�t|tj�t|tj	�fS)Nr)�FIPSEntitlement�FIPSUpdatesEntitlement)�LivepatchEntitlement)
Zuaclient.entitlements.fipsr&r'Zuaclient.entitlements.livepatchr(r
r	ZREALTIME_FIPS_INCOMPATIBLEZ"REALTIME_FIPS_UPDATES_INCOMPATIBLEZREALTIME_LIVEPATCH_INCOMPATIBLE)rr&r'r(rrr�incompatible_services6s����z/RealtimeKernelEntitlement.incompatible_servicescCstjdd�dffS)NcSst��Sr)r
Zis_containerrrrr�<lambda>P�z>RealtimeKernelEntitlement.static_affordances.<locals>.<lambda>F)r	Z#REALTIME_ERROR_INSTALL_ON_CONTAINERr"rrr�static_affordancesKs
��z,RealtimeKernelEntitlement.static_affordancescCsDd}|jstjtjdd�fg}d}|js:tjdtjifg}||d�S)NT)�msg�defaultr-)�
pre_enable�pre_disable)r$r�prompt_for_confirmationr	ZREALTIME_PROMPT�purgeZREALTIME_PRE_DISABLE_PROMPT)rr/r0rrr�	messagingUs&���
���
�z#RealtimeKernelEntitlement.messagingNcCs<t|j��tt����}|r8t�t|�tjj	|j
d��dS)N)�title)rr�intersectionrZget_installed_packages_names�remove_packages�listr	ZDISABLE_FAILED_TMPL�formatr4)rrrrrr6us

��z)RealtimeKernelEntitlement.remove_packages)$�__name__�
__module__�__qualname__�namer	ZREALTIME_TITLEr4ZREALTIME_DESCRIPTION�descriptionZREALTIME_HELP_TEXTZ	help_textZurlsZREALTIME_HOME_PAGEZhelp_doc_urlZ
repo_key_fileZapt_noninteractiveZsupports_access_onlyZsupports_purge�origin�boolrr�strrrr#�propertyr%rr
r)rr,rr3r6rrrrrs,	
	�rcs.eZdZeeedfd��fdd��Z�ZS)�RealtimeVariant.rcs(t�fdd��j��D��}t�j|S)Ncs*g|]"\}}t|tjj�j|jd���qS))�service�variant)r
r	ZREALTIME_VARIANT_INCOMPATIBLEr8r4)�.0r<�clsr"rr�
<listcomp>�s���z9RealtimeVariant.incompatible_services.<locals>.<listcomp>)�tupleZother_variants�items�superr))rZincompatible_variants��	__class__r"rr)�s
��z%RealtimeVariant.incompatible_services)r9r:r;rArr
r)�
__classcell__rrrKrrB�srBcs>eZdZdZejZejZdZ	dZ
eed��fdd��Z
�ZS)r�genericTrcsdt�j}t��j}|dkr`|�d�p&g}tjj|j	|j
d|p>dd�}|�tj
d|if�||d<|S)NrNr/�unknown)rDrCZbase_flavor�current_flavorr-)rJr3r
Zget_kernel_infoZflavor�getr	Z#KERNEL_FLAVOR_CHANGE_WARNING_PROMPTr8rr<�appendrr1)rr3rPr/r-rKrrr3�s"
���zGenericRealtime.messaging)r9r:r;rr	ZREALTIME_GENERIC_TITLEr4ZREALTIME_GENERIC_DESCRIPTIONr=�
is_variant�check_packages_are_installedrArr3rMrrrKrr�s�rc@s$eZdZdZejZejZdZ	dZ
dS)rznvidia-tegraTN)r9r:r;rr	ZREALTIME_NVIDIA_TITLEr4ZREALTIME_NVIDIA_DESCRIPTIONr=rSrTrrrrr�s
rc@s2eZdZdZejZejZdZ	dZ
ed�dd�ZdS)r ZraspiTrc
Csbd}z$t�|�����}d|kp&d|kWStk
r\}zt�d|�WY�dSd}~XYnXdS)Nz/proc/device-tree/modelzraspberry pi 4zraspberry pi 5z)Error while detecting if raspberry pi: %rF)r
Z	load_file�strip�lower�	Exception�LOG�info)rZproc_file_pathZmodel�errr�variant_auto_select�sz'RaspberryPiRealtime.variant_auto_selectN)
r9r:r;rr	ZREALTIME_RASPI_TITLEr4ZREALTIME_RASPI_DESCRIPTIONr=rSrTr?r[rrrrr �sr c@sJeZdZdZejZejZdZ	dZ
eee
feeeejfd�dd�ZdS)r!z
intel-iotgT)�platform_checksrcCsTt��jpd}t�||�}|�dg�}||kr2dSdtjj|j|d�	|�d�fSdS)N��cpu_vendor_ids)TNF�,)r4ZvendorZsupported_vendors)
r
Zget_cpu_infoZcpuinfo_vendor_id�CPU_VENDOR_MAPrQr	ZINAPPLICABLE_VENDOR_NAMEr8r4�join)rr\Z	vendor_idr^rrr�verify_platform_checks�s�z(IntelIotgRealtime.verify_platform_checksN)r9r:r;rr	ZREALTIME_INTEL_TITLEr4ZREALTIME_INTEL_DESCRIPTIONr=rSrTrr@rrr?rZNamedMessagerbrrrrr!�s
�r!)$Zlogging�typingrrrrrZuaclientrrr	r
rZuaclient.entitlementsrZuaclient.entitlements.baser
rZuaclient.typesrrrZget_event_loggerrZ	getLoggerZreplace_top_level_logger_namer9rXr`ZRepoEntitlementrrBrrr r!rrrr�<module>sm