summaryrefslogtreecommitdiff
path: root/plugins/modules/vyos_banner.py
diff options
context:
space:
mode:
authorKate Case <kcase@redhat.com>2023-01-25 08:37:58 -0500
committerGitHub <noreply@github.com>2023-01-25 08:37:58 -0500
commite9911888f6dcdf9031f3fdb2e32c52e45815fdbe (patch)
treedc22abb4a329ef04e98685b81d074679dc24c456 /plugins/modules/vyos_banner.py
parentbcfe61a3b6ff69f08450f3dbd8f0f1827fb18ab3 (diff)
downloadvyos.vyos-e9911888f6dcdf9031f3fdb2e32c52e45815fdbe.tar.gz
vyos.vyos-e9911888f6dcdf9031f3fdb2e32c52e45815fdbe.zip
Add prettier and isort to pre-commit. (#270)
* Add prettier and isort to pre-commit. * Bump line-length to 100 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Diffstat (limited to 'plugins/modules/vyos_banner.py')
-rw-r--r--plugins/modules/vyos_banner.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/plugins/modules/vyos_banner.py b/plugins/modules/vyos_banner.py
index a5f3fb94..0ee10f5f 100644
--- a/plugins/modules/vyos_banner.py
+++ b/plugins/modules/vyos_banner.py
@@ -91,6 +91,7 @@ commands:
import re
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import (
get_config,
load_config,
@@ -104,21 +105,13 @@ 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)