[Cluster-devel] conga/luci/site/luci/Extensions cluster_adapte ...

jparsons at sourceware.org jparsons at sourceware.org
Mon Nov 20 15:05:00 UTC 2006


CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	jparsons at sourceware.org	2006-11-20 15:05:00

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

Log message:
	Fix for quorumd cluster props, part of bug #212021

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

--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/17 05:48:27	1.164
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/20 15:05:00	1.165
@@ -588,19 +588,15 @@
 	except ValueError, e:
 		errors.append('An invalid Minimum Score value was given: %s' % str(e))
 
+  device = None
+  label = None  #Either device or label must be present
 	try:
 		device = form['device'].strip()
-		if not device:
-			raise KeyError, 'device is none'
-	except KeyError, e:
-		errors.append('No Device value was given')
-
-	try:
 		label = form['label'].strip()
-		if not label:
-			raise KeyError, 'label is none'
+		if not device and not label:
+			raise KeyError, 'device and label are both none'
 	except KeyError, e:
-		errors.append('No Label value was given')
+		errors.append('No Device or Label value was given')
 
 	num_heuristics = 0
 	try:
@@ -655,6 +651,26 @@
 
 	if len(errors) > 0:
 		return (False, {'errors': errors })
+
+  qd = QuorumD()
+  qd.addAttribute('interval', interval)
+  qd.addAttribute('votes', votes)
+  qd.addAttribute('tko', tko)
+  qd.addAttribute('min_score', min_score)
+  if device:
+    qd.addAttribute('device', device)
+  else:
+    qd.addAttribute('label', label)
+  cp = model.getClusterPtr()
+  cp.addChild(qd)
+
+  for h in heuristics:
+    new_h = Heuristic()
+    new_h.addAttribute('program', h[1])
+    new_h.addAttribute('interval', h[2])
+    new_h.addAttribute('score', h[3])
+    qd.addChild(new_h)
+
 	return (True, {'messages': ['Changes accepted. - FILL ME IN']})
 
 def validateGeneralConfig(model, form):




More information about the Cluster-devel mailing list