This is the main interface class for SysPolicy that's designed to be
used from the user interface side, eg. from the CLI interface
packages.
This intends to provide all the features of the core library that need
to be exposed to the developers of user interfaces or other software
based on SysPolicy's functionality.
|
|
__init__(self,
configfile,
debug=False)
Initialize the PolicyTool by loading the configuration and all
policies, modules, setting up locking mechanisms and starting the
background Worker process. |
source code
|
|
|
|
set_state(self,
type,
path,
value)
This function updates the state of one of the policies. |
source code
|
|
|
|
save_state(self)
This function saves the internal state for each policy. |
source code
|
|
|
|
clear_state(self)
This function clears all the internal states of all policies. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
emit_event(self,
event,
changeset=None)
This function emits an event of type `event`, calling all the
registered handler functions for this event type. |
source code
|
|
|
|
get_policy_diff(self)
This function returns the difference between the policies and their
previously known states, finding changed values. |
source code
|
|
|
|
get_policy_updates(self)
This function returns a list of ChangeSets that must be implemented
to accommodate the changes the user has made to the policy files. |
source code
|
|
|
|
|
|
|
|
|
|
|
|
|
accept_changeset(self,
changeset,
accepted=True)
This module updates the state of a ChangeSet to either be
STATE_ACCEPTED if accepted is True or STATE_REJECTED otherwise. |
source code
|
|
|
|
accept_state_changes(self)
This function automatically accepts all proposed ChangeSets that
contain only 'set_state' operations in the 'state' subsystem. |
source code
|
|
|
|
|
|
|
|
|
|
conf = None
main configuration object (Config class instance)
|
|
|
debug = False
whether or not SysPolicy is running in debug mode
|
|
|
policy = None
dictionary of all the policies defined in the main conf
|
|
|
state = None
respective state objects for the policies
|
|
|
handler = None
attribute handlers for all the policies
|
|
|
events = None
event hooks by event type
|
|
|
module = None
loaded extension modules
|
|
|
module_locks = None
locks for the loaded modules
|
|
|
changesets = None
ChangeSets that have been proposed or worked on
|
|
|
cs_mlock = None
master lock for the changesets
|
|
|
cs_locks = None
dictionary of individial locks for all ChangeSets
|
|
|
worker = None
Worker instance for background processing of ChangeSets
|