Update to work with latest stevedore

stevedore no longer raises a KeyError when there's an entrypoint
missing. Instead we must supply a callback that handles that error.
Update inspection code to work with this.

Also bumps stevedore minimum to 1.16 ahead of the global-requirements
bot.

Closes-Bug: #1603542
Change-Id: I12af23f2525ac90e577bdd10bbfbbd9788e9551c
Depends-On: I8aa1ee52ff7de50488acb86e8920da89ddb05771
This commit is contained in:
Jim Rollenhagen 2016-07-15 18:52:22 +00:00
parent 72fc068c33
commit 62743fec6a
2 changed files with 8 additions and 7 deletions

View File

@ -42,13 +42,14 @@ _COLLECTOR_NS = 'ironic_python_agent.inspector.collectors'
_NO_LOGGING_FIELDS = ('logs',)
def _extension_manager_err_callback(names):
raise errors.InspectionError('Failed to load collector %s' % names)
def extension_manager(names):
try:
return stevedore.NamedExtensionManager(_COLLECTOR_NS,
names=names,
name_order=True)
except KeyError as exc:
raise errors.InspectionError('Failed to load collector %s' % exc)
return stevedore.NamedExtensionManager(
_COLLECTOR_NS, names=names, name_order=True,
on_missing_entrypoints_callback=_extension_manager_err_callback)
def inspect():

View File

@ -19,6 +19,6 @@ pyudev # LGPLv2.1+
requests>=2.10.0 # Apache-2.0
rtslib-fb>=2.1.41 # Apache-2.0
six>=1.9.0 # MIT
stevedore>=1.10.0 # Apache-2.0
stevedore>=1.16.0 # Apache-2.0
WSME>=0.8 # MIT
ironic-lib>=2.0.0 # Apache-2.0