diff options
author | Rick Bradshow <bradshaw@mcs.anl.gov> | 2006-09-01 19:23:12 +0000 |
---|---|---|
committer | Rick Bradshow <bradshaw@mcs.anl.gov> | 2006-09-01 19:23:12 +0000 |
commit | ea70295d8df15e5748adffd2f40be4077afcf466 (patch) | |
tree | 1f5f36c62911265899d75e66ed41f482fd58915e /tools | |
parent | 9fa5167d655f295341a8b635b3f2ea737fde5360 (diff) | |
download | bcfg2-ea70295d8df15e5748adffd2f40be4077afcf466.tar.gz bcfg2-ea70295d8df15e5748adffd2f40be4077afcf466.tar.bz2 bcfg2-ea70295d8df15e5748adffd2f40be4077afcf466.zip |
added this little tool to parse through the clients file to help find certain types of machines.
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2167 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/client-query.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/client-query.py b/tools/client-query.py new file mode 100755 index 000000000..e2de0593c --- /dev/null +++ b/tools/client-query.py @@ -0,0 +1,33 @@ +#!/usr/bin/python + +import lxml.etree, sys + +#this will be replaced by redeadin config file, but I am in a hurry right now +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) + +xml = lxml.etree.parse('%s/Metadata/clients.xml'%prefix) +for client in xml.findall('.//Client'): + if '-u' in sys.argv: + if client.get("pingable") == "Y": + print client.get("name") + elif '-d' in sys.argv: + if client.get("pingable") == "N": + print client.get("name") + elif '-p' in sys.argv and sys.argv[sys.argv.index('-p') + 1] != '': + if client.get("profile") == sys.argv[sys.argv.index('-p') + 1]: + print client.get("name") + elif '-a' in sys.argv: + print client.get("name") + + + + + + |