summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-09-01 19:26:59 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-09-01 19:26:59 +0000
commit0c15187400416bc69ef131dfeb7998be33601bf1 (patch)
treee04a9f8fed1cd01ebb6dd905bb146629598325b5
parentea70295d8df15e5748adffd2f40be4077afcf466 (diff)
downloadbcfg2-0c15187400416bc69ef131dfeb7998be33601bf1.tar.gz
bcfg2-0c15187400416bc69ef131dfeb7998be33601bf1.tar.bz2
bcfg2-0c15187400416bc69ef131dfeb7998be33601bf1.zip
Fix pylint indents
Make client-query read /etc/bcfg2.conf git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2168 ce84e21b-d406-0410-9b95-82705330c041
-rwxr-xr-xtools/client-query.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/tools/client-query.py b/tools/client-query.py
index e2de0593c..73b9f7ae4 100755
--- a/tools/client-query.py
+++ b/tools/client-query.py
@@ -1,17 +1,22 @@
#!/usr/bin/python
-import lxml.etree, sys
+import lxml.etree, sys, ConfigParser
#this will be replaced by redeadin config file, but I am in a hurry right now
-prefix = "/disks/bcfg2"
+CP = ConfigParser.ConfigParser()
+CP.read(['/etc/bcfg2.conf'])
+try:
+ prefix = CP.get('server', 'repository')
+except:
+ prefix = "/disks/bcfg2"
if len(sys.argv) < 2:
- print "Usage client-query.py -d|u|p <profile name>"
- print "\t -d\t\t shows the clients that are currently down"
- print "\t -u\t\t shows the clients that are currently up"
- print "\t -p <profile name>\t shows all the clients of that profile"
- sys.exit(1)
-
+ print "Usage client-query.py -d|u|p <profile name>"
+ print "\t -d\t\t shows the clients that are currently down"
+ print "\t -u\t\t shows the clients that are currently up"
+ print "\t -p <profile name>\t shows all the clients of that profile"
+ sys.exit(1)
+
xml = lxml.etree.parse('%s/Metadata/clients.xml'%prefix)
for client in xml.findall('.//Client'):
if '-u' in sys.argv:
@@ -24,7 +29,7 @@ for client in xml.findall('.//Client'):
if client.get("profile") == sys.argv[sys.argv.index('-p') + 1]:
print client.get("name")
elif '-a' in sys.argv:
- print client.get("name")
+ print client.get("name")