From ea28af4f36370506a76a5ae4fbd56990dd49c71a Mon Sep 17 00:00:00 2001 From: Nishanth Thomas Date: Fri, 4 Apr 2014 15:13:17 +0530 Subject: Autoconf:moved parseXML fun to utils Added few command definitions Change-Id: I90a584868f684896da49d5101ceb512a82e231dc Signed-off-by: Nishanth Thomas Reviewed-on: https://code.engineering.redhat.com/gerrit/22548 Reviewed-by: Kanagaraj Mayilsamy Tested-by: Ramesh Nachimuthu --- glusternagios/utils.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/glusternagios/utils.py b/glusternagios/utils.py index 0211e53..047fccf 100644 --- a/glusternagios/utils.py +++ b/glusternagios/utils.py @@ -33,6 +33,7 @@ import os import errno import signal from collections import defaultdict +import xml.etree.cElementTree as ET class HostStatus: @@ -102,7 +103,7 @@ setsidCmdPath = CommandPath("setsid", "/bin/setsid", ) sudoCmdPath = CommandPath("sudo", - "/bin/sudo", + "/usr/bin/sudo", ) lvsCmdPath = CommandPath("lvs", "/sbin/lvs", @@ -111,7 +112,10 @@ vgsCmdPath = CommandPath("vgs", "/sbin/vgs", ) pvsCmdPath = CommandPath("pvs", - "/sbin/pvs") + "/sbin/pvs", + ) +hostnameCmdPath = CommandPath("hostname", "/bin/hostname", ) +glusterCmdPath = CommandPath("gluster", "/usr/sbin/gluster") # Buffsize is 1K because I tested it on some use cases and 1K was fastest. If # you find this number to be a bottleneck in any way you are welcome to change # it @@ -511,3 +515,9 @@ def convertSize(val, unitFrom, unitTo): convFactor = 1 << (unitFromIndex - unitToIndex) * 10 return float(val) * convFactor return val + + +def parseXml(xmldoc, searchStr): + root = ET.fromstring(xmldoc) + statusStr = root.findall(searchStr) + return statusStr -- cgit