mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Fix backup issue in network config modules and network action plugins common code refactor (#50301)
* Fix backup issue in network config modules * Fix `get_working_path` not found issue introduced due to backup config code refactor (PR #50208) * Further refactor config related action plugins to minimize duplicate code * Remove unwated imports in config action plugins * Add common network class for action plugin and related code refactor * Fix review comment
This commit is contained in:
@@ -28,7 +28,7 @@ from ansible.module_utils.connection import Connection
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
from ansible.module_utils.network.junos.junos import junos_provider_spec
|
||||
from ansible.plugins.loader import connection_loader, module_loader
|
||||
from ansible.plugins.action.normal import ActionModule as _ActionModule
|
||||
from ansible.plugins.action.network import ActionModule as ActionNetworkModule
|
||||
from ansible.utils.display import Display
|
||||
|
||||
display = Display()
|
||||
@@ -36,11 +36,12 @@ display = Display()
|
||||
CLI_SUPPORTED_MODULES = ['junos_netconf', 'junos_command']
|
||||
|
||||
|
||||
class ActionModule(_ActionModule):
|
||||
class ActionModule(ActionNetworkModule):
|
||||
|
||||
def run(self, tmp=None, task_vars=None):
|
||||
del tmp # tmp no longer has any effect
|
||||
|
||||
self._config_module = True if self._task.action == 'junos_config' else False
|
||||
module = module_loader._load_module_source(self._task.action, module_loader.find_plugin(self._task.action))
|
||||
if not getattr(module, 'USE_PERSISTENT_CONNECTION', False):
|
||||
return super(ActionModule, self).run(task_vars=task_vars)
|
||||
|
||||
Reference in New Issue
Block a user