Skip to content

Commit

Permalink
update ipv6 enclosure-checks (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
ansibleguy committed Jul 29, 2024
1 parent e0c8a2e commit 21c6249
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions plugins/module_utils/helper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ def ensure_list(data: (int, str, list, None)) -> list:
return [data]


def is_ip(host: str, ignore_empty: bool = False) -> bool:
def is_ip(host: str, ignore_empty: bool = False, strip_enclosure: bool = True) -> bool:
if ignore_empty and is_unset(host):
return True

if host.find('[') != -1:
if strip_enclosure and host.startswith('['):
host = host[1:-1]

try:
Expand All @@ -61,7 +61,7 @@ def is_ip6(host: str, ignore_empty: bool = False, strip_enclosure: bool = True)
if ignore_empty and is_unset(host):
return True

if strip_enclosure and host.find('[') != -1:
if strip_enclosure and host.startswith('['):
host = host[1:-1]

try:
Expand Down

0 comments on commit 21c6249

Please sign in to comment.