Commit 223810e9 authored by Pawel Kaminski's avatar Pawel Kaminski Committed by Darek Stojaczyk
Browse files

spdkcli: Fix: catch exceptions for spdkcli commands.



Fixes: #582

Change-Id: Ief6f4a52f410ff3dc06c9c1551c2c6d464cac598
Signed-off-by: default avatarPawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/442323


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarPawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
parent 6a427c74
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@ import sys
import argparse
import configshell_fb
from os import getuid
from configshell_fb import ConfigShell, shell
from configshell_fb import ConfigShell, shell, ExecutionError
from spdkcli import UIRoot
from pyparsing import (alphanums, Optional, Suppress, Word, Regex,
                       removeQuotes, dblQuotedString, OneOrMore)
@@ -49,12 +49,20 @@ def main():
        pass

    if len(args.commands) > 0:
        try:
            spdk_shell.run_cmdline(" ".join(args.commands))
        except Exception as e:
            sys.stderr.write("%s\n" % e)
            sys.exit(1)
        sys.exit(0)

    spdk_shell.con.display("SPDK CLI v0.1")
    spdk_shell.con.display("")
    while not spdk_shell._exit:
        try:
            spdk_shell.run_interactive()
        except ExecutionError as e:
            spdk_shell.log.error("%s" % e)


if __name__ == "__main__":