Home Files
Adminer
Execute Command
PHP Eval
Symlink
File Upload
Owner :
www-data
PHP Version
8.1.8
Disk Space
12.61 GB
Server Addr
171.9.3.2
Your IP
171.9.3.1
Edit File
File:
U L�wa� � @ sv d dl m Z d dlZd dlZd dlmZmZ ze�dd� d dlmZ W n e e fk r` Y nX G dd� de�ZdS ) � )�gettextN)�Gio�GLib�Snapd�1)r c @ s@ e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dS )� LivepatchSnapzcanonical-livepatchc C s t �� | _t�� | _d S )N)r ZClient� _snapd_clientr ZCancellable�_cancellable)�self� r �B/usr/lib/python3/dist-packages/softwareproperties/LivepatchSnap.py�__init__) s zLivepatchSnap.__init__c C s | � � }|r|�� S tjjS )z� Get the status of canonical-livepatch snap. Returns: Snapd.SnapStatus.Enun: An enum indicating the status of the snap. )� _get_raw_snap� get_statusr � SnapStatusZUNKNOWN)r �snapr r r r - s zLivepatchSnap.get_statusc C st | � � }|tjjkr*t�d�| j�� dS |tjjkr>| � � S |tjj krR| �� S t�d�| j�� dtd�fS dS )z�Enable or install canonical-livepatch snap. Returns: (True, '') if successful, (False, error_message) otherwise. z{} snap is already active�T� z{} snap is in an unknown stateFz-Canonical Livepatch snap cannot be installed.N) r r r ZACTIVE�loggingZwarning�format� SNAP_NAME� AVAILABLE�_install� INSTALLED�_enable�_)r Zstatusr r r �enable_or_install6 s zLivepatchSnap.enable_or_installc C s� z| j j| j| jd�}W n: tjk rR } zt�d�|j �� d}W 5 d}~X Y nX |r\|S z*| j j tjj | j| jd�\}}|d }W n6 tjk r� } zt�d�|j �� W 5 d}~X Y nX |S )z�Get the Sanpd.Snap raw object of the canonical-livepatch snapd. Returns: Sanpd.Snap if successful, None otherwise. ��name�cancellablez%Snapd.Client.get_snap_sync failed: {}N)�flagsZqueryr r z!Snapd.Client.find_sync failed: {})r Z get_snap_syncr r r �Errorr �debugr �messageZ find_syncr Z FindFlagsZ MATCH_NAME)r r �eZsnapsZignoredr r r r J s( � � $zLivepatchSnap._get_raw_snapc C sx | � � tjjkst�z| jjtjj| j | j d� W n< tjk rn } zdt d�|j��f W Y �S d}~X Y nX dS dS )z�Install canonical-livepatch snap. Returns: (True, '') if successful, (False, error_message) otherwise. )r r r Fz0Canonical Livepatch snap cannot be installed: {}Nr )r r r r �AssertionErrorr Z install2_syncZInstallFlagsZNONEr r r r! r r r# �r r$ r r r r f s � *zLivepatchSnap._installc C sr | � � tjjkst�z| jj| j| jd� W n< t j k rh } zdtd�|j ��f W Y �S d}~X Y nX dS dS )z�Enable the canonical-livepatch snap. Returns: (True, '') if successful, (False, error_message) otherwise. r Fz.Canonical Livepatch snap cannot be enabled: {}Nr )r r r r r% r Zenable_syncr r r r! r r r# r&