![]() Server : Apache/2.4.52 (Ubuntu) System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 User : www-data ( 33) PHP Version : 8.1.2-1ubuntu2.21 Disable Function : NONE Directory : /lib/python3/dist-packages/uaclient/__pycache__/ |
o ��pf� � @ 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"