diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2007-08-07 18:11:05 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2007-08-07 18:11:05 +0000 |
commit | cf4b95f1b9e460a3905701feb1040b6c9038e141 (patch) | |
tree | 8de60ec0952866d1165d2a6b1804c4abe663bb67 /src | |
parent | bb95ea862a35e6883b21e162b081beb813d0aabc (diff) | |
download | bcfg2-cf4b95f1b9e460a3905701feb1040b6c9038e141.tar.gz bcfg2-cf4b95f1b9e460a3905701feb1040b6c9038e141.tar.bz2 bcfg2-cf4b95f1b9e460a3905701feb1040b6c9038e141.zip |
Make bcfg2-query usable as nodeattr for pdsh
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@3610 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rwxr-xr-x | src/sbin/bcfg2-query | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/sbin/bcfg2-query b/src/sbin/bcfg2-query index 9880035d5..3f0209192 100755 --- a/src/sbin/bcfg2-query +++ b/src/sbin/bcfg2-query @@ -13,6 +13,9 @@ if len(sys.argv) < 2: print "Usage bcfg2-query -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 -c\t\t prints node names in a comma delimited list" + print "\t -s\t\t prints node names in a space delimited list" + print "\t -n\t\t prints node names in a newline delimited list (default)" print "\t -p <profile name>\t shows all the clients of that profile" print "\t -a\t shows all clients" sys.exit(1) @@ -28,5 +31,11 @@ elif '-u' in sys.argv: elif '-a' in sys.argv: clients = xml.xpath(".//Client") -for client in clients: - print client.get('name') +cnames = [client.get('name') for client in clients] +if '-c' in sys.argv: + print ",".join(cnames) +elif '-s' in sys.argv: + print " ".join(cnames) +else: + print "\n".join(cnames) + |