bk 0 d dl Z d dlZ G d d ZdS ) Nc . e Zd Zd Zd Zd Zd ZddZdS )CloudlinuxLicenseLibc 0 d| _ d| _ d| _ d S )Nz/usr/bin/cldetectz/usr/sbin/clnreg_ksz/usr/sbin/clncheck)_CLDETECT_UTILITY_CLNREG_KS_UTILITY_CLNCHECK_UTILITYselfs py/cllicense/license_lib.py__init__zCloudlinuxLicenseLib.__init__ s !4"7!5 c t j | j ddgt j t j 5 }| |j dk cddd S # 1 swxY w Y dS )zr
Checks Cloudlinux license
:return: True - license valid
False - invalid
z--check-licensez-qstdoutstderrr N)
subprocessPopenr PIPEcommunicate
returncode)r
procs r get_license_statusz'CloudlinuxLicenseLib.get_license_status s
#%6=??
( ?a'
( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (s A A$'A$c J t j | j S N)ospathisfiler r s r is_edition_migration_availablez3CloudlinuxLicenseLib.is_edition_migration_available$ s w~~d4555r
c t j | j d|gt j t j 5 }| ddd dS # 1 swxY w Y dS )zp
Register and update Cloudlinux license by key
:param key: License key
:return:
z--update-new-keyr N)r r r r r )r
keyr s r "register_and_update_license_by_keyz7CloudlinuxLicenseLib.register_and_update_license_by_key( s
#%7=??
s AAANc ||dk r| j dg}| r| d t j |t j t j 5 }| ddd n# 1 swxY w Y ||dk rat j | j dgt j t j 5 }| ddd dS # 1 swxY w Y dS dS )a
Register and update Cloudlinux license by IP
:param stage: Registraton stage.
None - all stages. Normal mode
'clnreg_ks' - only clnreg_ks. Only for tests
'cldetect' - only cldetect. Only for tests
:return:
N clnreg_ksz--forcez--migrate-silentlyr cldetectz--update-license)r r appendr r r r r )r
stage
clnreg_cmdr s r !register_and_update_license_by_ipz6CloudlinuxLicenseLib.register_and_update_license_by_ip6 s =E[0019=J2244
8!!"6777!!!
# """
#
#
#
#
#
#
#
#
#
#
#
#
#
#
# =EZ//!');<!!
# """
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
# 0/s$ &BBBC..C25C2r )__name__
__module____qualname__r r r r! r( r
r r r sd 6 6 6
(
(
(6 6 6 # # # # # #r
r )r r r r, r
r