Skip to content

Commit 6e3b0b9

Browse files
committed
ceph-volume: fix regression
This fixes a regression introduced by: 24f8e5c `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 <[email protected]>
1 parent df637ab commit 6e3b0b9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/ceph-volume/ceph_volume/main.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@
44
import sys
55
import logging
66

7+
8+
# `iter_entry_points` from `pkg_resources` takes one argument whereas
9+
# `entry_points` from `importlib.metadata` does not.
710
try:
811
from importlib.metadata import entry_points
12+
13+
def get_entry_points(group: str): # type: ignore
14+
return entry_points().get(group, []) # type: ignore
915
except ImportError:
10-
from pkg_resources import iter_entry_points as entry_points
16+
from pkg_resources import iter_entry_points as entry_points # type: ignore
1117

18+
def get_entry_points(group: str): # type: ignore
19+
return entry_points(group=group) # type: ignore
1220

1321
from ceph_volume.decorators import catches
1422
from ceph_volume import log, devices, configuration, conf, exceptions, terminal, inventory, drive_group, activate
@@ -177,7 +185,7 @@ def _load_library_extensions():
177185
group = 'ceph_volume_handlers'
178186

179187
plugins = []
180-
for ep in entry_points(group=group):
188+
for ep in get_entry_points(group=group):
181189
try:
182190
logger.debug('loading %s' % ep.name)
183191
plugin = ep.load()

0 commit comments

Comments
 (0)