diff options
author | Robert Gogolok <gogo@cs.uni-sb.de> | 2007-12-25 02:10:28 +0000 |
---|---|---|
committer | Robert Gogolok <gogo@cs.uni-sb.de> | 2007-12-25 02:10:28 +0000 |
commit | bbf92f4e66c2d17a124446203fca58fae0661b6e (patch) | |
tree | e030fbd30a5c3678353820262cd2d520d88d7b1a | |
parent | 24fe76357ea8edb21dd8a124627f18a12657bd11 (diff) | |
download | bcfg2-bbf92f4e66c2d17a124446203fca58fae0661b6e.tar.gz bcfg2-bbf92f4e66c2d17a124446203fca58fae0661b6e.tar.bz2 bcfg2-bbf92f4e66c2d17a124446203fca58fae0661b6e.zip |
use OptionParser for bcfg2-info
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4110 ce84e21b-d406-0410-9b95-82705330c041
-rwxr-xr-x | src/sbin/bcfg2-info | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/sbin/bcfg2-info b/src/sbin/bcfg2-info index e02283e4d..f40ef3e60 100755 --- a/src/sbin/bcfg2-info +++ b/src/sbin/bcfg2-info @@ -5,6 +5,7 @@ __revision__ = '$Revision$' import copy, logging, lxml.etree, sys, time, cmd import Bcfg2.Logging, Bcfg2.Server.Core, os import Bcfg2.Server.Plugins.Metadata, Bcfg2.Server.Plugin +import Bcfg2.Options logger = logging.getLogger('bcfg2-info') @@ -259,11 +260,16 @@ Usage: [quit|exit]""" if __name__ == '__main__': Bcfg2.Logging.setup_logging('bcfg2-info', to_syslog=False) - if '-C' in sys.argv: - cfile = sys.argv[-1] - else: - cfile = '/etc/bcfg2.conf' - loop = infoCore(cfile) + optinfo = { + 'configfile': (('-C', '<configfile>', "use given config file (default /etc/bcfg2.conf)"), + False, False, '/etc/bcfg2.conf', False), + 'help': (('-h', False, "print this help message"), + False, False, False, True) + } + optparser = Bcfg2.Options.OptionParser('bcfg2-info', optinfo) + setup = optparser.parse() + + loop = infoCore(setup['configfile']) loop.plugins['Metadata'].load_probedata() loop.do_loop() |