-from monitor import reboot
from monitor.common import *
from monitor.model import *
from monitor.wrapper import plc
from monitor.wrapper import plccache
from monitor.wrapper.emailTxt import mailtxt
from monitor.database.info.model import *
+# NOTE: must import this after monitor.database.info.model b/c that imports
+# pcucontro.reboot and blocks this version, if it comes last.
+from monitor import reboot
class SiteInterface(HistorySiteRecord):
@classmethod
return
- def pausePenalty(self):
+ def setPenaltyPause(self):
+ self.db.penalty_pause = True
+ self.db.penalty_pause_time = datetime.now()
act = ActionRecord(loginbase=self.db.loginbase,
action='penalty',
action_type='pause_penalty',)
#act = ActionRecord(loginbase=self.db.loginbase, action='penalty', action_type='clear_penalty',)
self.db.penalty_level = 0
self.db.penalty_applied = False
+ self.clearPenaltyPause()
+
+ def clearPenaltyPause(self):
+ self.db.penalty_pause = False
+ self.db.penalty_pause_time = None
def getTicketStatus(self):
if self.db.message_id != 0:
self.db.message_status = rtstatus['Status']
self.db.message_queue = rtstatus['Queue']
self.db.message_created = datetime.fromtimestamp(rtstatus['Created'])
+ #self.db.message_last_reply = datetime.fromtimestamp(rtstatus['Told'])
def setTicketStatus(self, status):
print 'SETTING status %s' % status
# those errors.
args = {'loginbase' : self.db.loginbase,
- 'penalty_level' : self.db.penalty_level,
+ 'penalty_level' : -self.db.penalty_level,
'monitor_hostname' : config.MONITOR_HOSTNAME,
'support_email' : config.support_email,
'plc_name' : config.PLC_NAME,
def runBootManager(self, hostname):
from monitor import bootman
print "attempting BM reboot of %s" % hostname
- ret = ""
+ ret = "error"
try:
ret = bootman.restore(self, hostname)
err = ""
err = traceback.format_exc()
print err
+ # TODO: keep this record so that the policy.py can identify all
+ # bootmanager_* actions without explicitly listing every kind.
act = ActionRecord(loginbase=self.db.loginbase,
hostname=hostname,
action='reboot',
action_type='bootmanager_restore',
+ error_string="")
+
+ if ret:
+ act = ActionRecord(loginbase=self.db.loginbase,
+ hostname=hostname,
+ action='reboot',
+ action_type='bootmanager_' + ret,
error_string=err)
return ret