Skip to contentSkip to conversation

conga/luci/site/luci/Extensions cluster_adapte ...

Cluster-devel [email protected] 1 participant 1 message Jul 28, 2006

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Changes by: jparsons at sourceware.org 2006-07-28 14:16:30

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

Log message:
Had to add a suffix for flag IDs

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

luci/site/luci/Extensions/cluster_adapters.py +14 -9
@@ -154,9 +154,10 @@
   for key in batch_map.keys():
     id = batch_map[key]
     batch_id = str(id)
-    clusterfolder.manage_addProduct['ManagedSystem'].addManagedSystem(key)
+    objname = key + "____flag" #This suffix needed to avoid name collision
+    clusterfolder.manage_addProduct['ManagedSystem'].addManagedSystem(objname)
     #now designate this new object properly
-    objpath = path + "/" + key
+    objpath = path + "/" + objname
     flag = self.restrictedTraverse(objpath)
     flag[BATCH_ID] = batch_id
     flag[TASKTYPE] = CLUSTER_ADD
@@ -906,9 +907,10 @@
   path = CLUSTER_FOLDER_PATH + cluname
   clusterfolder = self.restrictedTraverse(path)
   batch_id = str(batch_number)
-  clusterfolder.manage_addProduct['ManagedSystem'].addManagedSystem(ricci_agent)
+  objname = ricci_agent + "____flag"
+  clusterfolder.manage_addProduct['ManagedSystem'].addManagedSystem(objname)
   #Now we need to annotate the new DB object
-  objpath = path + "/" + ricci_agent
+  objpath = path + "/" + objname
   flag = self.restrictedTraverse(objpath)
   flag[BATCH_ID] = batch_id
   flag[TASKTYPE] = SERVICE_START
@@ -929,9 +931,10 @@
   path = CLUSTER_FOLDER_PATH + cluname
   clusterfolder = self.restrictedTraverse(path)
   batch_id = str(batch_number)
-  clusterfolder.manage_addProduct['ManagedSystem'].addManagedSystem(ricci_agent)
+  objname = ricci_agent + "____flag"
+  clusterfolder.manage_addProduct['ManagedSystem'].addManagedSystem(objname)
   #Now we need to annotate the new DB object
-  objpath = path + "/" + ricci_agent
+  objpath = path + "/" + objname
   flag = self.restrictedTraverse(objpath)
   flag[BATCH_ID] = batch_id
   flag[TASKTYPE] = SERVICE_RESTART
@@ -951,9 +954,10 @@
   path = CLUSTER_FOLDER_PATH + cluname
   clusterfolder = self.restrictedTraverse(path)
   batch_id = str(batch_number)
-  clusterfolder.manage_addProduct['ManagedSystem'].addManagedSystem(ricci_agent)
+  objname = ricci_agent + "____flag"
+  clusterfolder.manage_addProduct['ManagedSystem'].addManagedSystem(objname)
   #Now we need to annotate the new DB object
-  objpath = path + "/" + ricci_agent
+  objpath = path + "/" + objname
   flag = self.restrictedTraverse(objpath)
   flag[BATCH_ID] = batch_id
   flag[TASKTYPE] = SERVICE_STOP
@@ -1309,7 +1313,8 @@
   ##3) The ricci agent has no recollection of the task, so handle like 1 above
   for item in items:
     #Check here for more than 1 entry (an error)
-    rb = ricci_bridge(item[0])
+    ricci = item[0].split("____") #This removes the 'flag' suffix
+    rb = ricci_bridge(ricci[0])
     finished = rb.checkBatch(item[1][BATCH_ID]) 
     if finished == True:
       clusterfolder.manage_delObjects(item[0])