Package pyhai :: Package plugins :: Class AuditorPlugin
[hide private]
[frames] | no frames]

Class AuditorPlugin

source code

object --+
         |
        AuditorPlugin
Known Subclasses:

An ABC class to enforce a common plugin interface

Nested Classes [hide private]
  __metaclass__
Metaclass for defining Abstract Base Classes (ABCs).
Instance Methods [hide private]
dict
__init__(self, profile, running_audit_results, *args, **kwargs)
You probably shouldn't overwrite this method unless you know what you're doing and even then you should be careful and call Plugin.__init__.py at some point.
source code
 
__set_results(self, results)
Ensures that only dict types are stored in the __results instance var
source code
dict
_get_results(self)
Returns results
source code
 
after(self, *args, **kwargs)
Overwrite in subclass as necessary Will be called first during init
source code
 
before(self, *args, **kwargs)
Overwrite in subclass as necessary Will be called first during init
source code
 
fail(self, exc, msg=None, *args)
Overwrite in subclass as necessary Will be called for any exceptions raised for before, run, or after methods
source code
dict | str
get_profile(self, key=None)
Gets the entire profile dictionary, a list of items or a single key from the profile dictionary
source code
 
run(self, *args, **kwargs)
Will be called after the before hook.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  __abstractmethods__ = frozenset(['run'])
  __profile = None
  __results = None
  _abc_cache = <_weakrefset.WeakSet object at 0x0000000002CA0048>
  _abc_negative_cache = <_weakrefset.WeakSet object at 0x0000000...
  _abc_negative_cache_version = 10
  _abc_registry = <_weakrefset.WeakSet object at 0x0000000002C9C...
  _running_audit = None
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, profile, running_audit_results, *args, **kwargs)
(Constructor)

source code 

You probably shouldn't overwrite this method unless you know what you're doing and even then you should be careful and call Plugin.__init__.py at some point. Swim at your own risk

Parameters:
  • profile (dict) - A dictionary containing this host's profile
  • running_audit_results (dict) - A dictionary of the results of all the plugins that have run up to "now"
Returns: dict
A dictionary of results from the plugin's run
Overrides: object.__init__

__set_results(self, results)

source code 

Ensures that only dict types are stored in the __results instance var

Parameters:
  • results (dict) - The results from the plugin_hooks or the run **MUST be a dict or will raise an exception

_get_results(self)

source code 

Returns results

Returns: dict
Results of the run

get_profile(self, key=None)

source code 

Gets the entire profile dictionary, a list of items or a single key from the profile dictionary

Parameters:
  • key (list | str) - Providing a string returns a single value from the profile dictionary, providing an array, returns a slice of the profile dictionary, omitting this param returns the entire profile dictionary
Returns: dict | str
Mixed... part or all of the profile dictionary

run(self, *args, **kwargs)

source code 

Will be called after the before hook. This is the only "required" method for plugins

Decorators:
  • @abc.abstractmethod

Class Variable Details [hide private]

_abc_negative_cache

Value:
<_weakrefset.WeakSet object at 0x0000000002CA00B8>

_abc_registry

Value:
<_weakrefset.WeakSet object at 0x0000000002C9CF60>