Skip to content

v4: Fix Fortinet driver swap_negation and idempotent_for bugs #225

@jtdub

Description

@jtdub

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

  1. Preserve full command text in swap_negation() (like VyOS driver does)
  2. Add bounds check before .split()[1] access

These should ideally be addressed alongside #220 (unified negation rules) and #222 (declarative-only drivers) in v4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    v4-enhancementEnhancement planned for hier_config v4.0.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions