/usr/lib/python3/dist-packages/uaclient/__pycache__
NameSizeModeActions
actions.cpython-310.pyc113810644editdlrm
apt.cpython-310.pyc283670644editdlrm
apt_news.cpython-310.pyc73460644editdlrm
config.cpython-310.pyc137600644editdlrm
contract.cpython-310.pyc248990644editdlrm
contract_data_types.cpython-310.pyc80680644editdlrm
data_types.cpython-310.pyc147880644editdlrm
defaults.cpython-310.pyc29130644editdlrm
event_logger.cpython-310.pyc78400644editdlrm
exceptions.cpython-310.pyc250390644editdlrm
gpg.cpython-310.pyc10250644editdlrm
livepatch.cpython-310.pyc106950644editdlrm
lock.cpython-310.pyc46350644editdlrm
log.cpython-310.pyc46330644editdlrm
secret_manager.cpython-310.pyc12560644editdlrm
security_status.cpython-310.pyc165980644editdlrm
snap.cpython-310.pyc64710644editdlrm
status.cpython-310.pyc183610644editdlrm
system.cpython-310.pyc227620644editdlrm
types.cpython-310.pyc4720644editdlrm
update_contract_info.cpython-310.pyc13320644editdlrm
upgrade_lts_contract.cpython-310.pyc29920644editdlrm
util.cpython-310.pyc135250644editdlrm
version.cpython-310.pyc24990644editdlrm
yaml.cpython-310.pyc11780644editdlrm
__init__.cpython-310.pyc1440644editdlrm
Edit: /usr/lib/python3/dist-packages/uaclient/__pycache__/lock.cpython-310.pyc (4635B)
o Ki@sddlZddlZddlZddlmZddlmZmZmZddl m Z m Z m Z ddl mZddlmZmZddlmZddlmZeeeZGd d d e Zeeed d d ejZdeeeffddZddZ GdddZ!dS)N)Tuple) exceptionssystemutil) DataObjectFieldStringDataValue)notices)DataObjectFileDataObjectFileFormat)UAFile)Noticec@s2eZdZedeedegZdedefddZdS)LockDatalock_pid lock_holdercCs||_||_dSNrr)selfrrr//usr/lib/python3/dist-packages/uaclient/lock.py__init__s zLockData.__init__N)__name__ __module__ __qualname__rrfieldsstrrrrrrrs rlockF)privatereturncCszt}Wntjytjtjdwd}|s|S|j}|j}zt d|gt ||fWStj y\t sKtd||t ||fYStd||ttj|YSw)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_filereadrInvalidFileFormatErrorInvalidLockFilepathrrrsubpintProcessExecutionErrorrwe_are_currently_rootLOGdebugwarningensure_file_absent) lock_data_objno_lockrrrrrcheck_lock_info"s:  r2cCs tdSr)r#deleterrrrclear_lock_file_if_presentLs r4c@sFeZdZdZddddededefdd Zd d Zd d ZddZ dS) RetryLockah Context manager for gaining exclusive access to the lock file. Create a lock file if absent. The lock file will contain a pid of the running process, and a customer-visible description of the lock holder. The RetryLock will try several times to acquire the lock before giving up. The number of times to try and how long to sleep in between tries is configurable. :param lock_holder: String with the service name or command which is holding the lock. This lock_holder string will be customer visible in status.json. :param sleep_time: Number of seconds to sleep before retrying if the lock is already held. :param max_retries: Maximum number of times to try to grab the lock before giving up and raising a LockHeldError. :raises: LockHeldError if lock is held after (sleep_time * max_retries) ) sleep_time max_retriesrr8r9cGs||_||_||_dSr)rr8r9)rrr8r9_argsrrrres zRetryLock.__init__cCsVt\}}|dkrtj|j||dtttt |jdt j t j |jddS)Nr) lock_requestrpidr) operation)r2r LockHeldErrorrr#writerrosgetpidr addr OPERATION_IN_PROGRESS)rrcur_lock_holderrrr grab_lockps  zRetryLock.grab_lockc Cstd|jd} z|WdStjy?}z!td|d|j|d7}||jkr/|t |j WYd}~nd}~wwq )Nzspin lock starting for %srTz%RetryLock Attempt %d. %s. Spinning...) r,r-rrErr>msgr9timesleepr8)rtrieserrr __enter__s"  zRetryLock.__enter__cCstttjdSr)r#r3r remover rC)r _exc_type _exc_value _tracebackrrr__exit__szRetryLock.__exit__N) rrr__doc__rr)rrErLrQrrrrr5Ps   r5)"loggingr@rHtypingruaclientrrruaclient.data_typesrrruaclient.filesr uaclient.files.data_typesr r uaclient.files.filesr uaclient.files.noticesr getLoggerreplace_top_level_logger_namerr,rJSONr#r)rr2r4r5rrrrs(      *