1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix module_utils path for network (#33531)

This commit is contained in:
Nathaniel Case 2017-12-04 10:01:08 -05:00 committed by GitHub
parent ce1ec4a2c9
commit 33cbae0873
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,16 +43,16 @@ class ActionModule(ActionBase):
play_context = copy.deepcopy(self._play_context)
play_context.network_os = self._get_network_os(task_vars)
if play_context.connection == 'local':
# we should be able to stream line this a bit by creating a common
# 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.
module_name = 'ansible.module_utils.network.{0}.{0}'.format(play_context.network_os)
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.{0}.{1}'.format(play_context.network_os, play_context.network_os), f3, p3, d3)
if play_context.connection == 'local':
for package in module_name.split('.')[1:]:
f, p, d = find_module(package, [p])
module = load_module(module_name, f, p, d)
self.provider = load_provider(module.get_provider_argspec(), self._task.args)
if play_context.network_os == 'junos':