]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Fix CommandFailedError when node is None
authorZack Cerza <zack@redhat.com>
Wed, 22 Apr 2015 21:50:27 +0000 (15:50 -0600)
committerZack Cerza <zack@redhat.com>
Mon, 27 Apr 2015 21:57:13 +0000 (15:57 -0600)
Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/exceptions.py

index efc8e71f849077a5e26dd876ac23454be32a5851..9034d5fadb2e02ddf62c801d3657a6b53e43db62 100644 (file)
@@ -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,