diff options
author | Bradley A. Thornton <bthornto@thethorntons.net> | 2019-08-09 12:05:55 -0700 |
---|---|---|
committer | Bradley A. Thornton <bthornto@thethorntons.net> | 2019-08-09 12:05:55 -0700 |
commit | 29c342fa51c7a9866366cfc20968be7270e02fc5 (patch) | |
tree | 196722c57cca4211e79781edefe1a101d9c4b0c5 /plugins/modules/vyos_banner.py | |
parent | 5fb9df4e907a6ab2da7a6c2dafdec9c1971e8d44 (diff) | |
download | vyos-ansible-old-29c342fa51c7a9866366cfc20968be7270e02fc5.tar.gz vyos-ansible-old-29c342fa51c7a9866366cfc20968be7270e02fc5.zip |
79
Diffstat (limited to 'plugins/modules/vyos_banner.py')
-rw-r--r-- | plugins/modules/vyos_banner.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/plugins/modules/vyos_banner.py b/plugins/modules/vyos_banner.py index 6738624..447c174 100644 --- a/plugins/modules/vyos_banner.py +++ b/plugins/modules/vyos_banner.py @@ -105,15 +105,21 @@ def spec_to_commands(updates, module): if state == "absent": if have.get("state") != "absent" or ( - have.get("state") != "absent" and "text" in have.keys() and have["text"] + have.get("state") != "absent" + and "text" in have.keys() + and have["text"] ): - commands.append("delete system login banner %s" % module.params["banner"]) + commands.append( + "delete system login banner %s" % module.params["banner"] + ) elif state == "present": - if want["text"] and want["text"].encode().decode("unicode_escape") != have.get( - "text" - ): - banner_cmd = "set system login banner %s " % module.params["banner"] + if want["text"] and want["text"].encode().decode( + "unicode_escape" + ) != have.get("text"): + banner_cmd = ( + "set system login banner %s " % module.params["banner"] + ) banner_cmd += want["text"].strip() commands.append(banner_cmd) @@ -162,7 +168,9 @@ def main(): required_if = [("state", "present", ("text",))] module = AnsibleModule( - argument_spec=argument_spec, required_if=required_if, supports_check_mode=True + argument_spec=argument_spec, + required_if=required_if, + supports_check_mode=True, ) warnings = list() |