From 6f609b5122cd4b9534808682cc03bc3200ed5b70 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Wed, 22 Apr 2015 15:50:27 -0600 Subject: [PATCH] Fix CommandFailedError when node is None Signed-off-by: Zack Cerza --- teuthology/exceptions.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/teuthology/exceptions.py b/teuthology/exceptions.py index efc8e71f84..9034d5fadb 100644 --- a/teuthology/exceptions.py +++ b/teuthology/exceptions.py @@ -42,9 +42,10 @@ class CommandFailedError(Exception): def __str__(self): prefix = "Command failed" if self.label: - prefix = "Command failed ({label})".format(label=self.label) - return "{prefix} on {node} with status {status}: {cmd!r}".format( - node=self.node, + prefix += " ({label})".format(label=self.label) + if self.node: + prefix += " on {node}".format(node=self.node) + return "{prefix} with status {status}: {cmd!r}".format( status=self.exitstatus, cmd=self.command, prefix=prefix, -- 2.39.5