loads action handler for a group of network modules (#21194)
* loads action handler based on module group prefix for network modules
This commit is contained in:
parent
0e4f48d684
commit
21157aa1bc
1 changed files with 5 additions and 0 deletions
|
@ -758,9 +758,14 @@ class TaskExecutor:
|
|||
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
|
||||
if self._task.action in self._shared_loader_obj.action_loader:
|
||||
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:
|
||||
pc_conn = self._shared_loader_obj.connection_loader.get(self._play_context.connection, class_only=True)
|
||||
handler_name = getattr(pc_conn, 'action_handler', 'normal')
|
||||
|
|
Loading…
Reference in a new issue