Global DNS options

Implement API for DNS global options supported in bind-dyndb-ldap.
Currently, global DNS option overrides any relevant option in
named.conf. Thus they are not filled by default they are left as
a possibility for a user.

Bool encoding had to be fixed so that Bool LDAP attribute can also
be deleted and not just set to True or False.

https://fedorahosted.org/freeipa/ticket/2216
This commit is contained in:
Martin Kosek
2012-02-10 12:54:49 +01:00
parent 1816643a43
commit 2cf5893761
7 changed files with 94 additions and 3 deletions

View File

@@ -148,6 +148,12 @@ EXAMPLES:
if one is not included):
ipa dns-resolve www.example.com
ipa dns-resolve www
Show global DNS configuration:
ipa dnsconfig-show
Modify global DNS configuration and set a list of global forwarders:
ipa dnsconfig-mod --forwarder=10.0.0.1
""")
# supported resource record types
@@ -2100,3 +2106,47 @@ class dns_is_enabled(Command):
return dict(result=dns_enabled, value=u'')
api.register(dns_is_enabled)
class dnsconfig(LDAPObject):
"""
DNS global configuration object
"""
object_name = _('DNS configuration options')
default_attributes = [ 'idnsforwarders', ]
label = _('DNS Global Configuration')
label_singular = _('DNS Global Configuration')
takes_params = (
Str('idnsforwarders*',
_validate_ipaddr,
cli_name='forwarder',
label=_('Global forwarders'),
doc=_('A list of global forwarders'),
csv=True,
),
)
def get_dn(self, *keys, **kwargs):
return api.env.container_dns
def get_dnsconfig(self, ldap):
(dn, entry) = ldap.get_entry(self.get_dn(), None,
normalize=self.normalize_dn)
return entry
api.register(dnsconfig)
class dnsconfig_mod(LDAPUpdate):
__doc__ = _('Modify global DNS configuration.')
api.register(dnsconfig_mod)
class dnsconfig_show(LDAPRetrieve):
__doc__ = _('Show the current global DNS configuration.')
api.register(dnsconfig_show)