b7322649db
- install py27-pycodestyle on Freebsd - conditionally use pycodestyle in check_format.sh - fix various E722 do not use bare except errors caught by pycodestyle - see: https://github.com/PyCQA/pycodestyle/issues/466 Change-Id: I64ecf3f204a456134d891d1339f3aa1db281965a Signed-off-by: John Meneghini <johnm@netapp.com> Signed-off-by: Ed Rodriguez <ed.rodriguez@netapp.com> Reviewed-on: https://review.gerrithub.io/416460 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
39 lines
976 B
Python
Executable File
39 lines
976 B
Python
Executable File
#!/usr/bin/env python
|
|
import sys
|
|
import argparse
|
|
from os import getuid
|
|
from configshell_fb import ConfigShell
|
|
from spdkcli import UIRoot
|
|
|
|
|
|
def main():
|
|
"""
|
|
Start SPDK CLI
|
|
:return:
|
|
"""
|
|
shell = ConfigShell("~/.scripts")
|
|
|
|
parser = argparse.ArgumentParser(description="SPDK command line interface")
|
|
parser.add_argument("-s", dest="socket", help="RPC socket path", default="/var/tmp/spdk.sock")
|
|
parser.add_argument("commands", metavar="command", type=str, nargs="*", default="",
|
|
help="commands to execute by SPDKCli as one-line command")
|
|
args = parser.parse_args()
|
|
|
|
root_node = UIRoot(args.socket, shell)
|
|
try:
|
|
root_node.refresh()
|
|
except BaseException:
|
|
pass
|
|
|
|
if len(args.commands) > 0:
|
|
shell.run_cmdline(" ".join(args.commands))
|
|
sys.exit(0)
|
|
|
|
shell.con.display("SPDK CLI v0.1")
|
|
shell.con.display("")
|
|
shell.run_interactive()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|