File: //usr/local/lib/python3.9/site-packages/agent360/plugins/__pycache__/plugins.cpython-39.pyc
a
q�dg� � @ 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 �B/usr/local/lib/python3.9/site-packages/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(t�t�}n
t�t�}|�tjd � t �
| �|�tjj
� dS )zL
Execution wrapper for the plugin
argv[1]: ini_file
N� r )�len�sys�argv�version_info�configparser�RawConfigParser�defaults�ConfigParser�read�pickle�dumpr �stdout�bufferr r r r �execute! s
zBasePlugin.executec C s( z| j d W S ty" i Y S 0 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 s2 z|| j d<