}CeddlmZddlmZddlmZddlmZddlZddlmZddl Z ddl m Z m Z ddl mZmZdd lmZGd d eZGd d ZdS))absolute_import)division)print_function)DictN)sleep)is_testing_enabled_repoget_cl_version) is_ubuntuget_os_version)FormattedExceptionc eZdZdfd ZxZS)GroupInfoReaderErrorNc|d}tt|t|t||dS)NzEncountered an error while getting the remote available groups info. Try again later. If the same problem occurs again - contact CloudLinux support.)reason)messagecontextdetails)superr__init__dict)selfrrr __class__s /builddir/build/BUILDROOT/alt-python27-cllib-3.3.7-2.el7.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clcommon/group_info_reader.pyrzGroupInfoReaderError.__init__sh ?b  "D))22 F+++        )NN)__name__ __module__ __qualname__r __classcell__)rs@rrrs=           rrczeZdZdZdZdZdZdZedZ 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_url:s' = ..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) r r replace UBUNTU_BASEplatformmachinerr joinCL_BASE)r$r(ubuntu_versionsuffixarchrepo cl_versions rr#zGroupInfoReader._get_group_urlBs ;; 5 . 0 0 A~+33C==N:^:::F?V+ +#%%D!X--664D466D66HD'))J!t#++FE::JXXdFCDDF;+f4 4rc |j|jS|}|tddd}t|D]} t j||_|jcS#tjj$r^}|dz|kr9d|d}td ||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.)rzUnable 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%rrangerequestsgetr/ exceptionsRequestExceptionformatstrr)r$urlattemptsiex err_messages rget_available_groupsz$GroupInfoReader.get_available_groups_s: > %> !mmoo ;&71 x  A !)c!2!2!7!7!9!9~%%%&7   q5H$$#7S#7#7#7K//66s;; + #B  a!e   s 1A>>C0AC++C0ci}|}|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)rKrAupdate)r$group group_infoavailable_groupsgrps rget_group_infozGroupInfoReader.get_group_infosp 3355#'' r:: O OC||!!3(8(G(L"MNNNr) rrr__doc__r>r"r5r1 classmethodr%r#rKrSrrr r &s  JI2GBK[55[58""["H[rr ) __future__rrrtypingrr2timerr@clcommon.utilsrr clcommon.lib.cleditionr r clcommon.clexceptionr rr rVrrr]s'&&&&&%%%%%%BBBBBBBB<<<<<<<<333333      -    ppppppppppr