conga/luci/site/luci/Extensions cluster_adapte ...
CVSROOT: /cvs/cluster
Module name: conga
Changes by: jparsons at sourceware.org 2006-08-09 21:48:55
Modified files:
luci/site/luci/Extensions: cluster_adapters.py
Log message:
finish service info hash
luci/site/luci/Extensions/cluster_adapters.py +39 -0
@@ -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']