X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=nodebad.py;h=dc866645eba29d39184df4544391e3b19bfea537;hb=17447cbba68069b0bf043f25ae75f86a0ccc26f7;hp=acd5007a901ce7bbcc7963b18918bdc9195f48a0;hpb=40884a302bf204a7f42044b72d87f9431ad6dd35;p=monitor.git diff --git a/nodebad.py b/nodebad.py index acd5007..dc86664 100755 --- a/nodebad.py +++ b/nodebad.py @@ -6,7 +6,7 @@ import string import time from datetime import datetime,timedelta -from nodequery import verify,query_to_dict,node_select +from monitor.query import verify,query_to_dict,node_select from monitor.common import * @@ -79,15 +79,19 @@ def check_node_state(rec, node): print "changed status from %s to offline" % node.status node.status = 'offline' node.last_changed = datetime.now() - - if node_state == 'DEBUG' and node.status not in ['failboot', 'disabled', 'safeboot']: + + if node_state == 'DEBUG': if boot_state != 'disabled' and boot_state != 'safeboot': print "changed status from %s to failboot" % (node.status) - node.status = "failboot" - node.last_changed = datetime.now() + current_status = "failboot" else: print "changed status from %s to %s" % (node.status, boot_state) - node.status = boot_state + current_status = boot_state + + if current_status != node.status and \ + current_status in ['failboot', 'disabled', 'safeboot']: + + node.status = current_status node.last_changed = datetime.now() if node_state == 'BOOT' and node.status != 'online' and node.status != 'good':