All of lore.kernel.org
 help / color / mirror / Atom feed
From: rmccabe@sourceware.org <rmccabe@sourceware.org>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] conga/luci cluster/resource_form_handlers.js s ...
Date: 27 Jul 2007 19:11:33 -0000	[thread overview]
Message-ID: <20070727191133.14295.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Branch: 	RHEL5
Changes by:	rmccabe at sourceware.org	2007-07-27 19:11:32

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

Log message:
	Allow the creation and modification of services with no resources

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/cluster/resource_form_handlers.js.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.20.2.9&r2=1.20.2.10
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/luci/site/luci/Extensions/cluster_adapters.py.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.120.2.34&r2=1.120.2.35

--- conga/luci/cluster/resource_form_handlers.js	2007/07/12 04:41:39	1.20.2.9
+++ conga/luci/cluster/resource_form_handlers.js	2007/07/27 19:11:32	1.20.2.10
@@ -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/cluster_adapters.py	2007/07/26 05:52:54	1.120.2.34
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2007/07/27 19:11:32	1.120.2.35
@@ -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	other threads:[~2007-07-27 19:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-27 19:11 rmccabe [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-07-30  2:24 [Cluster-devel] conga/luci cluster/resource_form_handlers.js s rmccabe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070727191133.14295.qmail@sourceware.org \
    --to=rmccabe@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.