mirror of
https://github.com/freeipa/ansible-freeipa.git
synced 2026-05-07 22:03:18 +00:00
dnsconfig: Fix management of forwarders.
If one tries to set a list of forwarders which include an already existing forwarder, the existing forwarder is removed, and the list of configured forwarders contain only the new ones. This patch fixes this behavior by setting a union of the currently available forwarders and the list of forwarders provided in the playbook. Tests were added to ensure this behavior.
This commit is contained in:
@@ -144,8 +144,8 @@ def gen_args(module, state, dnsconfig, forwarders, forward_policy,
|
||||
_args['idnsforwarders'] = ['']
|
||||
|
||||
elif state == 'present':
|
||||
_args['idnsforwarders'] = [
|
||||
fwd for fwd in _forwarders if fwd not in global_forwarders]
|
||||
_args['idnsforwarders'] = \
|
||||
list(set(list(_forwarders) + list(global_forwarders)))
|
||||
# If no forwarders should be added, remove argument.
|
||||
if not _args['idnsforwarders']:
|
||||
del _args['idnsforwarders']
|
||||
|
||||
Reference in New Issue
Block a user