Sindbad~EG File Manager
3
�uGh� � @ sF d dl Z d dlZd dlZejdkr,d dlZnd dlZG dd� d�ZdS )� N� c @ sJ e Zd ZdZdZ g fdd�Zddd�Zdd � Zd
d� Zdd
� Zdd� Z dS )�
BasePluginz$
Abstract class for plugins
� c C s t |t�r|| _ntd��d S )Nz#Type of agent_cache have to be list)�
isinstance�list�agent_cache� TypeError)�selfr � r
�A/root/tmp/pip-build-gzoz1_uw/agent360/agent360/plugins/plugins.py�__init__ s
zBasePlugin.__init__Nc C s dS )z7
Virtual method for running the plugin
Nr
)r �configr
r
r �run s zBasePlugin.runc C s\ d}t tj�dkrBtjdkr(tjt�}n
tjt�}|jtjd � t j
| j|�tjj
� dS )zL
Execution wrapper for the plugin
argv[1]: ini_file
N� r )r )�len�sys�argv�version_info�configparser�RawConfigParser�defaults�ConfigParser�read�pickle�dumpr �stdout�buffer)r r
r
r
r �execute! s
zBasePlugin.executec C s$ y
| j d S tk
r i S X dS )zE
Return agent cached value for this specific plugin.
r N)r � Exception)r r
r
r �get_agent_cache/ s
zBasePlugin.get_agent_cachec C s4 y|| j d<