summaryrefslogtreecommitdiffstats
path: root/src/sbin/bcfg2-admin
diff options
context:
space:
mode:
Diffstat (limited to 'src/sbin/bcfg2-admin')
-rwxr-xr-xsrc/sbin/bcfg2-admin18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/sbin/bcfg2-admin b/src/sbin/bcfg2-admin
index 09117a3f4..d3b06733f 100755
--- a/src/sbin/bcfg2-admin
+++ b/src/sbin/bcfg2-admin
@@ -6,13 +6,12 @@ import logging
import Bcfg2.Server.Core
import Bcfg2.Logger
import Bcfg2.Options
+import Bcfg2.Server.Admin
# Compatibility import
from Bcfg2.Bcfg2Py3k import StringIO
log = logging.getLogger('bcfg2-admin')
-import Bcfg2.Server.Admin
-
def mode_import(modename):
"""Load Bcfg2.Server.Admin.<mode>."""
modname = modename.capitalize()
@@ -42,8 +41,16 @@ def main():
'configfile': Bcfg2.Options.CFILE,
'help': Bcfg2.Options.HELP,
'verbose': Bcfg2.Options.VERBOSE,
+ 'repo': Bcfg2.Options.SERVER_REPOSITORY,
+ 'plugins': Bcfg2.Options.SERVER_PLUGINS,
+ 'event debug': Bcfg2.Options.DEBUG,
+ 'filemonitor': Bcfg2.Options.SERVER_FILEMONITOR,
+ 'password': Bcfg2.Options.SERVER_PASSWORD,
+ 'encoding': Bcfg2.Options.ENCODING,
}
setup = Bcfg2.Options.OptionParser(optinfo)
+ # override default help message to include description of all modes
+ setup.hm = "%s\n%s" % (setup.buildHelpMessage(), create_description())
setup.parse(sys.argv[1:])
log_args = dict(to_syslog=False, to_console=logging.WARNING)
@@ -58,13 +65,12 @@ def main():
setup['args'] = [setup['args'][1], setup['args'][0]]
else:
# Print short help for all modes
- print("Usage:\n %s" % setup.buildHelpMessage())
- print(create_description())
+ print(setup.hm)
raise SystemExit(0)
if setup['args'][0] in get_modes():
modname = setup['args'][0].capitalize()
- if len(setup['args']) > 1 and setup['args'][1] == 'help':
+ if len(setup['args']) > 1 and setup['args'][1] == 'help':
print(mode_import(modname).__longhelp__)
raise SystemExit(0)
try:
@@ -73,7 +79,7 @@ def main():
e = sys.exc_info()[1]
log.error("Failed to load admin mode %s: %s" % (modname, e))
raise SystemExit(1)
- mode = mode_cls(setup['configfile'])
+ mode = mode_cls(setup)
mode(setup['args'][1:])
if hasattr(mode, 'bcore'):
mode.bcore.shutdown()