Skip to content

T9644: vyos_config: fix match=line diff for double quotes and delete prefixes - #522

Draft
rasty94 wants to merge 4 commits into
vyos:mainfrom
rasty94:T9644/vyos-config-line-diff
Draft

rasty94 wants to merge 4 commits into
vyos:mainfrom
rasty94:T9644/vyos-config-line-diff

Conversation

@rasty94

@rasty94 rasty94 commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Change Summary

Two bugs in the match: line diff of plugins/cliconf/vyos.py get_diff():

  1. Only single quotes were stripped before comparing candidate and running lines. A task line like set interfaces ethernet eth0 description "uplink core" never matched the running description 'uplink core', so the task reported changed on every run.
  2. delete lines were matched with re.match(item + r"\b"). \b also matches before /, . or -, so delete ... address 10.0.0.1 matched the running address '10.0.0.1/24' and the module sent a delete for a node that does not exist, failing the commit.

This strips double quotes too and requires whitespace or end of line after the deleted path. It also removes diff_config() from plugins/modules/vyos_config.py, an unused older copy of the same logic.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Related PR(s)

Component(s) name

vyos_config (cliconf)

Proposed changes

  • plugins/cliconf/vyos.py: strip " as well as '; delete match (\s|$) instead of \b.
  • plugins/modules/vyos_config.py: remove the unused diff_config().
  • Two unit tests in test_vyos_config.py, plus a changelog fragment.

How to test

pytest tests/unit

Test results

600 passed (598 on main + 2 new)

Without the cliconf change both new tests fail.

  • Sanity tests passed
  • Unit tests passed

Tested against VyOS versions:

  • Unit tests only, not yet tested against a live router.

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the ansible sanity and unit tests
  • My commit headlines contain a valid Task id
  • I have added unit tests to cover my changes
  • I have added a file to changelogs/fragments to describe the changes

…prefixes

Strip double quotes as well as single quotes when comparing candidate
and running lines, and match delete paths on whole words instead of \b,
which also matched before '/', '.' and '-'. Drop the unused diff_config()
helper in vyos_config.py, an old copy of the same logic.
Copilot AI balanced review requested due to automatic review settings November 20, 2026 01:10
@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 22, 2026 19:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@omnom62 omnom62 added legacy Exempt from per-commit T-ID check (title T-ID still required); grandfathered PRs and removed invalid-task-id labels Nov 22, 2026
Copilot AI balanced review requested due to automatic review settings November 22, 2026 19:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

Copilot AI balanced review requested due to automatic review settings November 23, 2026 22:48

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

legacy Exempt from per-commit T-ID check (title T-ID still required); grandfathered PRs

Development

Successfully merging this pull request may close these issues.

3 participants