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<