defined custom core command error that defaults to printing command output as well

This commit is contained in:
Blake J. Harnden 2018-03-02 16:22:20 -08:00
parent 29a3496eda
commit 974559843a
15 changed files with 90 additions and 81 deletions

View file

@ -6,10 +6,10 @@ by invoking the vcmd shell command.
"""
import os
import subprocess
import vcmd
from core import CoreCommandError
from core import constants
from core import logger
from core.misc import utils
@ -106,11 +106,11 @@ class VnodeClient(object):
:param list[str]|str args: command to run
:return: combined stdout and stderr
:rtype: str
:raises subprocess.CalledProcessError: when there is a non-zero exit status
:raises core.CoreCommandError: when there is a non-zero exit status
"""
status, output = self.cmd_output(args)
if status != 0:
raise subprocess.CalledProcessError(status, args, output)
raise CoreCommandError(status, args, output)
return output.strip()
def popen(self, args):