From 0b7647a5a6c85a8a1762ec4482004107989c8550 Mon Sep 17 00:00:00 2001 From: Miikka Koistinen Date: Fri, 15 Jun 2018 11:54:14 +0300 Subject: Fix remote command execution in common.utils yardstick.common.utils get_port_mac and get_port_ip both raise a RuntimeError on positive remote command exit status. This commit fixes them to use the error raising mechanism in yardstick.ssh.SSH. Additionally, the class AutoConnectSSH class needed an additional argument to allow the raising mechanism to work correctly. JIRA: YARDSTICK-1240 Change-Id: Idad125ebbd668cef10a6149eb3e601a437a8d40d Signed-off-by: Miikka Koistinen --- yardstick/common/utils.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'yardstick/common') diff --git a/yardstick/common/utils.py b/yardstick/common/utils.py index 6c5389cd0..068271c66 100644 --- a/yardstick/common/utils.py +++ b/yardstick/common/utils.py @@ -194,20 +194,16 @@ def parse_ini_file(path): def get_port_mac(sshclient, port): cmd = "ifconfig |grep HWaddr |grep %s |awk '{print $5}' " % port - status, stdout, stderr = sshclient.execute(cmd) + _, stdout, _ = sshclient.execute(cmd, raise_on_error=True) - if status: - raise RuntimeError(stderr) return stdout.rstrip() def get_port_ip(sshclient, port): cmd = "ifconfig %s |grep 'inet addr' |awk '{print $2}' " \ "|cut -d ':' -f2 " % port - status, stdout, stderr = sshclient.execute(cmd) + _, stdout, _ = sshclient.execute(cmd, raise_on_error=True) - if status: - raise RuntimeError(stderr) return stdout.rstrip() -- cgit 1.2.3-korg