diff options
Diffstat (limited to 'healthcheck.py')
-rw-r--r-- | healthcheck.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/healthcheck.py b/healthcheck.py index 44115d7..498d785 100644 --- a/healthcheck.py +++ b/healthcheck.py @@ -53,13 +53,14 @@ class HealthCheck(object): self.logmsg("Service IP = %s, this IP = %s, last service IP = %s" % (service_ip, self.system_ip, self.last_address)) if (os.path.isfile(self.script_directory + "/frozen")): - self.logmsg("Frozen file exists") + if (self.last_state != States.Frozen): + self.logmsg("Frozen file exists") new_state = States.Frozen elif (os.path.isfile(self.script_directory + "/maintenance")): - self.logmsg("Maintenance file exists") + if (self.last_state != States.Maintenance): + self.logmsg("Maintenance file exists") new_state = States.Maintenance elif (self.last_state == States.Failed): - self.logmsg("In a failed state") new_state = States.Failed else: # The following logic ONLY works if: @@ -77,7 +78,7 @@ class HealthCheck(object): self.logmsg("We're the active node and we were passive, now starting up") new_state = States.StartingUp else: - self.logmsg("Now active ode with uncaught state of %s" % str(self.last_state)) + self.logmsg("Now active node with uncaught state of %s" % str(self.last_state)) elif (self.last_state == States.Active): # We were the active node - see if we are still healthy, # in which case we switch to passive, or if we have failed. @@ -119,7 +120,8 @@ class HealthCheck(object): self.logmsg("Active node with uncaught state of %s" % str(self.last_state)) else: # We're the passive node - self.logmsg("Passive node = passive state") + if (self.last_state != States.Passive): + self.logmsg("Passive node = passive state") new_state = States.Passive else: # Sanity checks failed = failed :-) @@ -139,6 +141,7 @@ class HealthCheck(object): new_response = last_response else: self.logmsg("Unmatched state of %s" % str(new_state)) + new_response = 500 # Clean up some of the trigger files if (new_state != States.Active): |