]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
python-common: Add simple str(HostSpec)
authorSebastian Wagner <sebastian.wagner@suse.com>
Mon, 15 Jun 2020 16:09:30 +0000 (18:09 +0200)
committerSebastian Wagner <sebastian.wagner@suse.com>
Thu, 25 Jun 2020 13:55:17 +0000 (15:55 +0200)
Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/python-common/ceph/deployment/hostspec.py

index a93d8916ffce8ac55c1a076740aff491f5305477..8fc122531ebb4541a08702f6688045de9ef63ae3 100644 (file)
@@ -54,6 +54,11 @@ class HostSpec(object):
 
         return "HostSpec({})".format(', '.join(map(repr, args)))
 
+    def __str__(self):
+        if self.hostname != self.addr:
+            return f'{self.hostname} ({self.addr})'
+        return self.hostname
+
     def __eq__(self, other):
         # Let's omit `status` for the moment, as it is still the very same host.
         return self.hostname == other.hostname and \