summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2015-10-13 16:42:32 +0200
committerSol Jerome <sol.jerome@gmail.com>2015-10-13 13:11:02 -0500
commita5a25e56e595ea4eff0449390d62ff72c9d192b3 (patch)
treea097e21b3a87ebe74c7fbfa70095480670b4ee4d
parent3183714caadc5e5b896c580ec898e615875dc10a (diff)
downloadbcfg2-a5a25e56e595ea4eff0449390d62ff72c9d192b3.tar.gz
bcfg2-a5a25e56e595ea4eff0449390d62ff72c9d192b3.tar.bz2
bcfg2-a5a25e56e595ea4eff0449390d62ff72c9d192b3.zip
Info: EventDebug, Update and Quit are now command classes
-rw-r--r--src/lib/Bcfg2/Server/Info.py43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/lib/Bcfg2/Server/Info.py b/src/lib/Bcfg2/Server/Info.py
index 044936f14..418d984a1 100644
--- a/src/lib/Bcfg2/Server/Info.py
+++ b/src/lib/Bcfg2/Server/Info.py
@@ -385,6 +385,15 @@ class ExpireCache(InfoCmd):
self.core.metadata_cache.expire()
+class EventDebug(InfoCmd):
+ """ Enable debugging output for FAM events """
+ only_interactive = True
+ aliases = ['event_debug']
+
+ def run(self, _):
+ self.core.fam.set_debug(True)
+
+
class Bundles(InfoCmd):
""" Print out group/bundle info """
@@ -673,6 +682,15 @@ class Query(InfoCmd):
print("\n".join(res))
+class Quit(InfoCmd):
+ """ Exit program """
+ only_interactive = True
+ aliases = ['exit', 'EOF']
+
+ def run(self, _):
+ raise SystemExit(0)
+
+
class Shell(InfoCmd):
""" Open an interactive shell to run multiple bcfg2-info commands """
interactive = False
@@ -685,6 +703,14 @@ class Shell(InfoCmd):
print("\nCtrl-C pressed, exiting...")
+class Update(InfoCmd):
+ """ Process pending filesystem events """
+ only_interactive = True
+
+ def run(self, _):
+ self.core.fam.handle_events_in_interval(0.1)
+
+
class ProfileTemplates(InfoCmd):
""" Benchmark template rendering times """
@@ -870,23 +896,6 @@ class CLI(cmd.Cmd, Bcfg2.Options.CommandRegistry):
dynamically adds methods for the registed subcommands. """
return dir(self)
- def do_quit(self, _):
- """ quit|exit - Exit program """
- raise SystemExit(0)
-
- do_EOF = do_quit
- do_exit = do_quit
-
- def do_eventdebug(self, _):
- """ eventdebug - Enable debugging output for FAM events """
- self.core.fam.set_debug(True)
-
- do_event_debug = do_eventdebug
-
- def do_update(self, _):
- """ update - Process pending filesystem events """
- self.core.fam.handle_events_in_interval(0.1)
-
def onecmd(self, line):
""" Overwrite cmd.Cmd.onecmd to catch all exceptions (except
SystemExit) print an error message and continue cmdloop. """