mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-30 20:20:21 -07:00
Refactor common network shared and platform utils code into package (#33452)
* Refactor common network shared and platform specific code into package (part-1) As per proposal #76 refactor common network shared and platform specific code into sub-package. https://github.com/ansible/proposals/issues/76 * ansible.module_utils.network.common - command shared functions * ansible.module_utils.network.{{ platform }} - where platform is platform specific shared functions * Fix review comments * Fix review comments
This commit is contained in:
parent
18aca48075
commit
11c9ad23d5
483 changed files with 871 additions and 887 deletions
|
@ -25,7 +25,7 @@ from ansible.module_utils._text import to_text
|
|||
from ansible.module_utils.connection import Connection
|
||||
from ansible.errors import AnsibleError
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.module_utils.network_common import load_provider
|
||||
from ansible.module_utils.network.common.utils import load_provider
|
||||
|
||||
from imp import find_module, load_module
|
||||
|
||||
|
@ -44,13 +44,13 @@ class ActionModule(ActionBase):
|
|||
play_context.network_os = self._get_network_os(task_vars)
|
||||
|
||||
# we should be able to stream line this a bit by creating a common
|
||||
# provider argument spec in module_utils/network_common.py or another
|
||||
# provider argument spec in module_utils/network/common/utils.py or another
|
||||
# option is that there isn't a need to push provider into the module
|
||||
# since the connection is started in the action handler.
|
||||
f, p, d = find_module('ansible')
|
||||
f2, p2, d2 = find_module('module_utils', [p])
|
||||
f3, p3, d3 = find_module(play_context.network_os, [p2])
|
||||
module = load_module('ansible.module_utils.' + play_context.network_os, f3, p3, d3)
|
||||
module = load_module('ansible.module_utils.{0}.{1}'.format(play_context.network_os, play_context.network_os), f3, p3, d3)
|
||||
|
||||
if play_context.connection == 'local':
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue