diff options
author | Nishanth Thomas <nthomas@redhat.com> | 2014-04-04 15:13:17 +0530 |
---|---|---|
committer | Bala.FA <barumuga@redhat.com> | 2014-04-28 16:20:46 +0530 |
commit | ea28af4f36370506a76a5ae4fbd56990dd49c71a (patch) | |
tree | ecfc99cceaa24598050fb47d15bec986552f3328 | |
parent | 023d7af3e313f4154a869d5e67e792fde3bd273f (diff) |
Autoconf:moved parseXML fun to utils
Added few command definitions
Change-Id: I90a584868f684896da49d5101ceb512a82e231dc
Signed-off-by: Nishanth Thomas <nthomas@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/22548
Reviewed-by: Kanagaraj Mayilsamy <kmayilsa@redhat.com>
Tested-by: Ramesh Nachimuthu <rnachimu@redhat.com>
-rw-r--r-- | glusternagios/utils.py | 14 |
1 files 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 |