summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Colmer <philip.colmer@linaro.org>2014-01-22 14:09:34 +0000
committerPhilip Colmer <philip.colmer@linaro.org>2014-01-22 14:09:34 +0000
commitaa1d43b09683e69c7d3625ad27e8e6537a588690 (patch)
tree731b7a93f2970666063f4e39eac35fd9a33c1849
parentad5258a65558d5673610b752f875c8c773c12262 (diff)
downloadlinaro-healthcheck-aa1d43b09683e69c7d3625ad27e8e6537a588690.tar.gz
Reduced logging output from healthcheck
-rw-r--r--healthcheck.py13
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):