[Cluster-devel] conga/luci cluster/form-macros cluster/resourc ...
rmccabe at sourceware.org
rmccabe at sourceware.org
Wed Sep 13 17:50:23 UTC 2006
CVSROOT: /cvs/cluster
Module name: conga
Changes by: rmccabe at sourceware.org 2006-09-13 17:50:22
Modified files:
luci/cluster : form-macros resource-form-macros
resource_form_handlers.js
luci/homebase : homebase_common.js luci_homebase.css
luci/site/luci/Extensions: cluster_adapters.py
Log message:
service stuff..
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/form-macros.diff?cvsroot=cluster&r1=1.58&r2=1.59
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource-form-macros.diff?cvsroot=cluster&r1=1.9&r2=1.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.6&r2=1.7
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/homebase_common.js.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/homebase/luci_homebase.css.diff?cvsroot=cluster&r1=1.21&r2=1.22
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.63&r2=1.64
--- conga/luci/cluster/form-macros 2006/09/11 22:22:00 1.58
+++ conga/luci/cluster/form-macros 2006/09/13 17:50:22 1.59
@@ -1097,6 +1097,10 @@
global sinfo python: here.getServiceInfo(sstat, modelb,request);
global running sinfo/running | nothing;" />
+ <tal:block tal:replace="structure python: '<script type='+chr(0x22)+'text/javascript'+chr(0x22)+'>'" />
+ var uuid_list = <tal:block tal:replace="sinfo/uuid_list" />;
+ <tal:block tal:replace="structure string: </script>" />
+
<table class="cluster service" width="100%">
<tr class="cluster service info_top">
<td class="cluster service service_name">
@@ -1144,25 +1148,26 @@
<div id="resskel" class="invisible">
<tal:block metal:use-macro="here/resource-form-macros/macros/resource-swap-form" />
- <div name="expander" class="invisible">
+ <p class="invisible expander">
<img class="service_tree" name="arrow_down" alt="[-]"
src="/luci/cluster/arrow_down.png"
onClick="collapse_div(this)">
- <span class="service_tree">Hide Children</span>
- </div>
+ <span class="service_tree expander">Hide Children</span>
+ </p>
</div>
<h2>Service Composition</h2>
- <div id="service_comp_list">
- <div tal:repeat="res sinfo/resource_list"
- tal:attributes="class python: 'service_comp rc_indent' + str(res['indent_ctr'])">
+ <div class="service_comp_list" tal:attributes="id sinfo/root_uuid">
+ <div tal:repeat="res sinfo/resource_list"
+ tal:attributes="
+ class python: 'service_comp rc_indent' + str(res['indent_ctr']);
+ id python: res['uuid']">
<tal:block
tal:condition="python: res['max_depth'] > 0"
- tal:replace="structure python: '<div>'" />
-
+ tal:replace="structure python: '<div class=nothing>'" />
<tal:block tal:define="
global type res/type;
@@ -1200,14 +1205,14 @@
<tal:block metal:use-macro="here/resource-form-macros/macros/scr_macro" />
</span>
- <div name="expander"
+ <p
tal:attributes="
- class python: res['max_depth'] == 0 and 'invisible' or ('rc_indent' + str(res['indent_ctr'] - 1))">
+ class python: (res['max_depth'] == 0 and 'invisible' or ('rc_indent' + str(res['indent_ctr'] - 1))) + ' expander'">
<img class="service_tree" name="arrow_down" alt="[-]"
src="/luci/cluster/arrow_down.png"
onClick="collapse_div(this)">
- <span class="service_tree">Hide Children</span>
- </div>
+ <span class="service_tree expander">Hide Children</span>
+ </p>
<tal:block
tal:replace="structure python: '</div>' * (res['indent_ctr'] - res['max_depth'])" />
--- conga/luci/cluster/resource-form-macros 2006/09/11 22:22:00 1.9
+++ conga/luci/cluster/resource-form-macros 2006/09/13 17:50:22 1.10
@@ -65,10 +65,11 @@
<div metal:define-macro="resource-swap-form">
<form>
- <div class="reshdr">
+ <p class="reshdr">
<strong class="reshdr">Select a Resource Type</strong>
- </div>
- <div class="reshdr">
+ </p>
+
+ <p class="reshdr">
<select onChange="swap_div_elem(this.form.parentNode.parentNode,
'invisible', 'container',
this.options[this.selectedIndex].value);">
@@ -82,10 +83,9 @@
<option name="SCR" value="SCR">Script</option>
<option name="SMB" value="SMB">Samba</option>
</select>
- </div>
+ </p>
<div name="container" class="systemsTable">
- <div> </div>
</div>
<div name="invisible" class="invisible">
@@ -174,37 +174,37 @@
<h2>Configure <span tal:replace="python: res['name']" /></h2>
<div class="reschoose">
- <span tal:omit-tag="" tal:condition="python: type == 'ip'">
- <div metal:use-macro="here/resource-form-macros/macros/ip_macro"/>
- </span>
-
- <span tal:omit-tag="" tal:condition="python: type == 'fs'">
- <div metal:use-macro="here/resource-form-macros/macros/fs_macro"/>
- </span>
-
- <span tal:omit-tag="" tal:condition="python: type == 'gfs'">
- <div metal:use-macro="here/resource-form-macros/macros/gfs_macro"/>
- </span>
-
- <span tal:omit-tag="" tal:condition="python: type == 'nfsm'">
- <div metal:use-macro="here/resource-form-macros/macros/nfsm_macro"/>
- </span>
-
- <span tal:omit-tag="" tal:condition="python: type == 'nfsx'">
- <div metal:use-macro="here/resource-form-macros/macros/nfsx_macro"/>
- </span>
-
- <span tal:omit-tag="" tal:condition="python: type == 'nfsc'">
- <div metal:use-macro="here/resource-form-macros/macros/nfsc_macro"/>
- </span>
-
- <span tal:omit-tag="" tal:condition="python: type == 'smb'">
- <div metal:use-macro="here/resource-form-macros/macros/smb_macro" />
- </span>
-
- <span tal:omit-tag="" tal:condition="python: type == 'script'">
- <div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
- </span>
+ <span tal:omit-tag="" tal:condition="python: type == 'ip'">
+ <div metal:use-macro="here/resource-form-macros/macros/ip_macro"/>
+ </span>
+
+ <span tal:omit-tag="" tal:condition="python: type == 'fs'">
+ <div metal:use-macro="here/resource-form-macros/macros/fs_macro"/>
+ </span>
+
+ <span tal:omit-tag="" tal:condition="python: type == 'gfs'">
+ <div metal:use-macro="here/resource-form-macros/macros/gfs_macro"/>
+ </span>
+
+ <span tal:omit-tag="" tal:condition="python: type == 'nfsm'">
+ <div metal:use-macro="here/resource-form-macros/macros/nfsm_macro"/>
+ </span>
+
+ <span tal:omit-tag="" tal:condition="python: type == 'nfsx'">
+ <div metal:use-macro="here/resource-form-macros/macros/nfsx_macro"/>
+ </span>
+
+ <span tal:omit-tag="" tal:condition="python: type == 'nfsc'">
+ <div metal:use-macro="here/resource-form-macros/macros/nfsc_macro"/>
+ </span>
+
+ <span tal:omit-tag="" tal:condition="python: type == 'smb'">
+ <div metal:use-macro="here/resource-form-macros/macros/smb_macro" />
+ </span>
+
+ <span tal:omit-tag="" tal:condition="python: type == 'script'">
+ <div metal:use-macro="here/resource-form-macros/macros/scr_macro" />
+ </span>
</div>
</tal:block>
</div>
@@ -229,12 +229,18 @@
tmp_URL context/cluster/index_html/absolute_url;
global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
- <div class="reshdr">IP Address Resource Configuration</div>
+ <p class="reshdr">IP Address Resource Configuration</p>
<form name="ip_form" method="get"
tal:attributes="action processURL">
<input name="pagetype" type="hidden" value="35"/>
+ <input name="parent_uuid" type="hidden"
+ tal:attributes="value res/parent_uuid | nothing" />
+
+ <input name="uuid" type="hidden"
+ tal:attributes="value res/uuid | nothing" />
+
<input name="tree_level" type="hidden"
tal:attributes="value res/indent_ctr | string:0" />
@@ -268,7 +274,7 @@
</tr>
</table>
- <div class="hbSubmit">
+ <p class="hbSubmit">
<input class="hbSubmit" type="button"
onClick="validate_form(this.form);"
tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
@@ -279,7 +285,7 @@
<input class="hbSubmit" type="button" value="Delete this resource"
onClick="delete_resource(this.form)" />
</tal:block>
- </div>
+ </p>
</form>
</div>
@@ -312,11 +318,17 @@
tmp_URL context/cluster/index_html/absolute_url;
global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
- <div class="reshdr">File System Resource Configuration</div>
+ <p class="reshdr">File System Resource Configuration</p>
<form name="fs_form" method="get" tal:attributes="action processURL">
<input name="pagetype" type="hidden" value="35" />
+ <input name="parent_uuid" type="hidden"
+ tal:attributes="value res/parent_uuid | nothing" />
+
+ <input name="uuid" type="hidden"
+ tal:attributes="value res/uuid | nothing" />
+
<input name="tree_level" type="hidden"
tal:attributes="value res/indent_ctr | string:0" />
@@ -415,7 +427,7 @@
</tr>
</table>
- <div class="hbSubmit">
+ <p class="hbSubmit">
<input class="hbSubmit" type="button"
onClick="validate_form(this.form);"
tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
@@ -426,7 +438,7 @@
<input class="hbSubmit" type="button" value="Delete this resource"
onClick="delete_resource(this.form)" />
</tal:block>
- </div>
+ </p>
</form>
</div>
@@ -453,11 +465,17 @@
tmp_URL context/cluster/index_html/absolute_url;
global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
- <div class="reshdr">GFS Resource Configuration</div>
+ <p class="reshdr">GFS Resource Configuration</p>
<form name="gfs_form" method="get" tal:attributes="action processURL">
<input name="pagetype" type="hidden" value="35" />
+ <input name="parent_uuid" type="hidden"
+ tal:attributes="value res/parent_uuid | nothing" />
+
+ <input name="uuid" type="hidden"
+ tal:attributes="value res/uuid | nothing" />
+
<input name="tree_level" type="hidden"
tal:attributes="value res/indent_ctr | string:0" />
@@ -525,7 +543,7 @@
</tr>
</table>
- <div class="hbSubmit">
+ <p class="hbSubmit">
<input class="hbSubmit" type="button"
onClick="validate_form(this.form);"
tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
@@ -536,7 +554,7 @@
<input class="hbSubmit" type="button" value="Delete this resource"
onClick="delete_resource(this.form)" />
</tal:block>
- </div>
+ </p>
</form>
</div>
@@ -564,11 +582,17 @@
tmp_URL context/cluster/index_html/absolute_url;
global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
- <div class="reshdr">NFS Mount Resource Configuration</div>
+ <p class="reshdr">NFS Mount Resource Configuration</p>
<form name="nfsm_form" method="get" tal:attributes="action processURL">
<input name="pagetype" type="hidden" value="35" />
+ <input name="parent_uuid" type="hidden"
+ tal:attributes="value res/parent_uuid | nothing" />
+
+ <input name="uuid" type="hidden"
+ tal:attributes="value res/uuid | nothing" />
+
<input name="tree_level" type="hidden"
tal:attributes="value res/indent_ctr | string:0" />
@@ -649,7 +673,7 @@
</tr>
</table>
- <div class="hbSubmit">
+ <p class="hbSubmit">
<input class="hbSubmit" type="button"
onClick="validate_form(this.form);"
tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
@@ -660,7 +684,7 @@
<input class="hbSubmit" type="button" value="Delete this resource"
onClick="delete_resource(this.form)" />
</tal:block>
- </div>
+ </p>
</form>
</div>
@@ -684,11 +708,17 @@
tmp_URL context/cluster/index_html/absolute_url;
global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
- <div class="reshdr">NFS Client Resource Configuration</div>
+ <p class="reshdr">NFS Client Resource Configuration</p>
<form name="nfsc_form" method="post" tal:attributes="action processURL">
<input name="pagetype" type="hidden" value="35" />
+ <input name="parent_uuid" type="hidden"
+ tal:attributes="value res/parent_uuid | nothing" />
+
+ <input name="uuid" type="hidden"
+ tal:attributes="value res/uuid | nothing" />
+
<input name="tree_level" type="hidden"
tal:attributes="value res/indent_ctr | string:0" />
@@ -731,7 +761,7 @@
</tr>
</table>
- <div class="hbSubmit">
+ <p class="hbSubmit">
<input class="hbSubmit" type="button"
onClick="validate_form(this.form);"
tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
@@ -742,7 +772,7 @@
<input class="hbSubmit" type="button" value="Delete this resource"
onClick="delete_resource(this.form)" />
</tal:block>
- </div>
+ </p>
</form>
</div>
@@ -762,11 +792,17 @@
tmp_URL context/cluster/index_html/absolute_url;
global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
- <div class="reshdr">NFS Export Resource Configuration</div>
+ <p class="reshdr">NFS Export Resource Configuration</p>
<form name="nfsx_form" method="post" tal:attributes="action processURL">
<input name="pagetype" type="hidden" value="35" />
+ <input name="parent_uuid" type="hidden"
+ tal:attributes="value res/parent_uuid | nothing" />
+
+ <input name="uuid" type="hidden"
+ tal:attributes="value res/uuid | nothing" />
+
<input name="tree_level" type="hidden"
tal:attributes="value res/indent_ctr | string:0" />
@@ -793,7 +829,7 @@
</tr>
</table>
- <div class="hbSubmit">
+ <p class="hbSubmit">
<input class="hbSubmit" type="button"
onClick="validate_form(this.form);"
tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
@@ -804,7 +840,7 @@
<input class="hbSubmit" type="button" value="Delete this resource"
onClick="delete_resource(this.form)" />
</tal:block>
- </div>
+ </p>
</form>
</div>
@@ -825,11 +861,17 @@
tmp_URL context/cluster/index_html/absolute_url;
global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
- <div class="reshdr">Script Resource Configuration</div>
+ <p class="reshdr">Script Resource Configuration</p>
<form name="scr_form" method="post" tal:attributes="action processURL">
<input name="pagetype" type="hidden" value="35" />
+ <input name="parent_uuid" type="hidden"
+ tal:attributes="value res/parent_uuid | nothing" />
+
+ <input name="uuid" type="hidden"
+ tal:attributes="value res/uuid | nothing" />
+
<input name="tree_level" type="hidden"
tal:attributes="value res/indent_ctr | string:0" />
@@ -864,7 +906,7 @@
</tr>
</table>
- <div class="hbSubmit">
+ <p class="hbSubmit">
<input class="hbSubmit" type="button"
onClick="validate_form(this.form);"
tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
@@ -875,7 +917,7 @@
<input class="hbSubmit" type="button" value="Delete this resource"
onClick="delete_resource(this.form)" />
</tal:block>
- </div>
+ </p>
</form>
</div>
@@ -897,14 +939,20 @@
tmp_URL context/cluster/index_html/absolute_url;
global processURL python: tmp_URL+'?pagetype=35&clustername='+cluname" />
- <div class="reshdr"
+ <p class="reshdr"
tal:condition="python: edit != 'true'">
Samba Server Configuration
- </div>
+ </p>
<form name="smb_form" method="post" tal:attributes="action processURL">
<input name="pagetype" type="hidden" value="35" />
+ <input name="parent_uuid" type="hidden"
+ tal:attributes="value res/parent_uuid | nothing" />
+
+ <input name="uuid" type="hidden"
+ tal:attributes="value res/uuid | nothing" />
+
<input name="tree_level" type="hidden"
tal:attributes="value res/indent_ctr | string:0" />
@@ -939,7 +987,7 @@
</tr>
</table>
- <div class="hbSubmit">
+ <p class="hbSubmit">
<input class="hbSubmit" type="button"
onClick="validate_form(this.form);"
tal:attributes="value python: sinfo and 'Apply' or 'Submit'" />
@@ -950,7 +998,7 @@
<input class="hbSubmit" type="button" value="Delete this resource"
onClick="delete_resource(this.form)" />
</tal:block>
- </div>
+ </p>
</form>
</div>
--- conga/luci/cluster/resource_form_handlers.js 2006/09/11 22:22:00 1.6
+++ conga/luci/cluster/resource_form_handlers.js 2006/09/13 17:50:22 1.7
@@ -21,7 +21,9 @@
if (!swap_out_cont || !swap_in_cont || !swap_in_elem)
return (-1);
- var temp = swap_in_cont.replaceChild(swap_in_elem, swap_in_cont.firstChild);
+ if (swap_in_cont.id)
+ swap_in_elem.id = swap_in_cont.id;
+ var temp = swap_in_cont.parentNode.replaceChild(swap_in_elem, swap_in_cont);
swap_out_cont.appendChild(temp);
}
@@ -145,54 +147,67 @@
}
function add_child_resource(form) {
- if (!form || !form.tree_level ||
+ if (!form || !form.tree_level || !form.parent_uuid || !form.uuid ||
!is_valid_int(form.tree_level.value, 0, null))
{
return (-1);
}
- var ilevel = Number(form.tree_level.value);
+
+ var ilevel = Number(form.tree_level.value) + 1;
var sdiv = document.getElementById('resskel');
if (!sdiv)
return (-1);
- var pdiv = form.parentNode;
- var regex = eval('/rc_indent' + ilevel + '$/');
- while (pdiv && !pdiv.className.match(regex)) {
- if (pdiv.className == 'service_comp_list')
- break;
- pdiv = pdiv.parentNode;
- }
- if (!pdiv)
+ var pdiv = document.getElementById(form.uuid.value);
+ if (!pdiv) {
+ alert('failed to find ' + form.uuid.value);
return (-1);
+ }
- var divs = pdiv.getElementsByTagName('div');
- var target = null;
-
- ++ilevel;
- regex = eval('/rc_indent' + ilevel + '$/');
- for (var i = 0 ; i < divs.length ; i++) {
- if (divs[i].className.match(regex)) {
- target = divs[i]
+ var forms = pdiv.getElementsByTagName('form');
+ var child_div = null;
+ for (var i = 0 ; i < forms.length ; i++) {
+ if (forms[i].parent_uuid &&
+ forms[i].parent_uuid.value == form.uuid.value)
+ {
+ child_div = document.getElementById(forms[i].uuid.value);
break;
}
}
- if (!target) {
- alert('need to append');
- target = document.createElement('div');
- target.className = 'service_comp rc_indent' + ilevel;
- pdiv.appendChild(target);
- }
-
var node = sdiv.cloneNode(1);
node.id = null;
node.className = null;
ielem = node.getElementsByTagName('input');
if (!ielem)
return (-1);
+
+ var new_uuid = uuid_list.pop();
for (var i = 0 ; i < ielem.length ; i++) {
if (ielem[i].getAttribute('name') == 'tree_level')
ielem[i].value = ilevel;
+ else if (ielem[i].getAttribute('name') == 'parent_uuid')
+ ielem[i].value = form.uuid.value;
+ else if (ielem[i].getAttribute('name') == 'uuid') {
+ if (!new_uuid) {
+ alert('You have too many pending children. Update first.');
+ return (-1);
+ }
+ ielem[i].value = new_uuid;
+ }
}
- target.appendChild(node);
+
+ if (!child_div) {
+ /* enable parent collapse */
+ child_div = document.createElement('div');
+ } else {
+ wrap_div = document.createElement('div');
+ child_div.appendChild(wrap_div);
+ child_div = wrap_div;
+ }
+ child_div.id = new_uuid;
+ child_div.className = 'service_comp rc_indent' + ilevel;
+
+ child_div.appendChild(node);
+ pdiv.appendChild(child_div);
}
--- conga/luci/homebase/homebase_common.js 2006/09/08 22:54:32 1.8
+++ conga/luci/homebase/homebase_common.js 2006/09/13 17:50:22 1.9
@@ -2,21 +2,26 @@
if (!image)
return (-1);
- var span = image.parentNode.getElementsByTagName('span');
- if (span && span.length > 0)
- span = span[0];
- else
- span = null;
-
- var div = null;
- divc = image.parentNode.parentNode.parentNode.getElementsByTagName('div');
- for (var i = 0 ; i < divc.length ; i++) {
- if (divc[i].className.match(/service_comp/)) {
- div = divc[i];
+ var span = null;
+ var pdiv = image.parentNode;
+ var spanc = pdiv.getElementsByTagName('span');
+ if (!spanc)
+ return (-1);
+ for (var i = 0 ; i < spanc.length ; i++) {
+ if (spanc[i].className.match(/expander/)) {
+ span = spanc[i];
break;
}
}
+ if (!span)
+ return (-1);
+ var div = image.parentNode.parentNode.nextSibling;
+ while (div) {
+ if (div.tagName && div.tagName.match(/^DIV$/i) && div.className.match(/expander/))
+ break;
+ div = div.nextSibling;
+ }
if (!div)
return (-1);
@@ -24,18 +29,14 @@
image.src = 'arrow_right.png';
image.name = 'arrow_right';
image.alt = '[-]';
- if (span)
- span.innerHTML = 'Show Children';
- div.style.visibility = 'hidden';
- div.style.display = 'none';
+ span.innerHTML = 'Show Children';
+ div.className = 'invisible expander service_comp';
} else {
image.src = 'arrow_down.png';
image.name = 'arrow_down';
image.alt = '[+]';
- if (span)
- span.innerHTML = 'Hide Children';
- div.style.visibility = 'inherit';
- div.style.display = 'block';
+ span.innerHTML = 'Hide Children';
+ div.className = 'expander service_comp';
}
}
--- conga/luci/homebase/luci_homebase.css 2006/09/11 22:22:01 1.21
+++ conga/luci/homebase/luci_homebase.css 2006/09/13 17:50:22 1.22
@@ -146,7 +146,7 @@
margin-bottom: .25em;
}
-div.hbSubmit {
+div.hbSubmit,p.hbSubmit {
margin-top: .5em;
margin-bottom: .5em;
margin-right: .5em;
@@ -381,10 +381,11 @@
margin-bottom: .25em ! important;
}
-#service_comp_list {
+div.service_comp_list {
background: #dee7ec;
max-width: 700px;
padding: 1em;
+ margin-top: 0;
}
div.reschoose {
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2006/09/08 22:54:32 1.63
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2006/09/13 17:50:22 1.64
@@ -6,6 +6,7 @@
from ricci_communicator import *
import time
import Products.ManagedSystem
+from Products.Archetypes.utils import make_uuid
from Ip import Ip
from Clusterfs import Clusterfs
from Fs import Fs
@@ -919,15 +920,15 @@
#set up struct for service config page
baseurl = req['URL']
cluname = req['clustername']
- map = {}
+ hmap = {}
servicename = req['servicename']
for item in status:
if item['type'] == "service":
if item['name'] == servicename:
- map['name'] = servicename
+ hmap['name'] = servicename
starturls = list()
if item['running'] == "true":
- map['running'] = "true"
+ hmap['running'] = "true"
#In this case, determine where it can run...
innermap = {}
nodename = item['nodename']
@@ -956,7 +957,7 @@
starturl['url'] = baseurl + "?" + "clustername=" + cluname +"&servicename=" + servicename + "&pagetype=" + SERVICE_START + "&nodename=" + node.getName()
starturls.append(starturl)
innermap['links'] = starturls
- map['innermap'] = innermap
+ hmap['innermap'] = innermap
#Now build hashes for resources under service.
#first get service by name from model
@@ -965,15 +966,16 @@
if svc != None:
indent_ctr = 0
children = svc.getChildren()
-
+ root_uuid = make_uuid('resource')
for child in children:
- recurse_resources(child, resource_list, indent_ctr)
+ recurse_resources(root_uuid, child, resource_list, indent_ctr)
- map['resource_list'] = resource_list
-
- return map
+ hmap['resource_list'] = resource_list
+ hmap['root_uuid'] = root_uuid
+ hmap['uuid_list'] = map(lambda x: make_uuid('resource'), range(30))
+ return hmap
-def recurse_resources(child, resource_list, indent_ctr, parent=None):
+def recurse_resources(parent_uuid, child, resource_list, indent_ctr, parent=None):
#First, add the incoming child as a resource
#Next, check for children of it
#Call yourself on every children
@@ -992,6 +994,8 @@
#Note: Final version needs all resource attrs
rc_map['attrs'] = child.getAttributes()
+ rc_map['uuid'] = make_uuid('resource')
+ rc_map['parent_uuid'] = parent_uuid
new_indent_ctr = indent_ctr + 1
@@ -999,7 +1003,7 @@
kids = child.getChildren()
child_depth = 0
for kid in kids:
- child_depth = recurse_resources(kid, resource_list, new_indent_ctr, child)
+ child_depth = recurse_resources(rc_map['uuid'], kid, resource_list, new_indent_ctr, child)
rc_map['max_depth'] = child_depth
return child_depth + 1
More information about the Cluster-devel
mailing list