관리-도구
편집 파일: selector_usage_lib.cpython-36.opt-1.pyc
3 X4sg3 � @ s� d dl Z d dlmZ d dlZd dlmZmZmZ G dd� de�Z dd� Z dd � Zd d� Zdd � Z dd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� ZdS )&� N)�deepcopy)�pretty_version_keys� cpanel_whmapi�dump_loaded_modulesc @ s e Zd ZdZdS )�SelectorStatExceptionz Inner exception class N)�__name__� __module__�__qualname__�__doc__� r r �/selector_usage_lib.pyr s r c C s dj tjd��j� } | dkS )z� Check status of cagefs - installed & enabled If not - selector is not applied, no need to query its settings :return: True is cagefs is installed and enabled, False otherwise � z#/usr/sbin/cagefsctl --cagefs-statusZEnabled)�join�exec_command�strip)Z cagefs_statusr r r �cagefs_enabled s r c c sf dj tjd��} ytj| �jd�}W n tk r< f }Y nX x"|D ]}|d }|dkrD|V qDW dS )z` Retrieve versions from selector, EXCEPT native :return: selector versions iterator r z%/usr/bin/selectorctl --summary --jsonZPHPConfiguration�version�nativeN)r r �json�loads�get� ValueError)Z selector_data�selector_versions�item�verr r r �get_selector_versions'