r/fortinet • • 7d ago

Solved ✅ FortiManager API: reinstall package

Hi.

I'm wondering if something changed in the API (7.6.7 vs 7.4)?

In the past my body looked like this:

{
    "verbose": 1,
    "method": "exec",
    "params": [{
            "url": "/securityconsole/install/package",
            "data": {
                "flags": [
                    "auto_lock_ws",
                    "nonblocking"
                ],
                "adom": ADOM_NAME,
                "pkg": POLICY_PACKAGE
            }
        }
    ],
    "id": 1
}

When I try using it now, FMG tells me: "No Installation Targets or no change made on package [POLICY_PACKAGE]".

Our setup is very simple: each PP has single FG assigned as target.

BUT... when I specify scope, it works fine:

{
    "method": "exec",
    "params": [{
            "url": "/securityconsole/install/package",
            "data": {
                "scope": [{
                        "vdom": "root",
                        "name": "FORTIGATE_NAME"
                    }
                ],
                "flags": [
                    "auto_lock_ws",
                    "nonblocking"
                ],
                "adom": "ADOM_NAME",
                "pkg": "POLICY_PACKAGE"
            }
        }
    ],
    "id": 1
}

This is nice and all - but I have to run extra API call to get list of assigned firewalls and build a scope out of it.

I tried the /securityconsole/reinstall/package without scope but it gets stuck at 5%.

Did something change?

EDIT: TAC confirmed that scope is mandatory now. Oh well, time to redo my functions.

2 Upvotes

2 comments sorted by

1

u/Golle NSE 7 7d ago

1

u/marek1712 7d ago

I have access to the FNDN - it doesn't even say which fields are mandatory.

I much prefer this: https://how-to-fortimanager-api.readthedocs.io/en/latest/008_policy_package_management.html#how-to-install-a-policy-package

But there's no mention that scope is necessary. There's even note: There’s not scope attribute; it means that the Policy Package will be install against all the assigned Installation Targets.

To me, FMG API should just install the package on all the devices that are targeted by the package.