]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: fix test failure on newer python
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 13 Dec 2023 19:33:20 +0000 (14:33 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Thu, 21 Mar 2024 22:30:58 +0000 (18:30 -0400)
Tests that touch this enum fail for me locally but pass in the CI. This
seems to be due to new enum related behavior in Python 3.11.
See: https://blog.pecar.me/python-enum
Instead of fixing it as suggested in the above blog, adding a __str__
method works on all python versions I care to know about.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/cephadm/utils.py

index 3aedfbd86f0084eec57af70ab814ccba96e09819..1ba3e48454a209be6525edb7db39577f7b50b199 100644 (file)
@@ -57,6 +57,9 @@ class SpecialHostLabels(str, Enum):
     def to_json(self) -> str:
         return self.value
 
+    def __str__(self) -> str:
+        return self.value
+
 
 def name_to_config_section(name: str) -> ConfEntity:
     """