summaryrefslogtreecommitdiffstats
path: root/src/sbin/bcfg2-admin
diff options
context:
space:
mode:
Diffstat (limited to 'src/sbin/bcfg2-admin')
-rwxr-xr-xsrc/sbin/bcfg2-admin8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/sbin/bcfg2-admin b/src/sbin/bcfg2-admin
index 2c9a43859..f8b82d201 100755
--- a/src/sbin/bcfg2-admin
+++ b/src/sbin/bcfg2-admin
@@ -12,6 +12,7 @@ log = logging.getLogger('bcfg2-admin')
import Bcfg2.Server.Admin
+
def mode_import(modename):
"""Load Bcfg2.Server.Admin.<mode>."""
modname = modename.capitalize()
@@ -19,10 +20,12 @@ def mode_import(modename):
(modname)).Server.Admin, modname)
return getattr(mod, modname)
+
def get_modes():
"""Get all available modes, except for the base mode."""
return [x.lower() for x in Bcfg2.Server.Admin.__all__ if x != 'mode']
+
def create_description():
"""Create the description string from the list of modes."""
modes = get_modes()
@@ -36,6 +39,7 @@ def create_description():
continue
return description.getvalue()
+
def main():
Bcfg2.Logger.setup_logging('bcfg2-admin', to_console=True, level=40)
usage = "Usage: %prog [options] MODE [args]"
@@ -56,7 +60,7 @@ def main():
else:
# Print short help for all modes
parser.print_help()
- print create_description()
+ print(create_description())
raise SystemExit(0)
if args[0] in get_modes():
@@ -73,7 +77,7 @@ def main():
else:
log.error("Unknown mode %s" % args[0])
parser.print_help()
- print create_description()
+ print(create_description())
raise SystemExit(1)
if __name__ == '__main__':