updates to check_cmd to just return output, as status is pointless

This commit is contained in:
Blake J. Harnden 2018-03-02 13:57:50 -08:00
parent 43554cbb62
commit a8ee7f35d6
12 changed files with 45 additions and 51 deletions

View file

@ -650,7 +650,7 @@ class RJ45Node(PyCoreNode, PyCoreNetIf):
self.old_up = False
self.old_addrs = []
args = [constants.IP_BIN, "addr", "show", "dev", self.localname]
_, output = utils.check_cmd(args)
output = utils.check_cmd(args)
for line in output.split("\n"):
items = line.split()
if len(items) < 2:

View file

@ -389,7 +389,7 @@ class OvsCtrlNet(OvsNet):
Check if there are old control net bridges and delete them
"""
_, output = utils.check_cmd([constants.OVS_BIN, "list-br"])
output = utils.check_cmd([constants.OVS_BIN, "list-br"])
output = output.strip()
if output:
for line in output.split("\n"):

View file

@ -98,7 +98,7 @@ class SimpleLxcNode(PyCoreNode):
env["NODE_NUMBER"] = str(self.objid)
env["NODE_NAME"] = str(self.name)
_, output = utils.check_cmd(vnoded, env=env)
output = utils.check_cmd(vnoded, env=env)
self.pid = int(output)
# create vnode client
@ -187,8 +187,8 @@ class SimpleLxcNode(PyCoreNode):
Runs shell command on node.
:param list[str]|str args: command to run
:return: exist status and combined stdout and stderr
:rtype: tuple[int, str]
:return: combined stdout and stderr
:rtype: str
:raises subprocess.CalledProcessError: when a non-zero exit status occurs
"""
return self.client.check_cmd(args)
@ -284,7 +284,7 @@ class SimpleLxcNode(PyCoreNode):
if self.up:
# TODO: potentially find better way to query interface ID
# retrieve interface information
_, output = self.check_cmd(["ip", "link", "show", veth.name])
output = self.check_cmd(["ip", "link", "show", veth.name])
logger.info("interface command output: %s", output)
output = output.split("\n")
veth.flow_id = int(output[0].strip().split(":")[0]) + 1

View file

@ -104,14 +104,14 @@ class VnodeClient(object):
Run command and return exit status and combined stdout and stderr.
:param list[str]|str args: command to run
:return: exit status and combined stdout and stderr
:rtype: tuple[int, str]
:return: combined stdout and stderr
:rtype: str
:raises subprocess.CalledProcessError: when there is a non-zero exit status
"""
status, output = self.cmd_output(args)
if status != 0:
raise subprocess.CalledProcessError(status, args, output)
return status, output.strip()
return output.strip()
def popen(self, args):
"""