Merge pull request #13621 from nmadhok/fix-ddns

Changing return from ddns.absent and making minor fixes in the doc
This commit is contained in:
Joseph Hall 2014-06-21 06:13:41 -06:00
commit 4dd77f8c5e
2 changed files with 12 additions and 6 deletions

View File

@ -8,15 +8,15 @@ Support for RFC 2136 dynamic DNS updates.
support this (the keyname is only needed if the keyring contains more support this (the keyname is only needed if the keyring contains more
than one key):: than one key)::
ddns.keyring: keyring file (default=None) keyring: keyring file (default=None)
ddns.keyname: key name in file (default=None) keyname: key name in file (default=None)
The keyring file needs to be in json format and the key name needs to end The keyring file needs to be in json format and the key name needs to end
with an extra period in the file, similar to this: with an extra period in the file, similar to this:
.. code-block:: bash .. code-block:: bash
{'keyname.': 'keycontent'} {"keyname.": "keycontent"}
''' '''
# Import python libs # Import python libs
import logging import logging

View File

@ -12,6 +12,9 @@ type dynamic updates. Requires dnspython module.
ddns.present: ddns.present:
- zone: example.com - zone: example.com
- ttl: 60 - ttl: 60
- data: 111.222.333.444
- nameserver: 123.234.345.456
- keyfile: /srv/salt/tsig_key.txt
''' '''
@ -39,7 +42,7 @@ def present(name, zone, ttl, data, rdtype='A', **kwargs):
DNS resource type. Default 'A'. DNS resource type. Default 'A'.
``**kwargs`` ``**kwargs``
Additional arguments the ddns.update function may need (e.g. keyfile). Additional arguments the ddns.update function may need (e.g. nameserver, keyfile, keyname).
''' '''
ret = {'name': name, ret = {'name': name,
'changes': {}, 'changes': {},
@ -90,7 +93,7 @@ def absent(name, zone, data=None, rdtype=None, **kwargs):
DNS resource type. If omitted, all types will be purged. DNS resource type. If omitted, all types will be purged.
``**kwargs`` ``**kwargs``
Additional arguments the ddns.update function may need (e.g. keyfile). Additional arguments the ddns.delete function may need (e.g. nameserver, keyfile, keyname).
''' '''
ret = {'name': name, ret = {'name': name,
'changes': {}, 'changes': {},
@ -110,7 +113,10 @@ def absent(name, zone, data=None, rdtype=None, **kwargs):
elif status: elif status:
ret['result'] = True ret['result'] = True
ret['comment'] = 'Deleted DNS record(s)' ret['comment'] = 'Deleted DNS record(s)'
ret['changes'] = True ret['changes'] = {'Deleted': {'name': name,
'zone': zone
}
}
else: else:
ret['result'] = False ret['result'] = False
ret['comment'] = 'Failed to delete DNS record(s)' ret['comment'] = 'Failed to delete DNS record(s)'