summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/module_utils/network/vyos/vyos.py5
-rw-r--r--plugins/modules/vyos_config.py3
2 files changed, 5 insertions, 3 deletions
diff --git a/plugins/module_utils/network/vyos/vyos.py b/plugins/module_utils/network/vyos/vyos.py
index 1430b1b1..f37294e6 100644
--- a/plugins/module_utils/network/vyos/vyos.py
+++ b/plugins/module_utils/network/vyos/vyos.py
@@ -34,6 +34,7 @@ import json
from ansible.module_utils._text import to_text
from ansible.module_utils.connection import Connection, ConnectionError
+
_DEVICE_CONFIGS = {}
@@ -68,8 +69,8 @@ def get_config(module, flags=None, format=None):
flags = [] if flags is None else flags
global _DEVICE_CONFIGS
- if _DEVICE_CONFIGS != {}:
- return _DEVICE_CONFIGS
+ if _DEVICE_CONFIGS != {} or module.params["match"] == "none":
+ return to_text(_DEVICE_CONFIGS)
else:
connection = get_connection(module)
try:
diff --git a/plugins/modules/vyos_config.py b/plugins/modules/vyos_config.py
index 60be02c8..c6bc9959 100644
--- a/plugins/modules/vyos_config.py
+++ b/plugins/modules/vyos_config.py
@@ -286,6 +286,7 @@ def sanitize_config(config, result):
def run(module, result):
# get the current active config from the node or passed in via
# the config param
+
config = module.params["config"] or get_config(module)
# create the candidate config object from the arguments
@@ -360,7 +361,7 @@ def main():
diff = run_commands(module, commands=["configure", "compare saved"])[1]
if diff not in {
"[edit]",
- "No changes between working and saved configurations.\n\n[edit]"
+ "No changes between working and saved configurations.\n\n[edit]",
}:
if not module.check_mode:
run_commands(module, commands=["save"])