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

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

fmgr_sys_hitcount does not return task id to be able to fetch the result of the hitcount command #56

Closed xav-git closed 1 year ago

xav-git commented 1 year ago

With following ansible code:

tasks:

Error Message: "The task includes an option with an undefined variable. The error was: 'list object' has no attribute 'task' When displaying r we have the same problem.

Expected Behavior: The hitcount command should provide a task id as result to be able to retrieve the result of the hitcount command.

jpforcioli commented 1 year ago

I can reproduce the issue. taskid is returned by FortiManager, but not in the usual data dict:

{
  "id": 6,
  "result": [
    {
      "status": {
        "code": 0,
        "message": "OK"
      },
      "taskid": 363,
      "url": "sys/hitcount"
    }
  ]
}

fmgr_sys_hitcount but also fmgr_generic failed at catching it.

jpforcioli commented 1 year ago

Internal Reference

dux-fortinet commented 1 year ago

Thanks for pointing it out. This problem is fixed in FortiManager Ansible Collection 2.2.0.

You can use r.meta.response_data.task to get the task id now.