Re: [Freeipa-devel] [PATCH] 0059 Add command to test if DNS is active

2011-01-19 Thread Adam Young

On 01/17/2011 01:11 PM, Simo Sorce wrote:

This patch implements the feature requested in ticket #600

The internal dns_is_enabled command returns whether the DNS service is
enable on at least one of the server in the domain.

The UI can use this command to determine whether to show the DNS
related configuration options.

Simo.



___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel
ACK, but be sure to rerun the makeapi command, as I think we have added 
a few new ones since this version was generated.
___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Re: [Freeipa-devel] [PATCH] 0059 Add command to test if DNS is active

2011-01-19 Thread Simo Sorce
On Wed, 19 Jan 2011 20:17:56 -0500
Adam Young ayo...@redhat.com wrote:

 On 01/17/2011 01:11 PM, Simo Sorce wrote:
  This patch implements the feature requested in ticket #600
 
  The internal dns_is_enabled command returns whether the DNS service
  is enable on at least one of the server in the domain.
 
  The UI can use this command to determine whether to show the DNS
  related configuration options.

 ACK, but be sure to rerun the makeapi command, as I think we have
 added a few new ones since this version was generated.

I kept rebasing it on top of master in my tree, I saw no issues.

Pushed to master.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


[Freeipa-devel] [PATCH] 0059 Add command to test if DNS is active

2011-01-17 Thread Simo Sorce

This patch implements the feature requested in ticket #600

The internal dns_is_enabled command returns whether the DNS service is
enable on at least one of the server in the domain.

The UI can use this command to determine whether to show the DNS
related configuration options.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York
From a466f0bfdd7ecbd2220c8445df2116dd8a0b9292 Mon Sep 17 00:00:00 2001
From: Simo Sorce sso...@redhat.com
Date: Mon, 17 Jan 2011 12:28:24 -0500
Subject: [PATCH] Provide API to check if IPA DNS is enabled on some server

Fixes: https://fedorahosted.org/freeipa/ticket/600
---
 API.txt   |5 +
 ipalib/plugins/dns.py |   25 +
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/API.txt b/API.txt
index c53ecbd0d867dd529566a8335ae086ac58b4425f..844e9534c620858aeb4cc23e22b60fab48790dc0 100644
--- a/API.txt
+++ b/API.txt
@@ -467,6 +467,11 @@ option: Str('version?', exclude='webui', flags=['no_option', 'no_output'])
 output: Output('summary', (type 'unicode', type 'NoneType'), 'User-friendly description of action performed')
 output: Entry('result', type 'dict', Gettext('A dictionary representing an LDAP entry', domain='ipa', localedir=None))
 output: Output('value', type 'unicode', The primary_key value of the entry, e.g. 'jdoe' for a user)
+command: dns_is_enabled
+args: 0,0,3
+output: Output('summary', (type 'unicode', type 'NoneType'), 'User-friendly description of action performed')
+output: Output('result', type 'bool', 'True means the operation was successful')
+output: Output('value', type 'unicode', The primary_key value of the entry, e.g. 'jdoe' for a user)
 command: dns_resolve
 args: 1,0,3
 arg: Str('hostname', label=Gettext('Hostname', domain='ipa', localedir=None))
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index cf58098036f7056d20337b4d3b5f02b158b41360..e7dca5365a99ef34802d28a33c9ab0a4e811fe57 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -621,3 +621,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)
-- 
1.7.3.4

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Re: [Freeipa-devel] [PATCH] 0059 Add command to test if DNS is active

2011-01-17 Thread Adam Young

On 01/17/2011 01:11 PM, Simo Sorce wrote:

This patch implements the feature requested in ticket #600

The internal dns_is_enabled command returns whether the DNS service is
enable on at least one of the server in the domain.

The UI can use this command to determine whether to show the DNS
related configuration options.

Simo.



___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel
Will this show up in the metadata call?  If not, it can't be used by the 
webUI yet.  Not reason for a NACK, but indicates more work to be done 
afterwards.
___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel