]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
ceph-volume: fix regression 58004/head
authorGuillaume Abrioux <gabrioux@ibm.com>
Mon, 3 Jun 2024 12:00:10 +0000 (14:00 +0200)
committerZac Dover <zac.dover@proton.me>
Sat, 15 Jun 2024 12:40:20 +0000 (22:40 +1000)
This fixes a regression introduced by: 24f8e5c61b19deab7397b0237f8376c6c03a5dcb

`iter_entry_points` from `pkg_resources` takes one argument whereas
`entry_points` from `importlib.metadata` does not.

The call to `entry_points(group=group)` makes ceph-volume fail.

Fixes: https://tracker.ceph.com/issues/66328
Signed-off-by: Guillaume Abrioux <gabrioux@ibm.com>
(cherry picked from commit 6e3b0b93055538cad234018ef8700bfacec03076)

src/ceph-volume/ceph_volume/main.py

index afdb786fabeaf80a6549743125cbb2bf423a17b0..f8eca65ec497c820267adb2112e55f7ca32888e1 100644 (file)
@@ -4,11 +4,19 @@ import os
 import sys
 import logging
 
+
+# `iter_entry_points` from `pkg_resources` takes one argument whereas
+# `entry_points` from `importlib.metadata` does not.
 try:
     from importlib.metadata import entry_points
+
+    def get_entry_points(group: str):  # type: ignore
+        return entry_points().get(group, [])  # type: ignore
 except ImportError:
-    from pkg_resources import iter_entry_points as entry_points
+    from pkg_resources import iter_entry_points as entry_points  # type: ignore
 
+    def get_entry_points(group: str):  # type: ignore
+        return entry_points(group=group)  # type: ignore
 
 from ceph_volume.decorators import catches
 from ceph_volume import log, devices, configuration, conf, exceptions, terminal, inventory, drive_group, activate
@@ -177,7 +185,7 @@ def _load_library_extensions():
     group = 'ceph_volume_handlers'
 
     plugins = []
-    for ep in entry_points(group=group):
+    for ep in get_entry_points(group=group):
         try:
             logger.debug('loading %s' % ep.name)
             plugin = ep.load()