fortinet-ansible-dev / ansible-galaxy-fortimanager-collection

GNU General Public License v3.0
16 stars 15 forks source link

Worskpace-mode issues with 2.2.1 #69

Closed mooky31 closed 11 months ago

mooky31 commented 1 year ago

Hello,

I used to use the fortimanger collection to configure a fortianalyzer. It worked like a charm until 2.2.1, where I get errors : ansible.module_utils.connection.ConnectionError: 'workspace-mode'

This is weird, especially thinking that there is no workspace mode on the FAZ.

Problem is this commit : https://github.com/fortinet-ansible-dev/ansible-galaxy-fortimanager-collection/commit/1913d2b0de2e4829077d96f91ea062e584d40394#diff-4d37fe29558cfe819a0ba133dc9f25ba16d61512a089e3676a271dd35cc5d279L477

I think replacing

try:
            if resp_obj["data"]["workspace-mode"] in ["workflow", "normal"]:  # per-adom
                self._uses_workspace = True
            else:
                self._uses_workspace = False
        except KeyError:
            raise FMGBaseException(
                msg="Couldn't determine workspace-mode in the plugin"
            )

By

        if resp_obj["data"]["workspace-mode"] in ["workflow", "normal", "per-adom"]:
            self._uses_workspace = True

Broke the FAZ compatibility. Even if it isn't officially supported, it was very convenient to be able to use fortimanager collection on the FAZ.

Could you please fix it ?

Best regards

dux-fortinet commented 1 year ago

Hi mooky31,

We will fix it in FortiManager Ansible Collection 2.3.0 and make the code more robust. Currently, you can downgrade your fortinet.fortimanager to the previous version, or use our fortinet.fortianalyzer Thanks for raising this issue.

Best, Xinwei

mooky31 commented 1 year ago

Hello,

Thank you for your reply. I already downgraded. I was unaware of the creation of the FAZ collection, I'll look into it.

Best regards

dux-fortinet commented 11 months ago

Hi mooky31,

FortiManager Ansible Collection 2.3.0 has been released now, and the BUG you mentioned has been fixed. While you can use module fmgr_generic to communicate with FAZ, I highly recommend you use FortiAnalyzer Ansible Collection which has similar APIs.

Best regards, Xinwei