X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Fscripts%2Ftopo_reservation.py;h=0016ebc0cc8265dfe96480408bddac1d348cd970;hp=c1b5c4658e544ae2674ea7a4b810b59aa5f4e9e6;hb=01d8f262afc567c3d49a23c3cb2cdeaced8a6887;hpb=cca05a55f3434d8a031b98f4a496adb8df20c122 diff --git a/resources/tools/scripts/topo_reservation.py b/resources/tools/scripts/topo_reservation.py index c1b5c4658e..0016ebc0cc 100755 --- a/resources/tools/scripts/topo_reservation.py +++ b/resources/tools/scripts/topo_reservation.py @@ -24,13 +24,30 @@ import argparse import sys import yaml -from resources.libraries.python.ssh import exec_cmd +from resources.libraries.python.ssh import exec_cmd as _exec_cmd RESERVATION_DIR = u"/tmp/reservation_dir" RESERVATION_NODE = u"TG" +def exec_cmd(node, cmd): + """A wrapper around ssh.exec_cmd with disabled JSON export. + + Using this, maintainers can use "exec_cmd" without worrying + about interaction with json export. + + TODO: Instead this, divide ssh module into reusable and robot-bound parts. + + :param node: Node object as parsed from topology file to execute cmd on. + :param cmd: Command to execute. + :type node: dict + :type cmd: str + :returns: RC, Stdout, Stderr. + :rtype: Tuple[int, str, str] + """ + return _exec_cmd(node, cmd, export=False) + def diag_cmd(node, cmd): """Execute cmd, print cmd and stdout, ignore stderr and rc; return None.