Re: [Freeipa-devel] [PATCH] 035 Fixes for the DNS plugin
On Fri, 07 Jan 2011 12:05:22 -0500 Adam Young wrote: > ACK 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
Re: [Freeipa-devel] [PATCH] 035 Fixes for the DNS plugin
On 01/07/2011 11:59 AM, Jakub Hrozek wrote: On 01/07/2011 05:28 PM, Adam Young wrote: I'm Not a pythonista. What is this line doing? On 01/07/2011 10:58 AM, Jakub Hrozek wrote: + nameserver = nameserver[-1] == '.' and nameserver or nameserver + '.' This construct is called the 'and-or trick' and somewhat resembles ternary operator (which was added to python in 2.7 IIRC, so I'm not sure if it's old enough to use) from C and other languages. See http://diveintopython.org/power_of_introspection/and_or.html#d0e9975 for details. But yeah, a simple if would be more readable. A new patch is attached, thanks for bringing it up. ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel ACK ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 035 Fixes for the DNS plugin
On 01/07/2011 05:28 PM, Adam Young wrote: I'm Not a pythonista. What is this line doing? On 01/07/2011 10:58 AM, Jakub Hrozek wrote: + nameserver = nameserver[-1] == '.' and nameserver or nameserver + '.' This construct is called the 'and-or trick' and somewhat resembles ternary operator (which was added to python in 2.7 IIRC, so I'm not sure if it's old enough to use) from C and other languages. See http://diveintopython.org/power_of_introspection/and_or.html#d0e9975 for details. But yeah, a simple if would be more readable. A new patch is attached, thanks for bringing it up. From 421e0bf1d851e60789454eb1c131af498336881c Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Fri, 7 Jan 2011 10:29:16 +0100 Subject: [PATCH] Fixes for the DNS plugin https://fedorahosted.org/freeipa/ticket/730 --- ipalib/plugins/dns2.py | 12 +--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ipalib/plugins/dns2.py b/ipalib/plugins/dns2.py index e434309..9254f1d 100644 --- a/ipalib/plugins/dns2.py +++ b/ipalib/plugins/dns2.py @@ -24,10 +24,10 @@ Manage DNS zone and resource records. EXAMPLES: Add new zone: - ipa dnszone-add example.com --name_server nameserver.example.com - --admin_email ad...@example.com + ipa dnszone-add example.com --name-server nameserver.example.com + --admin-email ad...@example.com - edd second nameserver for example.com: + Add second nameserver for example.com: ipa dnsrecord-add example.com @ --ns-rec nameserver2.example.com Delete previously added nameserver from example.com: @@ -246,6 +246,12 @@ class dnszone_add(LDAPCreate): entry_attrs['idnsallowdynupdate'] = str( entry_attrs.get('idnsallowdynupdate', False) ).upper() + +nameserver = entry_attrs['idnssoamname'] +if nameserver[-1] != '.': +nameserver += '.' +entry_attrs['nsrecord'] = nameserver +entry_attrs['idnssoamname'] = nameserver return dn api.register(dnszone_add) -- 1.7.3.4 ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 035 Fixes for the DNS plugin
I'm Not a pythonista. What is this line doing? On 01/07/2011 10:58 AM, Jakub Hrozek wrote: +nameserver = nameserver[-1] == '.' and nameserver or nameserver + '.' ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 035 Fixes for the DNS plugin
On Fri, Jan 07, 2011 at 04:54:49PM +0100, Jakub Hrozek wrote: > The attached patch fixes ticket #730 as well as a couple of typos in the > module help. > > To test: > > $ ipa dnszone-add barzone.com --name-server ns.idm.lab.bos.redhat.com > --admin-email ad...@idm.lab.bos.redhat.com > (there must be an A or record for the nameserver) > $ ipa dnsrecord-add barzone.com foo --a-rec 1.2.3.4 > $ host foo.barzone.com > foo.barzone.com has address 1.2.3.4 > Sorry, I forgot to attach the patch. >From cd4f99babea1d54f3b3bbcc5a447a580cd050b5a Mon Sep 17 00:00:00 2001 From: Jakub Hrozek Date: Fri, 7 Jan 2011 10:29:16 +0100 Subject: [PATCH] Fixes for the DNS plugin https://fedorahosted.org/freeipa/ticket/730 --- ipalib/plugins/dns2.py | 11 --- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ipalib/plugins/dns2.py b/ipalib/plugins/dns2.py index e434309..57b4dbe 100644 --- a/ipalib/plugins/dns2.py +++ b/ipalib/plugins/dns2.py @@ -24,10 +24,10 @@ Manage DNS zone and resource records. EXAMPLES: Add new zone: - ipa dnszone-add example.com --name_server nameserver.example.com - --admin_email ad...@example.com + ipa dnszone-add example.com --name-server nameserver.example.com + --admin-email ad...@example.com - edd second nameserver for example.com: + Add second nameserver for example.com: ipa dnsrecord-add example.com @ --ns-rec nameserver2.example.com Delete previously added nameserver from example.com: @@ -246,6 +246,11 @@ class dnszone_add(LDAPCreate): entry_attrs['idnsallowdynupdate'] = str( entry_attrs.get('idnsallowdynupdate', False) ).upper() + +nameserver = entry_attrs['idnssoamname'] +nameserver = nameserver[-1] == '.' and nameserver or nameserver + '.' +entry_attrs['nsrecord'] = nameserver +entry_attrs['idnssoamname'] = nameserver return dn api.register(dnszone_add) -- 1.7.3.4 ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
[Freeipa-devel] [PATCH] 035 Fixes for the DNS plugin
The attached patch fixes ticket #730 as well as a couple of typos in the module help. To test: $ ipa dnszone-add barzone.com --name-server ns.idm.lab.bos.redhat.com --admin-email ad...@idm.lab.bos.redhat.com (there must be an A or record for the nameserver) $ ipa dnsrecord-add barzone.com foo --a-rec 1.2.3.4 $ host foo.barzone.com foo.barzone.com has address 1.2.3.4 ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel