[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:	rmccabe sourceware org	2006-08-02 17:25:54

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

Log message:
	committing for stephen

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.30&r2=1.31
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/conga_constants.py.diff?cvsroot=cluster&r1=1.6&r2=1.7

--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/08/01 15:29:37	1.30
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/08/02 17:25:54	1.31
@@ -1394,6 +1394,7 @@
     finished = rb.checkBatch(item[1].getProperty(BATCH_ID)) 
     if finished == True:
       clusterfolder.manage_delObjects(item[0])
+      map['refreshurl'] = '5; url=\".\"'
       return map
     else:
       map['busy'] = "true"
@@ -1423,6 +1424,7 @@
     itemmap['type'] = item.resource_type
     itemmap['cfgurl'] = baseurl + "?" + "clustername=" + cluname + "&resourcename=" + item.getName() + "&pagetype=" + RESOURCE_CONFIG
     itemmap['url'] = baseurl + "?" + "clustername=" + cluname + "&resourcename=" + item.getName() + "&pagetype=" + RESOURCE
+    itemmap['delurl'] = baseurl + "?" + "clustername=" + cluname + "&resourcename=" + item.getName() + "&pagetype=" + RESOURCE_REMOVE
     resList.append(itemmap)
   return resList
                                                                                 
@@ -1438,9 +1440,48 @@
           resMap['tag_name'] = res.TAG_NAME
           resMap['cfgurl'] = baseurl + "?" + "clustername=" + cluname + "&resourcename=" + res.getName() + "&pagetype=" + RESOURCE_CONFIG
           return resMap
-                                                                                
+
   return {}
-                                                                                
+
+
+def delResource(self, request, ragent):
+  modelb = request.SESSION.get('model')
+  resPtr = modelb.getResourcesPtr()
+  resources = resPtr.getChildren()
+  name = request['resourcename']                                                                             
+  for res in resources:
+    if res.getName() == name:
+      resPtr.removeChild(res)
+      break
+
+  modelstr = ""
+  conf = modelb.exportModelAsString()
+  rb = ricci_bridge(ragent)
+  #try:
+  if True:
+    batch_number, result = rb.setClusterConf(str(conf))
+  #except:
+  else:
+    return "Some error occured in setClusterConf\n"
+
+  clustername = request['clustername']
+  path = CLUSTER_FOLDER_PATH + clustername
+  clusterfolder = self.restrictedTraverse(path)
+  batch_id = str(batch_number)
+  objname = ragent + "____flag"
+  clusterfolder.manage_addProduct['ManagedSystem'].addManagedSystem(objname)
+   #Now we need to annotate the new DB object
+  objpath = path + "/" + objname
+  flag = self.restrictedTraverse(objpath)
+  flag.manage_addProperty(BATCH_ID,batch_id, "string")
+  flag.manage_addProperty(TASKTYPE,RESOURCE_REMOVE, "string")
+  flag.manage_addProperty(FLAG_DESC,"Removing Resource \'" + request['resourcename'] + "\'", "string")
+
+  response = request.RESPONSE
+  response.redirect(request['HTTP_REFERER'] + "&busyfirst=true")
+
+
+  
 def addResource(self, request, ragent):
   if not request.form:
     return "Nothing submitted, no changes made."
@@ -1483,16 +1524,17 @@
   flag.manage_addProperty(TASKTYPE,RESOURCE_ADD, "string")
   flag.manage_addProperty(FLAG_DESC,"Creating Resource \'" + request.form['resourceName'] + "\'", "string")
 
-  response = req.RESPONSE
+  response = request.RESPONSE
   response.redirect(request['HTTP_REFERER'] + "&busyfirst=true")
 
 
 def getResourceForEdit(modelb, name):
-  resources = modelb.getResourcesPtr().getChildren()
+  resPtr = modelb.getResourcesPtr()
+  resources = resPtr.getChildren()
                                                                                
   for res in resources:
     if res.getName() == name:
-      resources.removeChild(res)
+      resPtr.removeChild(res)
       break
                                                                               
   return res
--- conga/luci/site/luci/Extensions/conga_constants.py	2006/07/28 14:02:45	1.6
+++ conga/luci/site/luci/Extensions/conga_constants.py	2006/08/02 17:25:54	1.7
@@ -27,6 +27,7 @@
 RESOURCE_CONFIG="33"
 RESOURCE="34"
 RESOURCE_PROCESS="35"
+RESOURCE_REMOVE="36"
 FDOMS="40"
 FDOM_ADD="41"
 FDOM_LIST="42"


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