summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/dns.py
diff options
context:
space:
mode:
authorSimo Sorce <ssorce@redhat.com>2011-01-17 12:28:24 -0500
committerSimo Sorce <ssorce@redhat.com>2011-01-19 20:23:42 -0500
commit835436df1549578932705f5722bc78ec985c2f69 (patch)
tree52748b134f557487a3548981b5417ee22d9409f7 /ipalib/plugins/dns.py
parenta44607ecba1edb696172bb7171afbbe5dc1c6efa (diff)
downloadfreeipa-835436df1549578932705f5722bc78ec985c2f69.tar.gz
freeipa-835436df1549578932705f5722bc78ec985c2f69.tar.xz
freeipa-835436df1549578932705f5722bc78ec985c2f69.zip
Provide API to check if IPA DNS is enabled on some server
Fixes: https://fedorahosted.org/freeipa/ticket/600
Diffstat (limited to 'ipalib/plugins/dns.py')
-rw-r--r--ipalib/plugins/dns.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index a2d0b8be1..e1d9ce668 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -616,3 +616,28 @@ class dns_resolve(Command):
return dict(result=True, value=query)
api.register(dns_resolve)
+
+class dns_is_enabled(Command):
+ """
+ Checks if any of the servers has the DNS service enabled.
+ """
+ INTERNAL = True
+ has_output = output.standard_value
+
+ base_dn = 'cn=master,cn=ipa,cn=etc,%s' % api.env.basedn
+ filter = '(&(objectClass=ipaConfigObject)(cn=DNS))'
+
+ def execute(self, *args, **options):
+ ldap = self.api.Backend.ldap2
+ dns_enabled = False
+
+ try:
+ ent = ldap.find_entries(filter=filter, base_dn=base_dn)
+ if len(e):
+ dns_enabled = True
+ except Exception, e:
+ pass
+
+ return dict(result=dns_enabled, value=u'')
+
+api.register(dns_is_enabled)