관리-도구
편집 파일: manager.cpython-36.pyc
3 �<�e� � @ s~ d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlj Z d dl mZ d dlm Z ejj� ZdgZG dd� de�ZdS )� N)�GlobalConfig)�commands�Managerc s� e Zd ZdZd� fdd� Zedd� �Zedd� �Zed d � �Zdd� Z d d� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zejfdd�Z� ZS ) r z? Manager creates plugin instances and keeps a track of them. Nc sJ t t| �j� || _|| _|| _|| _g | _g | _|p:t � | _ t� | _d S )N) �superr �__init__�_plugins_repository�_monitors_repository�_def_instance_priority�_hardware_inventory� _instances�_pluginsr �_configr �_cmd)�self�plugins_repositoryZmonitors_repositoryZdef_instance_priorityZhardware_inventory�config)� __class__� �/usr/lib/python3.6/manager.pyr s zManager.__init__c C s | j S )N)r )r r r r �plugins! s zManager.pluginsc C s | j S )N)r )r r r r � instances% s zManager.instancesc C s | j S )N)r )r r r r r ) s zManager.plugins_repositoryc C sF |j d krdS | jjtj�}|d kr0| jjd�}tj|j |tj �d k S )NTz /proc/cpuinfo) Z cpuinfo_regexr �get�constsZCFG_CPUINFO_STRINGr Z read_file�re�search� MULTILINE)r �unitZcpuinfo_stringr r r �_unit_matches_cpuinfo- s zManager._unit_matches_cpuinfoc C sH |j d krdS | jjtj�}|d kr2djtj� �}tj |j |tj �d k S )NT� )Zuname_regexr r r ZCFG_UNAME_STRING�join�os�unamer r r )r r Zuname_stringr r r �_unit_matches_uname6 s zManager._unit_matches_unamec C s2 g }x�t |j� �D ]�\}}|js0tjd| � q| j|�sJtjd| � q| j|�sdtjd| � q|jjd| j � t |jd �|jd<