diff options
author | AngusWarren <angus@warren.bz> | 2020-07-30 04:32:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-29 20:32:16 +0000 |
commit | 84e5bb7da5cbafdd64325d26d57abc9bcf79b2dc (patch) | |
tree | 85daf81861c6fa0d939b489b06e6b93bacc1bfe9 | |
parent | 1795b189f7a3ca83ff3c67e189cfd1c83cc4b433 (diff) | |
download | vyos-ansible-old-84e5bb7da5cbafdd64325d26d57abc9bcf79b2dc.tar.gz vyos-ansible-old-84e5bb7da5cbafdd64325d26d57abc9bcf79b2dc.zip |
Prevent vyos_config from saving in check mode. (#53)
Prevent vyos_config from saving in check mode.
Reviewed-by: https://github.com/apps/ansible-zuul
-rw-r--r-- | changelogs/fragements/prevent-vyos_config-saving-in-check-mode.yaml | 3 | ||||
-rw-r--r-- | plugins/modules/vyos_config.py | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/changelogs/fragements/prevent-vyos_config-saving-in-check-mode.yaml b/changelogs/fragements/prevent-vyos_config-saving-in-check-mode.yaml new file mode 100644 index 0000000..d03856e --- /dev/null +++ b/changelogs/fragements/prevent-vyos_config-saving-in-check-mode.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: + - vyos_config - fixed issue where config could be saved while in check mode (https://github.com/ansible-collections/vyos.vyos/pull/53) diff --git a/plugins/modules/vyos_config.py b/plugins/modules/vyos_config.py index 893cd64..5e4836d 100644 --- a/plugins/modules/vyos_config.py +++ b/plugins/modules/vyos_config.py @@ -349,7 +349,8 @@ def main(): if module.params["save"]: diff = run_commands(module, commands=["configure", "compare saved"])[1] if diff != "[edit]": - run_commands(module, commands=["save"]) + if not module.check_mode: + run_commands(module, commands=["save"]) result["changed"] = True run_commands(module, commands=["exit"]) |