summaryrefslogtreecommitdiffstats
path: root/lib/bb/ui/knotty.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bb/ui/knotty.py')
-rw-r--r--lib/bb/ui/knotty.py29
1 files changed, 17 insertions, 12 deletions
diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py
index 389c3cc64..c6a1d3f98 100644
--- a/lib/bb/ui/knotty.py
+++ b/lib/bb/ui/knotty.py
@@ -216,21 +216,25 @@ class TerminalFilter(object):
fd = sys.stdin.fileno()
self.termios.tcsetattr(fd, self.termios.TCSADRAIN, self.stdinbackup)
-def main(server, eventHandler, params, tf = TerminalFilter):
-
+def _log_settings_from_server(server):
# Get values of variables which control our output
includelogs, error = server.runCommand(["getVariable", "BBINCLUDELOGS"])
if error:
logger.error("Unable to get the value of BBINCLUDELOGS variable: %s" % error)
- return 1
+ raise BaseException(error)
loglines, error = server.runCommand(["getVariable", "BBINCLUDELOGS_LINES"])
if error:
logger.error("Unable to get the value of BBINCLUDELOGS_LINES variable: %s" % error)
- return 1
+ raise BaseException(error)
consolelogfile, error = server.runCommand(["getVariable", "BB_CONSOLELOG"])
if error:
logger.error("Unable to get the value of BB_CONSOLELOG variable: %s" % error)
- return 1
+ raise BaseException(error)
+ return includelogs, loglines, consolelogfile
+
+def main(server, eventHandler, params, tf = TerminalFilter):
+
+ includelogs, loglines, consolelogfile = _log_settings_from_server(server)
if sys.stdin.isatty() and sys.stdout.isatty():
log_exec_tty = True
@@ -254,7 +258,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
consolelog.setFormatter(conlogformat)
logger.addHandler(consolelog)
- try:
+ if not params.observe_only:
params.updateFromServer(server)
cmdline = params.parseActions()
if not cmdline:
@@ -271,9 +275,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
elif ret != True:
logger.error("Command '%s' failed: returned %s" % (cmdline, ret))
return 1
- except xmlrpclib.Fault as x:
- logger.error("XMLRPC Fault getting commandline:\n %s" % x)
- return 1
+
parseprogress = None
cacheprogress = None
@@ -320,7 +322,7 @@ def main(server, eventHandler, params, tf = TerminalFilter):
elif event.levelno == format.WARNING:
warnings = warnings + 1
# For "normal" logging conditions, don't show note logs from tasks
- # but do show them if the user has changed the default log level to
+ # but do show them if the user has changed the default log level to
# include verbose/debug messages
if event.taskpid != 0 and event.levelno <= format.NOTE:
continue
@@ -469,12 +471,15 @@ def main(server, eventHandler, params, tf = TerminalFilter):
pass
except KeyboardInterrupt:
termfilter.clearFooter()
- if main.shutdown == 1:
+ if params.observe_only:
+ print("\nKeyboard Interrupt, exiting observer...")
+ main.shutdown = 2
+ if not params.observe_only and main.shutdown == 1:
print("\nSecond Keyboard Interrupt, stopping...\n")
_, error = server.runCommand(["stateStop"])
if error:
logger.error("Unable to cleanly stop: %s" % error)
- if main.shutdown == 0:
+ if not params.observe_only and main.shutdown == 0:
print("\nKeyboard Interrupt, closing down...\n")
interrupted = True
_, error = server.runCommand(["stateShutdown"])