Log 'something' when we fail to instantiate a client

This commit is contained in:
meejah 2022-05-18 12:12:09 -06:00
parent be2c6b09f3
commit 928e61bf22
2 changed files with 8 additions and 4 deletions

View File

@ -0,0 +1 @@
Print a useful message when a storage-client cannot be matched to configuration

View File

@ -667,6 +667,9 @@ def _storage_from_foolscap_plugin(node_config, config, announcement, get_rref):
:param allmydata.node._Config node_config: The node configuration to :param allmydata.node._Config node_config: The node configuration to
pass to the plugin. pass to the plugin.
:param dict announcement: The storage announcement for the storage
server we should build
""" """
plugins = { plugins = {
plugin.name: plugin plugin.name: plugin
@ -687,7 +690,8 @@ def _storage_from_foolscap_plugin(node_config, config, announcement, get_rref):
option, option,
get_rref, get_rref,
) )
raise AnnouncementNotMatched() plugin_names = ", ".join(sorted(list(config.storage_plugins.keys())))
raise AnnouncementNotMatched(plugin_names)
@implementer(IServer) @implementer(IServer)
@ -761,9 +765,8 @@ class NativeStorageServer(service.MultiService):
# able to get the most up-to-date value. # able to get the most up-to-date value.
self.get_rref, self.get_rref,
) )
except AnnouncementNotMatched: except AnnouncementNotMatched as e:
# Nope. print('No plugin for storage-server "{nickname}" from plugins: {plugins}'.format(nickname=ann.get("nickname", "<unknown>"), plugins=e.args[0]))
pass
else: else:
return _FoolscapStorage.from_announcement( return _FoolscapStorage.from_announcement(
self._server_id, self._server_id,