Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fortinet FortiManager Module_Utils MINOR Update #52756

Merged
merged 3 commits into from
Mar 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
31 changes: 18 additions & 13 deletions lib/ansible/module_utils/network/fortimanager/fortimanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,23 @@
except ImportError:
HAS_PYFMGR = False

# check for debug lib
try:
from ansible.module_utils.network.fortimanager.fortimanager_debug import debug_dump
HAS_FMGR_DEBUG = True
except ImportError:
HAS_FMGR_DEBUG = False
# ACTIVE BUG WITH OUR DEBUG IMPORT CALL -- BECAUSE IT'S UNDER MODULE_UTILITIES
# WHEN module_common.recursive_finder() runs under the module loader, it looks for this namespace debug import
# and because it's not there, it always fails, regardless of it being under a try/catch here.
# we're going to move it to a different namespace.
# # check for debug lib
# try:
# from ansible.module_utils.network.fortimanager.fortimanager_debug import debug_dump
# HAS_FMGR_DEBUG = True
# except:
# HAS_FMGR_DEBUG = False


# BEGIN HANDLER CLASSES
class FortiManagerHandler(object):
def __init__(self, conn, check_mode=False):
def __init__(self, conn, module):
self._conn = conn
self._check_mode = check_mode
self._module = module
self._tools = FMGRCommon

def process_request(self, url, datagram, method):
Expand All @@ -70,11 +74,12 @@ def process_request(self, url, datagram, method):
"""
data = self._tools.format_request(method, url, **datagram)
response = self._conn.send_request(method, data)
if HAS_FMGR_DEBUG:
try:
debug_dump(response, datagram, url, method)
except BaseException:
pass

# if HAS_FMGR_DEBUG:
# try:
# debug_dump(response, datagram, self._module.paramgram, url, method)
# except BaseException:
# pass

return response

Expand Down