updated utils.check_cmd to accept the same parameters as other commands and be leveraged for node cmds

This commit is contained in:
Blake Harnden 2019-10-11 13:15:57 -07:00
parent d326f246a7
commit fc7a161221
6 changed files with 25 additions and 22 deletions

View file

@ -56,7 +56,7 @@ class DockerClient(object):
cmd=cmd
))
def ns_cmd(self, cmd):
def ns_cmd(self, cmd, wait):
if isinstance(cmd, list):
cmd = " ".join(cmd)
args = "nsenter -t {pid} -u -i -p -n {cmd}".format(
@ -64,7 +64,7 @@ class DockerClient(object):
cmd=cmd
)
logging.info("ns cmd: %s", args)
return utils.check_cmd(args)
return utils.check_cmd(args, wait=wait)
def get_pid(self):
args = "docker inspect -f '{{{{.State.Pid}}}}' {name}".format(name=self.name)
@ -147,7 +147,7 @@ class DockerNode(CoreNode):
logging.debug("node down, not running network command: %s", args)
return ""
return self.client.ns_cmd(args)
return self.client.ns_cmd(args, wait)
def termcmdstring(self, sh="/bin/sh"):
"""