diff options
Diffstat (limited to 'src/sbin')
-rwxr-xr-x | src/sbin/bcfg2 | 86 |
1 files changed, 26 insertions, 60 deletions
diff --git a/src/sbin/bcfg2 b/src/sbin/bcfg2 index 62f2e1775..4749d699d 100755 --- a/src/sbin/bcfg2 +++ b/src/sbin/bcfg2 @@ -43,71 +43,37 @@ class Client: optinfo = { # 'optname': (('-a', argdesc, optdesc), # env, cfpath, default, boolean)), - 'verbose': (('-v', False, "enable verbose output"), - False, False, False, True), - 'extra': (('-e', False, "enable extra entry output"), - False, False, False, True), - 'quick': (('-q', False, "disable some checksum verification"), - False, False, False, True), - 'debug': (('-d', False, "enable debugging output"), - False, False, False, True), - 'drivers': (('-D', '<driver1>,<driver2>', "Specify tool driver set"), - False, ('client', 'drivers'), False, False), - 'fingerprint': (('-F', '<server fingerprint>', "Server Fingerprint"), - False, ('communication', 'fingerprint'), False, False), - 'dryrun': (('-n', False, "do not actually change the system"), - False, False, False, True), - 'build': (('-B', False, "run in build mode"), - False, False, False, True), - 'paranoid': (('-P', False, "make automatic backups of config files"), - False, False, False, True), - 'bundle': (('-b', '<bundle>', "only configure the given bundle"), - False, False, False, False), - 'file': (('-f', "<configspec>", "configure from a file rather than querying the server"), - False, False, False, False), - 'interactive': (('-I', False, "prompt the user for each change"), - False, False, False, True), - 'cache': (('-c', "<configspec>", "store the configuration in a file"), - False, False, False, False), - 'profile': (('-p', '<profile>', "assert the given profile for the host"), - False, False, False, False), - 'remove': (('-r', '(packages|services|all)', "force removal of additional configuration items"), - False, False, False, False), - 'help': (('-h', False, "print this help message"), - False, False, False, True), - 'setup': (('-C', '<configfile>', "use given config file (default /etc/bcfg2.conf)"), - False, False, '/etc/bcfg2.conf', False), - 'server': (('-S', '<server url>', 'the server hostname to connect to'), - False, ('components', 'bcfg2'), False, False), - 'user': (('-u', '<user>', 'the user to provide for authentication'), - False, ('communication', 'user'), False, False), - 'password': (('-x', '<password>', 'the password to provide for authentication'), - False, ('communication', 'password'), False, False), - 'retries': (('-R', '<numretries>', 'the number of times to retry network communication'), - False, ('communication', 'retries'), '3', False), - 'kevlar': (('-k', False, "run in kevlar (bulletproof) mode"), - False, False, False, True), - 'agent': (('-A', False, "run in agent (continuous) mode, wait for reconfigure command from server"), - False, False, False, True), - 'agent-port': (('-g', '<agent tcp port>', 'the port on which to bind for agent mode'), - False, ('communication', 'agent-port'), '6789', False), - 'agent-background': (('-i', '<pidfile name>', "Daemonize the agent"), - False, False, False, False), - 'key': (('-K', '<client key file>', 'ssl cert + private key for agent mode xmlrpc server'), - False, ('communication', 'key'), False, False), + 'verbose': Bcfg2.Options.VERBOSE, + 'extra': Bcfg2.Options.CLIENT_EXTRA_DISPLAY, + 'quick': Bcfg2.Options.CLIENT_QUICK, + 'debug': Bcfg2.Options.DEBUG, + 'drivers': Bcfg2.Options.CLIENT_DRIVERS, + 'fingerprint': Bcfg2.Options.SERVER_FINGERPRINT, + 'dryrun': Bcfg2.Options.CLIENT_DRYRUN, + 'build': Bcfg2.Options.CLIENT_BUILD, + 'paranoid': Bcfg2.Options.CLIENT_PARANOID, + 'bundle': Bcfg2.Options.CLIENT_BUNDLE, + 'file': Bcfg2.Options.CLIENT_FILE, + 'interactive': Bcfg2.Options.INTERACTIVE, + 'cache': Bcfg2.Options.CLIENT_CACHE, + 'profile': Bcfg2.Options.CLIENT_PROFILE, + 'remove': Bcfg2.Options.CLIENT_REMOVE, + 'help': Bcfg2.Options.HELP, + 'setup': Bcfg2.Options.CFILE, + 'server': Bcfg2.Options.SERVER_LOCATION, + 'user': Bcfg2.Options.CLIENT_USER, + 'password': Bcfg2.Options.SERVER_PASSWORD, + 'retries': Bcfg2.Options.CLIENT_RETRIES, + 'kevlar': Bcfg2.Options.CLIENT_KEVLAR, + 'agent': Bcfg2.Options.CLIENT_AGENT, + 'agent-port': Bcfg2.Options.CLIENT_PORT, + 'agent-background': Bcfg2.Options.CLIENT_BACKGROUND, + 'key': Bcfg2.Options.SERVER_KEY, } optparser = Bcfg2.Options.OptionParser('bcfg2', optinfo) self.setup = optparser.parse() - # override default settings - settings.read_config_file(self.setup['setup']) - - if getopt.getopt(sys.argv[1:], - optparser.shortopt, optparser.longopt)[1]: - print "Bcfg2 takes no arguments, only options" - print optparser.helpmsg - raise SystemExit(1) level = 30 if self.setup['verbose']: level = 20 |