[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-09 21:48:55

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

Log message:
	finish service info hash

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

--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/08/03 18:36:21	1.34
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/08/09 21:48:55	1.35
@@ -955,8 +955,47 @@
             starturls.append(starturl)
           innermap['links'] = starturls
         map['innermap'] = innermap
+
+  #Now build hashes for resources under service.
+  #first get service by name from model
+  svc = modelb.getService(servicename)
+  resource_list = list()
+  if svc != None:
+    indent_ctr = 0
+    children = svc.getChildren()
+    
+    for child in children:
+      recurse_resources(child, resource_list, indent_ctr)
+      
+  map['resource_list'] = resource_list 
+
   return map
 
+def recurse_resources(child, resource_list, indent_ctr):
+  #First, add the incoming child as a resource
+  #Next, check for children of it
+  #Call yourself on every children
+  #then return
+  rc_map = {}
+  if child.isRefObject() == True:
+    rc_map['ref_object'] = True
+
+  rc_map['type'] = child.getResourceType()
+  rc_map['indent_ctr'] = indent_ctr
+  #Note: Final version needs all resource attrs
+  attrs = child.getAttributes()
+  attr_keys = attrs.keys()
+  for key in attr_keys:
+    rc_map[key] = attrs[key]
+
+  new_indent_ctr = indent_ctr + 1
+  resource_list.append(rc_map)
+  kids = child.getChildren()
+  for kid in kids:
+    recurse_resources(kid, resource_list, new_indent_ctr)
+
+  return
+    
 def serviceStart(self, ricci_agent, req):
   rb = ricci_bridge(ricci_agent)
   svcname = req['servicename']


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