Skip to content

Conversation

mrvantage
Copy link

@mrvantage mrvantage commented Nov 17, 2024

Change Summary

T6837 / #288 Implemented replace functionality using a boolean arg for the module. Also Improved detection of config lines already present on router, and filter them out in calculated diff

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)
  • Other (please describe):
    Adjustment of filter logic, to filter out lines already present on router. This to only push changes to router, and avoid setting config that is in place already.

Related Task(s)

T6837

Related PR(s)

n/a

Proposed changes

  • Add boolean replace argument to the vyos_config ansible module
  • This argument is set to false by default, for backward compatibility
  • When set to true all lines from the running config

How to test

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

mrvantage added 2 commits November 17, 2024 10:34
…g for the module. Also Improved detection of config lines already present on router, and filter them out in calculated diff
@gaige
Copy link
Contributor

gaige commented Nov 17, 2024

@mrvantage Thanks so much for the contribution. Can you add unit tests for this PR, please? Specifically testing each new route through the code and any variations (such as error cases and the quote misalignments).

Unit tests for vyos_config are located in tests/unit/modules/network/vyos/test_vyos_config.py and there are some good examples in there.

  • Add tests
  • Add file to changelogs/fragments representing this change
  • Confirm the versions you've been able to test on for integration tests

@mrvantage
Copy link
Author

Yes, I think this definitely requires some proper unit tests. I already found an issue with my proposed implementation. This doesn't cover the situation where deleting config lines leaves a group without any sub settings. This could lead to invalid configuration, and there's no nice way of cleaning this up in replace mode.

For example, when removing a wireguard peer from the config maintained in ansible, the peer remains without any settings on the router, which is invalid.

I need to come up with a solution for this first. If I manage, I will look at writing some unit tests to cover these kind of situations.

@omnom62 omnom62 self-assigned this Apr 16, 2025
Copy link

github-actions bot commented Jul 22, 2025


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


1 out of 2 committers have signed the CLA.
✅ (omnom62)[https://github.com/omnom62]
@mrvantage
mrvantage seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@omnom62
Copy link
Contributor

omnom62 commented Aug 4, 2025

I have read the CLA Document and I hereby sign the CLA

1 similar comment
@omnom62
Copy link
Contributor

omnom62 commented Aug 4, 2025

I have read the CLA Document and I hereby sign the CLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants