%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/clwizard/modules/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python37/lib/python3.7/site-packages/clwizard/modules/__pycache__/base.cpython-37.pyc

B

�2Lbp�@s�ddlmZddlZddlmZddlmZddlmZm	Z	m
Z
ddlmZm
Z
mZmZmZmZmZddlmZmZddlmZdd	lmZGd
d�de�ZdS)�)�absolute_importN)�abstractmethod)�cpapi)�List�Dict�Optional)�run_command�ExternalProgramFailed�is_package_installed�get_rpm_db_errors�get_passenger_package_name�is_ea4�get_cl_version)�convert_package_version�setup_logger)�GroupInfoReader)�InstallationFailedExceptionc@s�eZdZdZdZdZdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Ze
dd��Zedd��Zedd��Zedd��Zedd��ZdS)�WizardInstallerz2
    General interface for modules installers
    �NcCstd|jj|j�|_dS)Nzwizard.)r�	__class__�__name__�LOG_FILE�
app_logger)�self�r�F/opt/alt/python37/lib/python3.7/site-packages/clwizard/modules/base.py�__init__&szWizardInstaller.__init__c
Cs�|j�d�|j�dd�|��yt|�}Wn@tk
rl}z"|j�d�|j�t|���Wdd}~XYnX|j�d�|j�|�|j�d�|S)z!Run external tool and log resultsz<~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~zExecuting command %s...� zK...external command failed, see following lines for tracebacks, errors, etcNz3...external command successfully ended with output:z<------------------------------------------------------------)r�info�joinrr	�error�str)r�cmd�output�errr�_run_command)szWizardInstaller._run_commandcCs0t�}|r(d||f}|j�|�t��t|�S)z!Check if package exists on serverz+Can't check package %s presence. Errors:
%s)rrr rr
)rZpackage_nameZ
error_messageZlog_messagerrr�_is_package_installed>sz%WizardInstaller._is_package_installedcGs |r|�dddgt|��SdS)z#Install yum package and log results�yumZinstallz-yN)r%�list)rZpackagesrrr�_install_yum_packageIsz$WizardInstaller._install_yum_packagecGs |r|�dddgt|��SdS)z.Install package group with yum and log resultsr'Zgroupinstallz-yN)r%r()r�groupsrrr�_install_yum_groupsQsz#WizardInstaller._install_yum_groupscCshd}tj�|�rdSt�pd}d|kr,d}nd|kr:d}ntd��d�|�}|j�d|�|�|�dS)	z�
        Check whether cloudlinux-ea4.repo is present and install it if not.
        It's required only on EA4 to install proper Passenger package
        z$/etc/yum.repos.d/cloudlinux-ea4.repoNZUnknown�7�6z(Failed to get distribution major versionzVhttps://repo.cloudlinux.com/cloudlinux/EA4/cloudlinux-ea4-release-latest-{}.noarch.rpmzFUnable to find cloudlinux-ea4 repo. Trying to install it using url: %s)	�os�path�existsrr�formatrrr))rZcl_ea4_repofileZdistZdist_maj_verZpackage_urlrrr�_ensure_cl_ea4_repo_existsYs 
z*WizardInstaller._ensure_cl_ea4_repo_existscCsPt�r|��t�}|j�d|�y|�|�Wntk
rJt��YnXdS)zb
        Install proper passenger package for Selectors if it's not yet
        installed
        z'Trying to install Passenger package: %sN)r
r2rrrr)r	r)rZ	passengerrrr�_install_passengertsz"WizardInstaller._install_passengercCsJt�|�}g}|dkrdnd}x&|D]}|�t||d|d��q$W|S)z�
        For python, nodejs, php and ruby modules we want to get
        list of available versions per group
        :param group - group name, e.g: python
        :return list of available versions
        Znodejs���version)Zversion_size)rZget_group_info�appendr)�groupZavailable_groups_infoZversionsZver_sizeZgrprrr�_get_available_versions�s	

z'WizardInstaller._get_available_versionscCs
t��dS)N)�NotImplementedError)rZoptionsrrr�run_installation�sz WizardInstaller.run_installationcCst�S)N)�set)�clsrrr�supported_options�sz!WizardInstaller.supported_optionscCs
t��dS)z�
        Method that returns dictionary with two required keys:
        {installed: True|False and options: {...}]
        This will be used by lvemanager to properly display wizard.
        N)r:)rrrr�initial_status�szWizardInstaller.initial_statuscCs|jdkrdSt�|j�S)z9
        Checks whether we must
        :return:
        NT)�_REQUIRED_CL_COMPONENT_SUPPORTrZis_panel_feature_supported)r=rrr�is_supported_by_control_panel�s
z-WizardInstaller.is_supported_by_control_panel)r�
__module__�__qualname__�__doc__rr@rr%r&r)r+r2r3�staticmethodr9rr;�classmethodr>r?rArrrrrs
r)Z
__future__rr.�abcrZclcommonr�typingrrrZclcommon.utilsrr	r
rrr
rZclwizard.utilsrrZclcommon.group_info_readerrZclwizard.exceptionsr�objectrrrrr�<module>	s$	

Zerion Mini Shell 1.0