HEX
Server: Apache
System: Linux insrv.serversdaddy.com 5.14.0-362.24.2.el9_3.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Mar 30 14:11:54 EDT 2024 x86_64
User: jsaha (1066)
PHP: 8.3.6
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/alt/python37/lib/python3.7/site-packages/clconfigure/__pycache__/watcher.cpython-37.opt-1.pyc
B

��P-\����@s�ddlZddlZddlZddlZddlZddlmZmZddlm	Z	e�
dde	�ZdZdZ
dZd	Zd
eZdd�Zd
d�Zdd�Zdd�Zdd�Zded�dd�Zdd�ZdS)�N)�
CLEditions�CLEditionDetectionError)�PKG_VERSIONz\.el\w(h?)\.z.elX.zehttps://9713d1296f804031b058b8f2d789d7ac:8ddacae32d8246cf8b25cf826bf3fc0a@cl.sentry.cloudlinux.com/12z/var/lve/.edition.previousz/etc/sysconfig/rhn/systemidi�Q�cCs(tjd|rdndd|gddtjd�dS)z$
    Run reconfiguration script
    z/usr/sbin/cloudlinux-customizerZpreconfigure�reconfigurez-tT)�check�text�stderrN)�
subprocess�runZSTDOUT)�current_edition�is_pre_check�r�py/clconfigure/watcher.py�_reconfigure_server!s

rcCst||�dS)z?
    Called when saved edition does not match current one.
    N)r)Zprevious_editionrr
rrr�_on_edition_changed0srcCst||�dS)zI
    Called when saved server id detected as one registered recently
    N)r)rr
rrr�_on_server_newly_registered7srcCs&ytj�t�Stk
r dSXdS)zV
    Assume that last registration time is
    the date of systemid modification.
    N)�os�path�getmtime�SYSTEMID_FILE_PATH�FileNotFoundErrorrrrr�_get_registration_time>srcCs&ytj�t�Stk
r dSXdS)zZ
    Assume that last check time is equal
    to the date of last cache modification.
    N)rrr�LAST_KNOWN_EDITION_CACHE_PATHrrrrr�_get_last_check_timeIsrF)�new_editionc	Cs�y tt��}|��}WdQRXWntk
r8d}YnXt�}|dk	oV|t��tk}t�}|dkpt|dk	ot||k}|r�|r�t||�n|r�||kr�t	|||�|s�t
|d�dS)a	
    Compares current edition with latest saved in file and
    @param new_edition:
        provides information about new edition that server is using
        Depending on is_pre_check this edition can either be already applied
        or just planning to be installed
    @param is_pre_check:
        True means that current check is executed BEFORE
        new jwt is actially saved in jwt.token file

        False means that registration is complete and jwt.token file
        was updated with new edition token
    N)�edition)�openr�readrr�time�SYSTEMID_NEW_TIMErrr�save_edition)rr
�fZlast_editionZregistration_timeZis_registration_freshZlast_check_timeZ!is_last_check_before_registrationrrrrTs$

rc
CsXy$ttd��}|�|�WdQRXWn.tk
rR}zt�d|�Wdd}~XYnXdS)z4
    Stores current edition value in cache file
    �wNz*Unable to detect current edition, error=%s)rr�writer�loggingZwarning)rr"�errrr!}s
r!)F)r%r�rer
rZclcommon.lib.cleditionrrZ	lve_utilsr�subZPKG_VERSION_TINYZ
SENTRY_DSNrrZ_SECONDS_IN_DAYr rrrrr�strrr!rrrr�<module>s&)