[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-08-13 20:37:28

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

Log message:
	code to remove defunct node flags

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.50&r2=1.51

--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/08/13 18:36:01	1.50
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/08/13 19:37:28	1.51
@@ -1331,6 +1331,9 @@
     nodefolder = self.restrictedTraverse(path)
     batch_id = str(batch_number)
     objname = nodename_resolved + "____flag"
+    if noNodeFlagsPresent(self, nodefolder, objname, nodename_resolved) == False:
+      raise UnknownClusterError("Fatal", "An unfinished task flag exists for node %s" % nodename)
+
     nodefolder.manage_addProduct['ManagedSystem'].addManagedSystem(objname)
     #Now we need to annotate the new DB object
     objpath = path + "/" + objname
@@ -1985,3 +1988,18 @@
       return obj[0]
 
   return None
+
+def noNodeFlagsPresent(self, nodefolder, flagname, hostname):
+  items = nodefolder.objectItems()
+  for item in items:
+    if item[0] == flagname:  #a flag already exists...
+      #try and delete it
+      rb = ricci_bridge(hostname)
+      finished = rb.checkBatch(item[1].getProperty(BATCH_ID))
+      if finished == True:
+        nodefolder.manage_delObjects(item[0])
+        return True
+      else:
+        return False Not finished, so cannot remove flag
+
+  return True


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