Fix: FortiOS config collection fails with HTTP 405 on current FortiOS#3465
Merged
Conversation
The config-backup monitor endpoint changed HTTP verb across FortiOS releases: per the FNDN API reference it is GET on 6.4 (6.4.16) but POST on 7.0 (7.0.17) and later. The collection task issued GET via fortios_monitor_fact (selector system_config_backup), so on current FortiOS the FortiOS hosts fail this task with HTTP 405 and collect no configuration. Other devices in the lab are unaffected, but the failed hosts make netlab collect exit non-zero. Verified against FortiOS 8.0.0. Switch to fortios_monitor with selector backup.system.config, which posts to the same /api/v2/monitor/system/config/backup URL. The response still exposes the raw configuration at meta.raw, so the ansible_net_config extraction is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3b58ed8 to
c29e0f9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
netlab collectcollects no configuration for FortiOS nodes on currentFortiOS releases; the FortiOS hosts fail their collection task with an
HTTP 405 error:
The collection task (
netsim/ansible/tasks/fetch-config/fortios.yml) usedfortinet.fortios.fortios_monitor_factwith selectorsystem_config_backup,which issues
GET /api/v2/monitor/system/config/backup. The config-backupmonitor endpoint changed HTTP verb across FortiOS releases: per the FNDN API
reference it is GET on FortiOS 6.4 (6.4.16) but POST on FortiOS 7.0
(7.0.17) and later. On a release that expects POST, the GET request is
rejected with 405 Method Not Allowed. The FortiOS hosts then collect no
.cfgfile; other devices in the lab are unaffected and collect normally,but the failed hosts make the run exit with a non-zero status.
Fix
Switch the task to
fortinet.fortios.fortios_monitorwith selectorbackup.system.config. This targets the same/api/v2/monitor/system/config/backupURL but issues the POST request theendpoint now expects. The POST response continues to expose the raw
configuration at
meta.raw, so theansible_net_configextraction isunchanged.
Validation
Verified live against a running FortiGate cluster (FGCP HA, FortiOS
v8.0.0 build 167) plus FRR/Linux nodes:
netlab collecton a FortiOS node returnshttp_status: 405,no config file written, playbook aborts.
netlab collectover the lab completes withfailed=0forevery node; both FGCP HA members and all FRR routers collect cleanly. The
FortiOS backups are well-formed (≈16.9k-line configurations).
The exact FortiOS release in which the verb changed was not bisected; the
GET→POST transition is bracketed by the FNDN API reference (GET on 6.4.16,
POST on 7.0.17), and the 405 failure was reproduced directly on 8.0.0.
References
FortiOS 6.4.16 and POST on FortiOS 7.0.17 (Fortinet Developer Network,
authentication required).
https://docs.fortinet.com/document/fortigate/8.0.0/administration-guide/702257/configuration-backups-and-reset
🤖 Generated with Claude Code