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) --- doc/server/bcfg2-info.txt | 17 ++++++---- man/bcfg2-info.8 | 6 +++- src/sbin/bcfg2-info | 84 ++++++++++++++++++++++++++++++++--------------- 3 files changed, 72 insertions(+), 35 deletions(-) diff --git a/doc/server/bcfg2-info.txt b/doc/server/bcfg2-info.txt index 35d176e96..201900ba9 100644 --- a/doc/server/bcfg2-info.txt +++ b/doc/server/bcfg2-info.txt @@ -19,7 +19,7 @@ plugins. Getting Started =============== -First, fire up the bcfg2-info interpreter. +First, fire up the ``bcfg2-info`` interpreter. .. code-block:: none @@ -45,14 +45,13 @@ displayed. For example, after a change to a file in the repository: .. code-block:: none - >update + > update Handled 1 events in 0.001s > update > This explicit update process allows you to control the update process, -as well as see the precise changes caused by repository -modifications. +as well as see the precise changes caused by repository modifications. ``bcfg2-info`` has several builtin commands that display the state of various internal server core state. These are most useful for @@ -60,14 +59,18 @@ examining the state of client metadata, either for a single client, or for clients overall. **clients** - displays a list of clients, along with their profile groups + Displays a list of clients, along with their profile groups **groups** - displays a list of groups, the inheritance hierarchy, profile + Displays a list of groups, the inheritance hierarchy, profile status, and category name, if there is one. **showclient** - displays full metadata information for a client, including + Displays full metadata information for a client, including profile group, group memberships, bundle list, and any connector data, like Probe values or Property info. +**config** + Displays the configuration of the Bcfg2 server. + +To leave the interactive shell, just type ``quit`` or ``exit``. Debugging Configuration Rules ============================= diff --git a/man/bcfg2-info.8 b/man/bcfg2-info.8 index d46e34def..a97f60c40 100644 --- a/man/bcfg2-info.8 +++ b/man/bcfg2-info.8 @@ -22,7 +22,7 @@ Specify the location of the configuration file (if it is not in .RE .B "\-E " .RS -Specify the encoding of cfg files. +Specify the encoding of config files. .RE .B "\-Q .RS @@ -71,6 +71,10 @@ Print out group/bundle information. .RS Print out client/profile information. .RE +.B config +.RS +Print out the configuration of the Bcfg2 server. +.RE .B debug .RS Shell out to native python interpreter. 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