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:
- https://github.com/vyos/vyos.vyos/blob/41e4b0734ca961d18c0a016a50b3c6e598a10dff/plugins/modules/vyos_config.py#L289
- https://github.com/vyos/vyos.vyos/blob/41e4b0734ca961d18c0a016a50b3c6e598a10dff/plugins/modules/vyos_config.py#L299
- https://github.com/vyos/vyos.vyos/blob/41e4b0734ca961d18c0a016a50b3c6e598a10dff/plugins/cliconf/vyos.py#L253-L255
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().