summaryrefslogtreecommitdiff
path: root/plugins/module_utils/network
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/module_utils/network')
-rw-r--r--plugins/module_utils/network/vyos/vyos.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/module_utils/network/vyos/vyos.py b/plugins/module_utils/network/vyos/vyos.py
index f37294e6..5c157818 100644
--- a/plugins/module_utils/network/vyos/vyos.py
+++ b/plugins/module_utils/network/vyos/vyos.py
@@ -68,8 +68,12 @@ def get_capabilities(module):
def get_config(module, flags=None, format=None):
flags = [] if flags is None else flags
global _DEVICE_CONFIGS
-
- if _DEVICE_CONFIGS != {} or module.params["match"] == "none":
+ # If _DEVICE_CONFIGS is non-empty and module.params["match"] is "none",
+ # return the cached device configurations. This avoids redundant calls
+ # to the connection when no specific match criteria are provided.
+ if _DEVICE_CONFIGS != {} and (
+ module.params["match"] is not None and module.params["match"] == "none"
+ ):
return to_text(_DEVICE_CONFIGS)
else:
connection = get_connection(module)