preview_install
Preview the FortiOS CLI changes an install would push to selected devices before committing, with per-device output and FortiManager failure reasons.
Instructions
Preview what installing a policy package (or device settings) would push.
On FortiManager 7.6.7+ and 8.0.2+ this runs the full Install Preview and returns its result in one call: it stages the install (nothing reaches the device), renders the CLI it would push, then releases the staged copy. Staging is also where an uninstallable package fails -- e.g. a normalized interface with no mapping for a device -- so a failed preview returns the FortiManager task lines explaining why.
Changed in 1.13.0: the call now blocks until the preview is finished
(up to timeout, default 300 s) and returns the per-device CLI
directly; it used to return a task id at once, to be followed by
wait_for_task and get_preview_result. On older builds (7.0-7.6.6,
8.0.0-8.0.1) it still works that way, with a warning: those builds
cannot tie the preview to the named package without risking another
administrator's install wizard (see utils/install_preview.py).
A successful package preview also authorizes one install_package of the same ADOM/package/devices (FMG_INSTALL_SAFETY gate); with package=None it authorizes one install_device_settings of the same ADOM/devices instead. A preview that finds nothing to install does not: there is nothing to push. Starting a preview drops any earlier preview of the same target, so only the latest attempt can authorize.
Args: adom: ADOM name package: Policy package name, or None to preview pending device settings (what install_device_settings would push) devices: Target devices [{"name": "FGT1", "vdom": "root"}, ...] timeout: Wall-clock budget in seconds for the whole preview (default 300, min 30, max 900)
Returns:
dict: status; staged (whether the full preview ran); task_id (the
render task); staging_task_id; devices: [{"name", "has_changes",
"preview"}] where preview is the FortiOS CLI the install would send
(credentials redacted); message. task_lines when FortiManager
found nothing to install. warning when the staged copy could not
be released (the devices may stay held; it says how to release
them) or on an older build. On a failed step: status "error",
error "preview_failed", step, task_lines with FortiManager's reason,
and release_warning if the release failed too.
Example: >>> result = await preview_install( ... adom="root", ... package="default", ... devices=[{"name": "FGT-HQ", "vdom": "root"}], ... ) >>> for dev in result["devices"]: ... print(dev["name"], dev["preview"])
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"adom": "<adom>",
"package": "<package>",
"devices": "<devices>"
},
"name": "preview_install"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| adom | Yes | ||
| devices | Yes | ||
| package | Yes | ||
| timeout | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||