Commit 87d0825d authored by Jameson Rollins's avatar Jameson Rollins

WIP: system manager variable

parent 4c819122
Pipeline #47048 passed with stages
in 39 seconds
......@@ -93,7 +93,7 @@ class CADriver(pcaspy.Driver):
elif channel == 'MODE':
# value as string
mode = guarddb['MODE']['enums'][value]
# reject attempts to set MANAGED mode directrly without
# reject attempts to set MANAGED mode directly without
# specifying manager
if mode == 'MANAGED':
return False
......
......@@ -97,13 +97,17 @@ class Daemon(object):
# set initial values
self['TIME_INIT'] = int(time.time())
self['OP'] = initial_op
self['MODE'] = initial_mode
self['LOGLEVEL'] = self.default_loglevel
self['STATE'] = initial_state or 'INIT'
self['TARGET'] = self['STATE']
self['REQUEST'] = initial_request or self.system.request or 'NONE'
self['NOMINAL'] = self.system.nominal or 'NONE'
if self.system.manager:
self['MANAGER'] = self.system.manager
self['MODE'] = 'MANAGED'
else:
self['MODE'] = initial_mode
self['OP'] = initial_op
self['SPM_MONITOR'] = self.system.ca_monitor
self['SPM_MONITOR_NOTIFY'] = self.system.ca_monitor_notify
self['STATUS'] = 'INIT'
......@@ -334,6 +338,9 @@ guardian version: {}
if newnom != self['NOMINAL']:
self['NOMINAL'] = newnom
self.log.info("new nominal state: %s" % self['NOMINAL'])
if self.system.manager:
self['MANAGER'] = self.system.manager
self['MODE'] = 'MANAGED'
if self.system.ca_monitor != self['SPM_MONITOR']:
self['SPM_MONITOR'] = self.system.ca_monitor
self.log.info("CA setpoint monitor: %s" % self['SPM_MONITOR'])
......
......@@ -128,6 +128,7 @@ class GuardSystem(object):
# reset parameters loaded from module
self._initial_request = None
self._nominal_state = None
self._manager = None
self._node_managers = {}
# don't recorgnize ca_prefix changes on reset
self._ca_monitor = False
......@@ -477,6 +478,12 @@ class GuardSystem(object):
else:
self._nominal_state = None
# set manager
if hasattr(module, '_MANAGER'):
self._manager = module._MANAGER
else:
self._manager = None
# add specified edges
if hasattr(module, 'edges'):
# verify states
......@@ -600,6 +607,11 @@ class GuardSystem(object):
"""Initial NOMINAL state."""
return self._nominal_state
@property
def manager(self):
"""Initial manager."""
return self._manager
@property
def graph(self):
"""System state graph object."""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment