????
Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/__pycache__/ |
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/__pycache__/cllicenselib.cpython-311.opt-1.pyc |
� Ck�e � �& � d dl mZ d dl mZ d dlmZmZ d dlZd dlZd dlZd dl Z d dl Z d dlZd dlZd dl Zd dlmZ d dlmZ dZdZd Zej � e� � Zd Zej � ed� � Zej � ed� � Zej � ed � � Z ed�� � rdndZdZdZ dZ!e!dd�e dd�d�Z"dZ# G d� d� � Z$ e$� � Z%de&fd�Z'de&de(fd�Z)d � Z*d!� Z+d"� Z,d#� Z-d$� Z.d%� Z/d&� Z0dS )'� )�print_function)�absolute_import)�request�errorN)�mod_makedirs)�is_cl_solo_editionz/usr/sbin/rhn_checkz/usr/sbin/rhnreg_ksz/var/lve/lveinfo.verz/etc/sysconfig/rhn�systemidz jwt.token�jwt_last_update_tsT)�skip_jwt_checki i�� i@8 z1/usr/share/cloudlinux/no_valid_license_screen.txtz3/usr/share/cloudlinux/license_out_of_date_email.txtz3Error: License out of date, email template missing.)� template_file� error_msgz3Error: No valid license found, template is missing.)�Email�NoValidz http://cloudlinux.com/showip.phpc �N � e Zd ZdZdZdZed� � � Zd� Zd� Z d� Z d� Zd� ZdS ) �LicenseData� c �j � t j � t � � r�t j � t � � sdS t t j � t � � � � }|t t j � � � � t z k rdS t t � � }||k rdS dS t j � t � � rGt j � t � � }|t j � | � � k S dS )a� Update license when: in case JWT token present: - if no timestamp file with jwt token last update time - if jwt token was not updated during last 4 hours - if jwt token was updated later than our timestamp in file in case JWT token is not present, but systemid exists (fallback for licensing w/o token) - update license only if systemid was changed after last timestamp update when no jwt and no systemid - re-update license TF)�os�path�exists� JWT_TOKEN�JWT_TOKEN_TIMESTAMP_FILE�int�getmtime�time�JWT_UPDATE_INTERVAL�read_time_from_file�RHN_SYSTEMID)�license_timestamp_file�rhn_updated�jwt_last_update_timestamps �py/cllicenselib.py�_is_license_needs_updatez$LicenseData._is_license_needs_updateI s� � � �W�^�^�I��� A� �'�.�.�1� 2� 2� ��4��R�W�%�%�i�0�0�1�1�;��C�� ���$�$�':�:�:�:��4�2�3K�L�L���+�-�-��4� �%� �w�~�~�l�#�#� A���!�!�,�/�/�;� ���(�(�)?�@�@� @�@� �� c �Z � t |� � | _ t t j � � � � | j z t k rG| � |� � rt � � S t j � t � � S dS # t t j f$ r Y dS w xY w)z� Checks license: 1. Reads cache file with timestamp 2. Ensures license must be re-checked: - if timestamp in cache file > CACHE_TIME -> check if we need to re-update licensing TF)r �_license_last_timestampr r � CACHE_TIMEr# �update_license_timestamp_filer r r r �IOError�structr )�selfr s r"