deprecate www directory and its legacy scripts
[monitor.git] / nodebad.py
index acd5007..dc86664 100755 (executable)
@@ -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':