CVSROOT:        /cvs/cluster
Module name:    conga
Changes by:     [EMAIL PROTECTED]       2007-07-30 02:24:16

Modified files:
        luci/cluster   : resource_form_handlers.js 
        luci/site/luci/Extensions: LuciClusterInfo.py RicciQueries.py 
                                   cluster_adapters.py 

Log message:
        Fixes from the RHEL5 branch

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&r1=1.37&r2=1.38
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/LuciClusterInfo.py.diff?cvsroot=cluster&r1=1.8&r2=1.9
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/RicciQueries.py.diff?cvsroot=cluster&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&r1=1.263&r2=1.264

--- conga/luci/cluster/resource_form_handlers.js        2007/07/11 22:47:07     
1.37
+++ conga/luci/cluster/resource_form_handlers.js        2007/07/30 02:24:15     
1.38
@@ -523,8 +523,11 @@
        if (!svc_name)
                errors.push('No name was given for this service.');
 
-       if (!form_xml)
-               errors.push('No resource information was submitted.');
+       /*
+       ** allow creation of empty services.
+       ** if (!form_xml)
+       **      errors.push('No resource information was submitted.');
+       */
 
        if (recovery && recovery != 'relocate' && recovery != 'restart' && 
recovery != 'disable') {
                errors.push('You entered an invalid recovery option. Valid 
options are "relocate" "restart" and "disable"');
@@ -534,7 +537,12 @@
                return (-1);
 
        /* sort this out in the backend */
-       master_form.form_xml.value = '<formlist>' + form_xml + '</formlist>';
+       if (form_xml) {
+               master_form.form_xml.value = '<formlist>' + form_xml + 
'</formlist>';
+       } else {
+               /* empty service */
+               master_form.form_xml.value = ' ';
+       }
        master_form.svc_name.value = svc_name;
        if (domain)
                master_form.domain.value = domain;
--- conga/luci/site/luci/Extensions/LuciClusterInfo.py  2007/07/27 16:43:47     
1.8
+++ conga/luci/site/luci/Extensions/LuciClusterInfo.py  2007/07/30 02:24:15     
1.9
@@ -528,7 +528,9 @@
                fdom_map['nodeslist'] = nodelist
 
                svclist = list()
-               for svc in model.getServices():
+               tmp = model.getServices()
+               tmp.extend(model.getVMs())
+               for svc in tmp:
                        svcname = svc.getName()
                        for sitem in slist:
                                if sitem['name'] == svcname:
@@ -537,7 +539,10 @@
                                                svcmap = {}
                                                svcmap['name'] = svcname
                                                svcmap['status'] = 
sitem['running']
-                                               svcmap['svcurl'] = 
'%s?pagetype=%s&clustername=%s&servicename=%s' % (baseurl, SERVICE, 
clustername, svcname)
+                                               if svc.getTagName() == 'vm':
+                                                       svcmap['svcurl'] = 
'%s?pagetype=%s&clustername=%s&servicename=%s' % (baseurl, VM_CONFIG, 
clustername, svcname)
+                                               else:
+                                                       svcmap['svcurl'] = 
'%s?pagetype=%s&clustername=%s&servicename=%s' % (baseurl, SERVICE, 
clustername, svcname)
                                                svcmap['location'] = 
sitem['nodename']
                                                svclist.append(svcmap)
                fdom_map['svclist'] = svclist
--- conga/luci/site/luci/Extensions/RicciQueries.py     2007/07/27 16:43:47     
1.5
+++ conga/luci/site/luci/Extensions/RicciQueries.py     2007/07/30 02:24:15     
1.6
@@ -671,6 +671,8 @@
        return resultlist
 
 def getClusterConf(rc):
+       import xml.dom
+
        if rc is None:
                return None
 
@@ -712,7 +714,9 @@
        var_nodes = ret.getElementsByTagName('var')
        for i in var_nodes:
                if i.getAttribute('name') == 'cluster.conf':
-                       return i.childNodes[0]
+                       for j in i.childNodes:
+                               if j.nodeType == xml.dom.Node.ELEMENT_NODE:
+                                       return j
 
        if LUCI_DEBUG_MODE is True:
                luci_log.debug_verbose('GCC2: no conf node found')
--- conga/luci/site/luci/Extensions/cluster_adapters.py 2007/07/27 16:43:47     
1.263
+++ conga/luci/site/luci/Extensions/cluster_adapters.py 2007/07/30 02:24:15     
1.264
@@ -720,9 +720,10 @@
 
        form_xml = fvar['form_xml']
        if form_xml is None:
+               form_xml = ''
                if LUCI_DEBUG_MODE is True:
                        luci_log.debug_verbose('vSA0: no form_xml')
-               return (False, { 'errors': [ 'No resource data was supplied for 
this service' ]})
+
 
        model = LuciExtractCluModel(self, request, clustername)
        if model is None:
@@ -730,15 +731,17 @@
                        luci_log.debug_verbose('vSA1: no model')
                return (False, { 'errors': [ 'Unable to retrieve the cluster 
configuration for %s. The configuration XML may contain errors' % clustername 
]})
 
-       try:
-               doc = minidom.parseString(form_xml)
-               forms = doc.getElementsByTagName('form')
-               if len(forms) < 1:
-                       raise Exception, 'invalid XML'
-       except Exception, e:
-               if LUCI_DEBUG_MODE is True:
-                       luci_log.debug_verbose('vSA1: error: %r %s' % (e, 
str(e)))
-               return (False, { 'errors': [ 'The resource data submitted for 
this service is not properly formed' ]})
+       forms = []
+       if form_xml.strip():
+               try:
+                       doc = minidom.parseString(form_xml)
+                       forms = doc.getElementsByTagName('form')
+                       if len(forms) < 1:
+                               raise Exception, 'invalid XML'
+               except Exception, e:
+                       if LUCI_DEBUG_MODE is True:
+                               luci_log.debug_verbose('vSA1: error: %r %s: %r' 
% (e, str(e), form_xml))
+                       return (False, { 'errors': [ 'The resource data 
submitted for this service is not properly formed' ]})
 
        form_hash = {}
        form_hash['toplevel'] = { 'form': None, 'kids': [] }

Reply via email to