diff options
author | Jerome Martin <jxm@risingtidesystems.com> | 2011-07-18 23:36:41 +0200 |
---|---|---|
committer | Jerome Martin <jxm@risingtidesystems.com> | 2011-07-18 23:38:59 +0200 |
commit | 507e8fc26d53a64058311875e6cbfad707221644 (patch) | |
tree | b9b112db9a7b33d418dd1900b8264496e00b8b1d /configshell | |
parent | 1ba8f2306668208c70310af4b6425fe517763366 (diff) | |
download | configshell-fb-507e8fc26d53a64058311875e6cbfad707221644.tar.gz |
Improved handling of command_execution result.
* Replaces 'is' by '==' for string test.
* Explicitely looks for a ConfigNode to change current node.
* Added debugging output.
* Raise an exception on unexpected result.
Diffstat (limited to 'configshell')
-rw-r--r-- | configshell/shell.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/configshell/shell.py b/configshell/shell.py index af3137e..ab32f8e 100644 --- a/configshell/shell.py +++ b/configshell/shell.py @@ -25,6 +25,8 @@ import configshell.log as log import configshell.prefs as prefs import configshell.console as console +from configshell.node import ConfigNode, ExecutionError + # A fix for frozen packages import signal def handle_sigint(signum, frame): @@ -898,10 +900,13 @@ class ConfigShell(object): if iterall: self.con.display("[%s]" % target.path) result = target.execute_command(command, pparams, kparams) - if result is 'EXIT': + self.log.debug("Command execution returned %r" % result) + if isinstance(result, ConfigNode): + self._current_node = result + elif result == 'EXIT': self._exit = True elif result is not None: - self._current_node = result + raise ExecutionError("Unexpected result: %r" % result) # Public methods |