loads action handler for a group of network modules (#21194)
* loads action handler based on module group prefix for network modulespull/4420/head
parent
0e4f48d684
commit
21157aa1bc
|
@ -758,9 +758,14 @@ class TaskExecutor:
|
||||||
Returns the correct action plugin to handle the requestion task action
|
Returns the correct action plugin to handle the requestion task action
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
network_group_modules = frozenset(['eos', 'nxos', 'ios', 'iosxr', 'junos', 'vyos'])
|
||||||
|
module_prefix = self._task.action.split('_')[0]
|
||||||
|
|
||||||
# let action plugin override module, fallback to 'normal' action plugin otherwise
|
# let action plugin override module, fallback to 'normal' action plugin otherwise
|
||||||
if self._task.action in self._shared_loader_obj.action_loader:
|
if self._task.action in self._shared_loader_obj.action_loader:
|
||||||
handler_name = self._task.action
|
handler_name = self._task.action
|
||||||
|
elif all((module_prefix in network_group_modules, module_prefix in self._shared_loader_obj.action_loader)):
|
||||||
|
handler_name = module_prefix
|
||||||
else:
|
else:
|
||||||
pc_conn = self._shared_loader_obj.connection_loader.get(self._play_context.connection, class_only=True)
|
pc_conn = self._shared_loader_obj.connection_loader.get(self._play_context.connection, class_only=True)
|
||||||
handler_name = getattr(pc_conn, 'action_handler', 'normal')
|
handler_name = getattr(pc_conn, 'action_handler', 'normal')
|
||||||
|
|
Loading…
Reference in New Issue