| Server IP : 3.111.61.48 / Your IP : 216.73.216.67 Web Server : Apache System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.2.31 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib/python3/dist-packages/uaclient/__pycache__/ |
Upload File : |
o
�K�i� � @ s� d dl Z d dlZd dlZd dlmZ d dlmZmZmZ d dl m
Z
mZmZ d dl
mZ d dlmZmZ d dlmZ d dlmZ e �e�e��ZG d d
� d
e
�Zeeeddd
�ej�Zdeeef fdd�Zdd� Z G dd� d�Z!dS )� N)�Tuple)�
exceptions�system�util)�
DataObject�Field�StringDataValue)�notices)�DataObjectFile�DataObjectFileFormat)�UAFile)�Noticec @ s2 e Zd Zede�ede�gZdedefdd�ZdS )�LockData�lock_pid�lock_holderc C s || _ || _d S �N�r r )�selfr r � r �//usr/lib/python3/dist-packages/uaclient/lock.py�__init__ s
zLockData.__init__N)�__name__�
__module__�__qualname__r r �fields�strr r r r r r s
�r �lockF)�private�returnc C s� zt �� } W n tjy tjt jd��w d}| s|S | j}| j}zt� d|g� t
|�|fW S tjy\ t�
� sKt�d||� t
|�|f Y S t�d||� t�t j� | Y S w )a Return lock info if lock file is present the lock is active.
If process claiming the lock is no longer present, remove the lock file
and log a warning.
:return: A tuple (pid, string describing lock holder)
If no active lock, pid will be -1.
)�lock_file_path)���� �psz.Found stale lock file previously held by %s:%sz1Removing stale lock file previously held by %s:%s)�lock_data_file�readr �InvalidFileFormatError�InvalidLockFile�pathr r r �subp�int�ProcessExecutionErrorr �we_are_currently_root�LOG�debug�warning�ensure_file_absent)�
lock_data_obj�no_lockr r r r r �check_lock_info"