diff options
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() |