mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fortinet FortiManager Module_Utils MINOR Update (#52756)
* PR for minor update to FortiManager.py. Now accepts entire module as input, so it can use those data points for decisions later. This update is entirely related to our debugging and should have zero impact on existing modules. * Minor change to documentation to kick off another shippable. Suspected error on last run. * Commented out reference to the import library for fortimanager debug (which is only used by us, internally). It needs to be moved outside of the Ansible namespace so we can call it with try/catch without any other issues. Right now /ansible/executor/module_common.py runs w/ recursive_finder, and throws errors because it can't find debug on other machines within the ansible namespace. We don't have this issue with pyFMG legacy usage. So, we're disabling the code until we have a better way of calling this debug module. It isn't required for production usage.
This commit is contained in:
parent
c0c6eebed6
commit
a65db027e8
1 changed files with 18 additions and 13 deletions
|
@ -39,19 +39,23 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAS_PYFMGR = False
|
HAS_PYFMGR = False
|
||||||
|
|
||||||
# check for debug lib
|
# ACTIVE BUG WITH OUR DEBUG IMPORT CALL -- BECAUSE IT'S UNDER MODULE_UTILITIES
|
||||||
try:
|
# WHEN module_common.recursive_finder() runs under the module loader, it looks for this namespace debug import
|
||||||
from ansible.module_utils.network.fortimanager.fortimanager_debug import debug_dump
|
# and because it's not there, it always fails, regardless of it being under a try/catch here.
|
||||||
HAS_FMGR_DEBUG = True
|
# we're going to move it to a different namespace.
|
||||||
except ImportError:
|
# # check for debug lib
|
||||||
HAS_FMGR_DEBUG = False
|
# try:
|
||||||
|
# from ansible.module_utils.network.fortimanager.fortimanager_debug import debug_dump
|
||||||
|
# HAS_FMGR_DEBUG = True
|
||||||
|
# except:
|
||||||
|
# HAS_FMGR_DEBUG = False
|
||||||
|
|
||||||
|
|
||||||
# BEGIN HANDLER CLASSES
|
# BEGIN HANDLER CLASSES
|
||||||
class FortiManagerHandler(object):
|
class FortiManagerHandler(object):
|
||||||
def __init__(self, conn, check_mode=False):
|
def __init__(self, conn, module):
|
||||||
self._conn = conn
|
self._conn = conn
|
||||||
self._check_mode = check_mode
|
self._module = module
|
||||||
self._tools = FMGRCommon
|
self._tools = FMGRCommon
|
||||||
|
|
||||||
def process_request(self, url, datagram, method):
|
def process_request(self, url, datagram, method):
|
||||||
|
@ -70,11 +74,12 @@ class FortiManagerHandler(object):
|
||||||
"""
|
"""
|
||||||
data = self._tools.format_request(method, url, **datagram)
|
data = self._tools.format_request(method, url, **datagram)
|
||||||
response = self._conn.send_request(method, data)
|
response = self._conn.send_request(method, data)
|
||||||
if HAS_FMGR_DEBUG:
|
|
||||||
try:
|
# if HAS_FMGR_DEBUG:
|
||||||
debug_dump(response, datagram, url, method)
|
# try:
|
||||||
except BaseException:
|
# debug_dump(response, datagram, self._module.paramgram, url, method)
|
||||||
pass
|
# except BaseException:
|
||||||
|
# pass
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue