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/site/luci/Extensions FenceDevice.py ...
Date: 27 Nov 2006 19:11:42 -0000	[thread overview]
Message-ID: <20061127191142.15762.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2006-11-27 19:11:42

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

Log message:
	fence agents can contain a full path to the agent script. strip off
	all but the basename when using this value as an index into hashes.

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

--- conga/luci/site/luci/Extensions/FenceDevice.py	2006/10/04 15:11:10	1.2
+++ conga/luci/site/luci/Extensions/FenceDevice.py	2006/11/27 19:11:41	1.3
@@ -19,7 +19,12 @@
 
 
   def getAgentType(self):
-    return self.attr_hash["agent"]
+    agent = self.attr_hash["agent"]
+    try:
+      return agent[agent.rfind('/') + 1:]
+    except:
+      pass
+    return agent
 
   def isShared(self):
     agent = self.getAgentType()
--- conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/27 18:15:31	1.166
+++ conga/luci/site/luci/Extensions/cluster_adapters.py	2006/11/27 19:11:41	1.167
@@ -3057,9 +3057,17 @@
 def getFenceInfo(self, model, request):
   try:
     clustername = request['clustername']
+  except:
+    try:
+      clustername = request.form['clustername']
+    except:
+      luci_log.debug_verbose('getFenceInfo0: unable to determine cluster name')
+      return {}
+
+  try:
     baseurl = request['URL']
   except Exception, e:
-    luci_log.debug_verbose('getFenceInfo0: error: %s' % str(e))
+    luci_log.debug_verbose('getFenceInfo1: no request.URL')
     return {}
 
   map = {}
@@ -3077,10 +3085,13 @@
 
   try:
     nodename = request['nodename']
-  except KeyError, e:
-    luci_log.debug_verbose('getFenceInfo1: unable to extract nodename: %s' \
-        % str(e))
-    return {}
+  except:
+    try:
+      nodename = request.form['nodename']
+    except:
+      luci_log.debug_verbose('getFenceInfo2: 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
@@ -3090,7 +3101,7 @@
   try:
     node = model.retrieveNodeByName(nodename)
   except GeneralError, e:
-    luci_log.debug_verbose('getFenceInfo2: unabel to find node name %s in current node list' % (str(nodename), str(e)))
+    luci_log.debug_verbose('getFenceInfo3: unabel to find node name %s in current node list' % (str(nodename), str(e)))
     return {}
 
   fds = model.getFenceDevices()
@@ -3176,9 +3187,9 @@
             level1.append(fencedev)
             last_kid_fd = fd
             continue
+    map['level1'] = level1
 
     #level1 list is complete now, but it is still necessary to build shared1
-    sharednames = list()
     for fd in fds:
       isUnique = True
       if fd.isShared() == False:
@@ -3194,6 +3205,7 @@
         shared_struct['agent'] = agentname
         shared_struct['prettyname'] = FENCE_OPTS[agentname]
         shared1.append(shared_struct)
+    map['shared1'] = shared1
 
   #YUK: This next section violates the DRY rule, :-(
   if len_levels >= 2:
@@ -3270,9 +3282,9 @@
             level2.append(fencedev)
             last_kid_fd = fd
             continue
+    map['level2'] = level2
 
     #level2 list is complete but like above, we need to build shared2
-    sharednames = list()
     for fd in fds:
       isUnique = True
       if fd.isShared() == False:
@@ -3288,6 +3300,7 @@
         shared_struct['agent'] = agentname
         shared_struct['prettyname'] = FENCE_OPTS[agentname]
         shared2.append(shared_struct)
+    map['shared2'] = shared2
 
   return map    
       
@@ -3296,7 +3309,7 @@
   baseurl = request['URL']
   map = {}
   fencedevs = list() #This is for the fencedev list page
-  map['fencedevs'] = fencedevs
+
   #Get list of fence devices
   fds = model.getFenceDevices()
   nodes_used = list() #This section determines which nodes use the dev
@@ -3336,7 +3349,8 @@
 
       fencedev['nodesused'] = nodes_used
       fencedevs.append(fencedev)
-    
+
+  map['fencedevs'] = fencedevs
   return map
 
     



                 reply	other threads:[~2006-11-27 19:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20061127191142.15762.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.