diff options
author | Adam King <47704447+adk3798@users.noreply.github.com> | 2025-01-14 18:28:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-14 18:28:22 +0100 |
commit | 3f1f3450aee368823dc8ae90a8cef13b89b1b950 (patch) | |
tree | e5dc1a3fe1e525b2d087089990c175b9a090c9d7 | |
parent | Merge pull request #60073 from mkogan1/wip-fix-rate-lim (diff) | |
parent | ceph-volume: fix importlib.metadata compat (diff) | |
download | ceph-3f1f3450aee368823dc8ae90a8cef13b89b1b950.tar.xz ceph-3f1f3450aee368823dc8ae90a8cef13b89b1b950.zip |
Merge pull request #59739 from sabaini/fix/ceph-volume-ep
[ceph-volume] fix importlib.metadata compat
Reviewed-by: Guillaume Abrioux <gabrioux@ibm.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
-rw-r--r-- | src/ceph-volume/ceph_volume/main.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ceph-volume/ceph_volume/main.py b/src/ceph-volume/ceph_volume/main.py index f8eca65ec49..4f27f429e89 100644 --- a/src/ceph-volume/ceph_volume/main.py +++ b/src/ceph-volume/ceph_volume/main.py @@ -11,8 +11,16 @@ try: from importlib.metadata import entry_points def get_entry_points(group: str): # type: ignore - return entry_points().get(group, []) # type: ignore + eps = entry_points() + if hasattr(eps, 'select'): + # New importlib.metadata uses .select() + return eps.select(group=group) + else: + # Fallback to older EntryPoints that returns dicts + return eps.get(group, []) # type: ignore + except ImportError: + # Fallback to `pkg_resources` for older versions from pkg_resources import iter_entry_points as entry_points # type: ignore def get_entry_points(group: str): # type: ignore |