[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] conga/luci/site/luci/Extensions cluster_adapte ...



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	jparsons sourceware org	2006-10-12 20:48:48

Modified files:
	luci/site/luci/Extensions: cluster_adapters.py 
	                           conga_constants.py 

Log message:
	fixed busy flag logic error

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.104&r2=1.105
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&r1=1.15&r2=1.16

--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/12 19:40:44	1.104
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/10/12 20:48:48	1.105
@@ -2234,6 +2234,10 @@
   path = CLUSTER_FOLDER_PATH + cluname
   clusterfolder = self.restrictedTraverse(path)
   items = clusterfolder.objectItems('ManagedSystem')
+  if len(items) == 0:
+    return map  #This returns an empty map, and should indicate not busy
+  else:
+    map['busy'] = "true"
   #Ok, here is what is going on...if there is an item,
   #we need to call the ricci_bridge and get a batch report.
   #This report will tell us one of three things:
@@ -2261,11 +2265,22 @@
       ricci = item[0].split("____") #This removes the 'flag' suffix
       try:
         rc = RicciCommunicator(ricci[0])
-        batch_xml = rc.batch_report(item[1].getProperty(BATCH_ID))
-        (creation_status, total) = batch_status(batch_xml)
       except:
         creation_status = RICCI_CONNECT_FAILURE  #No contact with ricci (-1000)
 
+      batch_xml = rc.batch_report(item[1].getProperty(BATCH_ID))
+      if batch_xml == None:  #The job is done and gone from queue
+        if redirect_message == False: #We have not displayed this message yet
+          node_report['desc'] = REDIRECT_MSG
+          node_report['iserror'] = True 
+          node_report['errormessage'] = ""
+          nodereports.append(node_report)
+          redirect_message = True
+        clusterfolder.manage_delObjects(item[0])
+        continue
+
+      (creation_status, total) = batch_status(batch_xml)
+
       if creation_status < 0:  #an error was encountered
         if creation_status == RICCI_CONNECT_FAILURE:
           laststatus = item[1].getProperty(LAST_STATUS)
@@ -2307,7 +2322,8 @@
         continue
       else:  #either batch completed successfully, or still running
         if creation_status == total:  #finished...
-          node_report['statusmessage'] = "Node created successfully"
+          map['busy'] = "true"
+          node_report['statusmessage'] = "Node created successfully" + REDIRECT_MSG
           node_report['statusindex'] = creation_status
           nodereports.append(node_report)
           clusterfolder.manage_delObjects(item[0])
@@ -2331,7 +2347,7 @@
       rb = ricci_bridge(ricci[0])
       finished = rb.checkBatch(item[1].getProperty(BATCH_ID))
       if finished == True:
-        node_report['desc'] = item[1].getProperty(FLAG_DESC)
+        node_report['desc'] = item[1].getProperty(FLAG_DESC) + REDIRECT_MSG
         nodereports.append(node_report)
         clusterfolder.manage_delObjects(item[0])
       else:
--- conga/luci/site/luci/Extensions/conga_constants.py	2006/10/12 19:40:44	1.15
+++ conga/luci/site/luci/Extensions/conga_constants.py	2006/10/12 20:48:48	1.16
@@ -91,6 +91,8 @@
 
 POSSIBLE_REBOOT_MESSAGE="This node is not currently responding and is probably<br/>rebooting as planned. This state should persist for 5 minutes or so..."
 
+REDIRECT_MSG="  You will be redirected in 5 seconds. Please fasten your safety restraints."
+
 
 HOMEBASE_ADD_USER="1"
 HOMEBASE_ADD_SYSTEM="2"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]