Skip to content

Commit 10bd535

Browse files
committed
[pfsense_dns_resolver] Fixes
- Allow hosts.ip to take comma separated list of IP addresses (#150) - Validate domainoverrides.ip address
1 parent 35eb500 commit 10bd535

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
bugfixes:
2+
- pfsense_dns_resolver - allow for comma separated list of IP addresses in ``hosts.ip`` (https://github.com/pfsensible/core/discussions/150)
3+
minor_changes:
4+
- pfsense_dns_resolver - validate ``domainoverrides.ip`` field

plugins/modules/pfsense_dns_resolver.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
domainoverrides:
147147
description: Domains for which the resolver's standard DNS lookup should be overridden.
148148
required: false
149+
default: []
149150
type: list
150151
elements: dict
151152
suboptions:
@@ -348,7 +349,7 @@
348349
regovpnclients=dict(default=False, type='bool'),
349350
custom_options=dict(default="", type='str'),
350351
hosts=dict(default=[], type='list', elements='dict', options=DNS_RESOLVER_HOST_SPEC),
351-
domainoverrides=dict(type='list', elements='dict', options=DNS_RESOLVER_DOMAIN_OVERRIDE_SPEC),
352+
domainoverrides=dict(default=[], type='list', elements='dict', options=DNS_RESOLVER_DOMAIN_OVERRIDE_SPEC),
352353
# Advanced Settings
353354
hideidentity=dict(default=True, type='bool'),
354355
hideversion=dict(default=True, type='bool'),
@@ -477,8 +478,13 @@ def _validate_params(self):
477478
self.module.fail_json(msg=f'sslcert, {params["sslcert"]} is not a valid description of cert')
478479

479480
for host in params["hosts"]:
480-
if not self.pfsense.is_ipv4_address(host["ip"]):
481-
self.module.fail_json(msg=f'ip, {host["ip"]} is not a ipv4 address')
481+
for ipaddr in host["ip"].split(","):
482+
if not self.pfsense.is_ipv4_address(ipaddr):
483+
self.module.fail_json(msg=f'ip, {ipaddr} is not a ipv4 address')
484+
485+
for domain in params["domainoverrides"]:
486+
if not self.pfsense.is_ipv4_address(domain["ip"]):
487+
self.module.fail_json(msg=f'ip, {domain["ip"]} is not a ipv4 address')
482488

483489
for if_descr in params["active_interface"] + params["outgoing_interface"]:
484490
if not self.pfsense.is_interface_display_name(if_descr) and if_descr.lower() != "all":

0 commit comments

Comments
 (0)