From 7a88be280bca43e50e597f88e2d92083b889da5f Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sun, 19 Dec 2010 23:04:58 +0100 Subject: Added option to show server configuration details (cherry picked from commit 4463d2dc9356685e1b22256a60b3e22eb69378e4) --- src/sbin/bcfg2-info | 84 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 57 insertions(+), 27 deletions(-) (limited to 'src/sbin') diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index ba340dbef..e41036130 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -156,25 +156,25 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.Core): def do_help(self, _): """Print out usage info.""" print 'Commands:' - print 'build - Build config for hostname, writing to filename.' - print 'builddir - Build config for hostname, writing separate files to dirname.' - print 'buildall - Build configs for all clients in directory.' - print 'buildfile - Build config file for hostname (not written to disk).' - print 'bundles - Print out group/bundle information.' - print 'clients - Print out client/profile information.' - print 'config - Print out the information from bcf2.conf.' - print 'debug - Shell out to native python interpreter.' - print 'event_debug - Display filesystem events as they are processed.' - print 'generators - List current versions of generators.' - print 'groups - List groups.' - print 'help - Print this list of available commands.' - print 'mappings - Print generator mappings for optional type and name.' - print 'profile - Profile a single bcfg2-info command.' - print 'quit - Exit the bcfg2-info command line.' - print 'showentries - Show abstract configuration entries for a given host.' - print 'showclient - Show metadata for given hosts.' - print 'update - Process pending file events.' - print 'version - Print version of this tool.' + print 'build - Build config for hostname, writing to filename' + print 'builddir - Build config for hostname, writing separate files to dirname' + print 'buildall - Build configs for all clients in directory' + print 'buildfile - Build config file for hostname (not written to disk)' + print 'bundles - Print out group/bundle information' + print 'clients - Print out client/profile information' + print 'config - Print out the configuration of the Bcfg2 server' + print 'debug - Shell out to native python interpreter' + print 'event_debug - Display filesystem events as they are processed' + print 'generators - List current versions of generators' + print 'groups - List groups' + print 'help - Print this list of available commands' + print 'mappings - Print generator mappings for optional type and name' + print 'profile - Profile a single bcfg2-info command' + print 'quit - Exit the bcfg2-info command line' + print 'showentries - Show abstract configuration entries for a given host' + print 'showclient - Show metadata for given hosts' + print 'update - Process pending file events' + print 'version - Print version of this tool' def do_update(self, _): @@ -297,8 +297,24 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.Core): printTabular(data) def do_config(self, _): - """Print out the current configuration stored in bcfg2.conf.""" - print "Here the configuration should go..." + """Print out the current configuration of Bcfg2.""" + output=[ + ('Description', 'Value'), + ('Path Bcfg2 repository', setup['repo']), + ('Plugins', setup['plugins']), + ('Password', setup['password']), + ('Server Metadata Connector', setup['mconnect']), + ('Filemonitor', setup['filemonitor']), + ('Server address', setup['location']), + ('Static', setup['static']), + ('Path to key', setup['key']), + ('Path to SSL certificate', setup['cert']), + ('Path to SSL CA certificate', setup['ca']), + ('Protocol', setup['protocol']), + ('Logging', setup['logging']) + ] + printTabular(output) + def do_generators(self, _): """Print out generator info.""" @@ -382,7 +398,7 @@ class infoCore(cmd.Cmd, Bcfg2.Server.Core.Core): def do_mappings(self, args): """Print out mapping info.""" - # dump all mappings unless type specified + # Dump all mappings unless type specified data = [('Plugin', 'Type', 'Name')] arglen = len(args.split()) for generator in self.generators: @@ -450,12 +466,26 @@ if __name__ == '__main__': 'configfile': Bcfg2.Options.CFILE, 'help': Bcfg2.Options.HELP, } - optinfo.update({'repo': Bcfg2.Options.SERVER_REPOSITORY, - 'plugins': Bcfg2.Options.SERVER_PLUGINS, - 'password': Bcfg2.Options.SERVER_PASSWORD, + optinfo.update({ 'event debug': Bcfg2.Options.DEBUG, 'profile': Bcfg2.Options.CORE_PROFILE, - 'encoding': Bcfg2.Options.ENCODING}) + 'encoding': Bcfg2.Options.ENCODING, + # Server options + 'repo': Bcfg2.Options.SERVER_REPOSITORY, + 'plugins': Bcfg2.Options.SERVER_PLUGINS, + 'password': Bcfg2.Options.SERVER_PASSWORD, + 'mconnect': Bcfg2.Options.SERVER_MCONNECT, + 'filemonitor': Bcfg2.Options.SERVER_FILEMONITOR, + 'location': Bcfg2.Options.SERVER_LOCATION, + 'static': Bcfg2.Options.SERVER_STATIC, + 'key': Bcfg2.Options.SERVER_KEY, + 'cert': Bcfg2.Options.SERVER_CERT, + 'ca': Bcfg2.Options.SERVER_CA, + 'password': Bcfg2.Options.SERVER_PASSWORD, + 'protocol': Bcfg2.Options.SERVER_PROTOCOL, + # More options + 'logging': Bcfg2.Options.LOGGING_FILE_PATH + }) setup = Bcfg2.Options.OptionParser(optinfo) setup.parse(sys.argv[1:]) if setup['profile'] and have_profile: @@ -466,7 +496,7 @@ if __name__ == '__main__': displayTrace(prof) else: if setup['profile']: - print("Profiling functionality not available") + print("Profiling functionality not available.") loop = infoCore(setup['repo'], setup['plugins'], setup['password'], setup['encoding'], setup['event debug']) -- cgit v1.2.3-1-g7c22