[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe sourceware org	2006-11-27 18:15:31

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

Log message:
	fix indentation and import errors

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

--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/20 15:05:00	1.165
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/27 18:15:31	1.166
@@ -18,6 +18,8 @@
 from Vm import Vm
 from Script import Script
 from Samba import Samba
+from QuorumD import QuorumD
+from Heuristic import Heuristic
 from clusterOS import resolveOSType
 from FenceHandler import FenceHandler, FENCE_OPTS
 from GeneralError import GeneralError
@@ -588,8 +590,9 @@
 	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
+	#Either device or label must be present
+	device = None
+	label = None
 	try:
 		device = form['device'].strip()
 		label = form['label'].strip()
@@ -652,26 +655,31 @@
 	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)
+	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)
+	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']})
+	if len(errors) > 0:
+		return (False, {'errors': errors })
+
+	return (True, {})
 
 def validateGeneralConfig(model, form):
 	errors = list()
@@ -3047,8 +3055,13 @@
   raise
   
 def getFenceInfo(self, model, request):
-  clustername = request['clustername']
-  baseurl = request['URL']
+  try:
+    clustername = request['clustername']
+    baseurl = request['URL']
+  except Exception, e:
+    luci_log.debug_verbose('getFenceInfo0: error: %s' % str(e))
+    return {}
+
   map = {}
   level1 = list() #First level fence devices
   level2 = list() #Second level fence devices
@@ -3065,7 +3078,9 @@
   try:
     nodename = request['nodename']
   except KeyError, e:
-    raise GeneralError('FATAL', "Could not extract nodename from request")
+    luci_log.debug_verbose('getFenceInfo1: unable to extract nodename: %s' \
+        % str(e))
+    return {}
     
   #Here we need to get fences for a node - just the first two levels
   #Each level has its own list of fence devs used in that level
@@ -3075,7 +3090,8 @@
   try:
     node = model.retrieveNodeByName(nodename)
   except GeneralError, e:
-    raise GeneralError('FATAL', "Couldn't find node name in current node list")
+    luci_log.debug_verbose('getFenceInfo2: unabel to find node name %s in current node list' % (str(nodename), str(e)))
+    return {}
 
   fds = model.getFenceDevices()
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]