For backward compatibility reasons, support "_" in place for "-" runner,
query module and callback module names.
@@ -72,13 +72,21 @@ def get_runner(name, config=None):
"""
LOG.debug('Runner loading Python module: %s', name)
+ # NOTE: For backward compatibility we also support "_" in place of "-"
+ from stevedore.exception import NoMatches
+
+ try:
+ module = get_plugin_instance(RUNNERS_NAMESPACE, name, invoke_on_load=False)
+ except NoMatches:
+ name = name.replace('-', '_')
+
try:
module = get_plugin_instance(RUNNERS_NAMESPACE, name, invoke_on_load=False)
except Exception as e:
available_runners = get_available_plugins(namespace=RUNNERS_NAMESPACE)
available_runners = ', '.join(available_runners)
- msg = ('Failed to find runner %s. Make sure that the runner is available and installed in '
- 'StackStorm virtual environment. Available runners are: %s' %
+ msg = ('Failed to find runner %s. Make sure that the runner is available and installed '
+ 'in StackStorm virtual environment. Available runners are: %s' %
(name, available_runners))
LOG.exception(msg)
@@ -100,7 +108,15 @@ def get_query_module(name):
"""
Retrieve runner query module for the provided runner.
"""
+ # NOTE: For backward compatibility we also support "_" in place of "-"
+ from stevedore.exception import NoMatches
+
+ try:
module = get_plugin_instance(RUNNERS_QUERY_MODULES_NAMESPACE, name, invoke_on_load=False)
+ except NoMatches:
+ name = name.replace('-', '_')
+ module = get_plugin_instance(RUNNERS_QUERY_MODULES_NAMESPACE, name, invoke_on_load=False)
+
return module
@@ -108,7 +124,15 @@ def get_callback_module(name):
"""
Retrieve runner callback module for the provided runner.
"""
+ # NOTE: For backward compatibility we also support "_" in place of "-"
+ from stevedore.exception import NoMatches
+
+ try:
+ module = get_plugin_instance(RUNNERS_CALLBACK_MODULES_NAMESPACE, name, invoke_on_load=False)
+ except NoMatches:
+ name = name.replace('-', '_')
module = get_plugin_instance(RUNNERS_CALLBACK_MODULES_NAMESPACE, name, invoke_on_load=False)
+
return module
