Description
Two bugs in the Fortinet FortiOS driver:
1. swap_negation() drops parameters (driver.py:47)
child.text = f"{self.negation_prefix}{child.text.removeprefix(self.declaration_prefix).split()[0]}"
.split()[0] keeps only the first word after the prefix, dropping all parameters:
- Input:
set description "Port 1" → unset description (drops "Port 1")
2. idempotent_for() IndexError (driver.py:61)
config.text.split()[1] == other_child.text.split()[1]
No bounds check — crashes with IndexError on single-word commands (e.g., bare set).
Proposed Fix
- Preserve full command text in
swap_negation() (like VyOS driver does)
- Add bounds check before
.split()[1] access
These should ideally be addressed alongside #220 (unified negation rules) and #222 (declarative-only drivers) in v4.
Description
Two bugs in the Fortinet FortiOS driver:
1.
swap_negation()drops parameters (driver.py:47).split()[0]keeps only the first word after the prefix, dropping all parameters:set description "Port 1"→unset description(drops"Port 1")2.
idempotent_for()IndexError (driver.py:61)No bounds check — crashes with
IndexErroron single-word commands (e.g., bareset).Proposed Fix
swap_negation()(like VyOS driver does).split()[1]accessThese should ideally be addressed alongside #220 (unified negation rules) and #222 (declarative-only drivers) in v4.