Skip to content

Commit

Permalink
mgr/cephadm: fix test failure on newer python
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
phlogistonjohn committed Mar 21, 2024
1 parent f8160ed commit 07b4490
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/pybind/mgr/cephadm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down

0 comments on commit 07b4490

Please sign in to comment.