summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/dns.py
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2012-02-10 12:54:49 +0100
committerMartin Kosek <mkosek@redhat.com>2012-02-24 09:40:40 +0100
commit2cf58937615c28527d1c78f883dad8726331c6df (patch)
treef1d696b248406bb2daa50c4e4c0e9a275bebf035 /ipalib/plugins/dns.py
parent1816643a43802ca2a353930cb2bbb2781b39c80f (diff)
downloadfreeipa.git-2cf58937615c28527d1c78f883dad8726331c6df.tar.gz
freeipa.git-2cf58937615c28527d1c78f883dad8726331c6df.tar.xz
freeipa.git-2cf58937615c28527d1c78f883dad8726331c6df.zip
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
Diffstat (limited to 'ipalib/plugins/dns.py')
-rw-r--r--ipalib/plugins/dns.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index fe32efcc..495a21b1 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -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)