+ if sitehist.db.status == 'good':
+ # clear penalty
+ # NOTE: because 'all clear' should have an indefinite status, we
+ # have a boolean value rather than a 'recent action'
+ if sitehist.db.penalty_applied or sitehist.db.penalty_pause:
+ # send message that penalties are cleared.
+
+ sitehist.clearPenalty()
+ sitehist.applyPenalty()
+ sitehist.sendMessage('clear_penalty')
+ sitehist.closeTicket()
+
+ print "send message for site %s penalty cleared" % site
+
+ # check all nodes and pcus for this site; if they're all ok,
+ # close the ticket, else leave it open.
+ # NOTE: in the case where a PCU reboots and fails, a message is
+ # sent, but the PCU may appear to be ok according to tests.
+ # NOTE: Also, bootmanager sends messages regarding disks,
+ # configuration, etc. So, the conditions here are 'good'
+ # rather than 'not down' as it is in sitebad.
+ close_ticket = check_node_and_pcu_status_for(site)
+ if close_ticket:
+ sitehist.closeTicket()