renamed utils.check_cmd to utils.cmd, updated host_cmd to allow for shell commands for output redirection

This commit is contained in:
Blake Harnden 2019-10-21 10:32:42 -07:00
parent 16b7e70c33
commit 78f981463d
15 changed files with 34 additions and 31 deletions

View file

@ -48,7 +48,7 @@ class CoreInterface(object):
use_ovs = session.options.get_config("ovs") == "True"
self.net_client = get_net_client(use_ovs, self.host_cmd)
def host_cmd(self, args, env=None, cwd=None, wait=True):
def host_cmd(self, args, env=None, cwd=None, wait=True, shell=False):
"""
Runs a command on the host system or distributed server.
@ -56,12 +56,13 @@ class CoreInterface(object):
:param dict env: environment to run command with
:param str cwd: directory to run command in
:param bool wait: True to wait for status, False otherwise
:param bool shell: True to use shell, False otherwise
:return: combined stdout and stderr
:rtype: str
:raises CoreCommandError: when a non-zero exit status occurs
"""
if self.server is None:
return utils.check_cmd(args, env, cwd, wait)
return utils.cmd(args, env, cwd, wait, shell)
else:
return self.server.remote_cmd(args, env, cwd, wait)