IQg%ddlZddlmZddlmZddlZddlmZmZm Z m Z ddl m Z Gdde Z Gdd ZdS) N)sleep)Dict)is_testing_enabled_repoget_cl_version is_ubuntuget_os_version)FormattedExceptionc eZdZdfd ZxZS)GroupInfoReaderErrorNc^|d}t|d|i|ddS)NzEncountered an error while getting the remote available groups info. Try again later. If the same problem occurs again - contact CloudLinux support.reason)messagecontextdetails)super__init__)selfr rr __class__s z/builddir/build/BUILD/imunify360-venv-2.5.0/opt/imunify360/venv/lib/python3.11/site-packages/clcommon/group_info_reader.pyrzGroupInfoReaderError.__init__sS ?b   &)       )NN)__name__ __module__ __qualname__r __classcell__)rs@rr r s=           rr czeZdZdZdZdZdZdZedZ edZ edZ edZ dS) GroupInfoReaderaZ The purpose of this class is to get remote yum info about available groups: 1. alt-php 2. alt-nodejs 3. alt-ruby 4. alt-python There we get special url with json which depends on machine features: cl version: 6, 7, 6 hybrid architecture: x84_64, i386 enabled testing repositories status: beta, stable Nz"https://repo.cloudlinux.com/other/z.https://repo.cloudlinux.com/cloudlinux-ubuntu/cP|j||_|jS)z"Get url with available groups json) GROUP_URL_get_group_url)clss r group_urlzGroupInfoReader.group_url4s' = ..00CM}rctr7t\}}|dd}d|d}|j|zSt j}|dkrdn|}t rdnd}t}|d S|d d }dd ||d g}|j |z|zS)a Final url example for CloudLinux: https://repo.cloudlinux.com/other/cl6/package-info.x86_64.stable.json Final url example for Ubuntu: https://repo.cloudlinux.com/cloudlinux-ubuntu/package-info.20_04.json for cl6, arch x86_64 and disabled testing: stable :return: string with the result url or None if the CL version cannot be identified ._z package-info.z.jsonx86_64i386betastableNcl7hcl7z /package-infojson) rrreplace UBUNTU_BASEplatformmachinerrjoinCL_BASE)r r$ubuntu_versionsuffixarchrepo cl_versions rrzGroupInfoReader._get_group_url<s ;; 5 . 0 0 A~+33C==N:^:::F?V+ +#%%D!X--664D466D66HD'))J!t#++FE::JXXdFCDDF;+f4 4rc |j|jS|}|tddd}t|D]} t j|d|_|jcS#tjj$rN}|dz|kr)d |d }t|d |t| |t|dzYd}~d}~wwxYwiS) zv Sends request to group url, gets json and converts it to dict :return: dict with groups info Nz%Could not identify CloudLinux versionzCould not identify CloudLinux version (using kernel version). Restart your system. If the same problem occurs again - contact CloudLinux support.)r)timeoutzUnable to reach z. Check your internet connection or try again later. If the same problem occurs again - contact CloudLinux support.z - link unavailable)rr) GROUP_INFOr!r rangerequestsgetr+ exceptionsRequestExceptionstrr)r urlattemptsiex err_messages rget_available_groupsz$GroupInfoReader.get_available_groupsYs: > %> !mmoo ;&71 x  A !)c2!>!>!>!C!C!E!E~%%%&7   q5H$$#7S#7#7#7K/333 + #B  a!e   s 3BC"ACC"ci}|}|diD])}||vr#|||d|i*|S)a Filter dict with all available groups by special group name E.g: group = python we will get dict like that: {'alt-python27': {'version': '2.7.15', 'name': 'alt-python27', 'release': '1.el6'}, 'alt-python33': {'version': '3.3.3', 'name': 'alt-python33', 'release': '1.el6'}, 'alt-python34': {'version': '3.4.4', 'name': 'alt-python34', 'release': '1.el6'}...} :param group :rtype: dict with info per group groups_info)rHr?update)r group group_infoavailable_groupsgrps rget_group_infozGroupInfoReader.get_group_info~sp 3355#'' r:: O OC||!!3(8(G(L"MNNNr) rrr__doc__r<rr1r- classmethodr!rrHrPrrrr s  JI2GBK[55[58""["H[rr)r.timertypingrr>clcommon.utilsrrrrclcommon.clexceptionr r rrSrrrXs]]]]]]]]]]]]333333      -    ppppppppppr