summaryrefslogtreecommitdiffstats
path: root/src/sbin/bcfg2-query
diff options
context:
space:
mode:
Diffstat (limited to 'src/sbin/bcfg2-query')
-rwxr-xr-xsrc/sbin/bcfg2-query49
1 files changed, 0 insertions, 49 deletions
diff --git a/src/sbin/bcfg2-query b/src/sbin/bcfg2-query
deleted file mode 100755
index 61fd37aee..000000000
--- a/src/sbin/bcfg2-query
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/python
-
-import Bcfg2.Server.Core, Bcfg2.Logging
-import lxml.etree, sys, ConfigParser, time
-
-if __name__ == "__main__":
- CP = ConfigParser.ConfigParser()
- CP.read(['/etc/bcfg2.conf'])
- try:
- prefix = CP.get('server', 'repository')
- except:
- prefix = "/var/lib/bcfg2"
-
- if len(sys.argv) < 2:
- print "Usage bcfg2-query -a|-c|-s|-n|-g <group name> -p <profile name>"
- print "\t -a\t\t shows all clients"
- 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 -v\t\t turn on debugging messages"
- print "\t -g <group name>\t shows all the clients that are members of that group"
- print "\t -p <profile name>\t shows all the clients of that profile"
- sys.exit(1)
-
- ''' Create the metadata object '''
- bcore = Bcfg2.Server.Core.Core('%s'%prefix, [], ['Metadata'], None, False)
- while(bcore.fam.Service()):
- time.sleep(1)
- mdata = bcore.plugins['Metadata']
-
- ''' Turn on debugging '''
- if '-v' in sys.argv:
- Bcfg2.Logging.setup_logging(0, to_console=True)
-
- if '-a' in sys.argv:
- cnames = [key for key in mdata.clients.keys()]
- elif '-g' in sys.argv:
- group = sys.argv[sys.argv.index('-g') + 1]
- cnames = mdata.GetClientByGroup('%s' % group)
- elif '-p' in sys.argv:
- profile = sys.argv[sys.argv.index('-p') + 1]
- cnames = mdata.GetClientByProfile('%s' % profile)
-
- if '-c' in sys.argv:
- print ",".join(cnames)
- elif '-s' in sys.argv:
- print " ".join(cnames)
- else:
- print "\n".join(cnames)