Page MenuHomeVyOS Platform

Unnecessary call to get_config() when `match: "none"` is used in `vyos_config` module
Open, NormalPublicBUG

Description

Description

When using the vyos_config module with match: "none", the get_config() function is still called. This is inefficient because the active configuration is ignored when match is set to "none", and get_config() should not be necessary.

Relevant parts of the code are:

Steps to Reproduce

Use the vyos_config module with the following parameters:

- name: Configure VyOS device
  vyos.vyos.vyos_config:
    match: "none"
    lines:
      - set system host-name example

Expected Behavior

The get_config() function should not be called when match is set to "none".

Actual Behavior

The get_config() function is still called, which is unnecessary and inefficient.

Suggested Fix

Modify the code in vyos_config.py to check the match parameter before calling get_config().

Details

Version
41e4b0734ca961d18c0a016a50b3c6e598a10dff
Is it a breaking change?
Perfectly compatible
Issue type
Performance optimization
Story points
1