Re: [Freeipa-devel] [PATCH] 041 Add example of DNS SRV record and a simple validator

2011-01-28 Thread Jakub Hrozek
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 01/27/2011 07:22 AM, Jakub Hrozek wrote:
 On Wed, Jan 26, 2011 at 11:25:03AM -0500, Rob Crittenden wrote:
 Jakub Hrozek wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 On 01/26/2011 03:38 PM, Jakub Hrozek wrote:
 https://fedorahosted.org/freeipa/ticket/846

 This version contains a better example (consistent zone name).

 This requires a change to API.txt too, otherwise the patch looks good.

 rob
 
 Thanks for catching this. I still wonder why I was able to run make rpms
 which in turn runs makeapi --validate.
 
 A new patch is attached.
 

Rebased on top of the current master
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk1Cuu4ACgkQHsardTLnvCU4OgCeNkZs1cBGCZMFi4gblJj06sJx
O1sAoIzF7WXP8v3PYzo+ccCJ9MlbDLkZ
=za9l
-END PGP SIGNATURE-
From 98739136528bae51c0e529946127c5d3fef1cdc7 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek jhro...@redhat.com
Date: Wed, 26 Jan 2011 09:31:50 -0500
Subject: [PATCH] Add example of DNS SRV record and a simple validator

https://fedorahosted.org/freeipa/ticket/846
---
 API.txt   |8 
 ipalib/plugins/dns.py |   23 +++
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/API.txt b/API.txt
index 4b84a2d..2f7016d 100644
--- a/API.txt
+++ b/API.txt
@@ -522,7 +522,7 @@ option: List('rrsigrecord?', attribute=True, cli_name='rrsig_rec',ist('rrsigreco
 option: List('rprecord?', attribute=True, cli_name='rp_rec',ist('rprecord?', attribute=True, cli_name='rp_rec', doc='comma-separated list of RP records', label='RP record', multivalue=True)
 option: List('sigrecord?', attribute=True, cli_name='sig_rec',ist('sigrecord?', attribute=True, cli_name='sig_rec', doc='comma-separated list of SIG records', label='SIG record', multivalue=True)
 option: List('spfrecord?', attribute=True, cli_name='spf_rec',ist('spfrecord?', attribute=True, cli_name='spf_rec', doc='comma-separated list of SPF records', label='SPF record', multivalue=True)
-option: List('srvrecord?', attribute=True, cli_name='srv_rec',ist('srvrecord?', attribute=True, cli_name='srv_rec', doc='comma-separated list of SRV records', label='SRV record', multivalue=True)
+option: List('srvrecord?', _validate_srv, attribute=True, cli_name='srv_rec',ist('srvrecord?', _validate_srv, attribute=True, cli_name='srv_rec', doc='comma-separated list of SRV records', label='SRV record', multivalue=True)
 option: List('sshfprecord?', attribute=True, cli_name='sshfp_rec',ist('sshfprecord?', attribute=True, cli_name='sshfp_rec', doc='comma-separated list of SSHFP records', label='SSHFP record', multivalue=True)
 option: List('tarecord?', attribute=True, cli_name='ta_rec',ist('tarecord?', attribute=True, cli_name='ta_rec', doc='comma-separated list of TA records', label='TA record', multivalue=True)
 option: List('tkeyrecord?', attribute=True, cli_name='tkey_rec',ist('tkeyrecord?', attribute=True, cli_name='tkey_rec', doc='comma-separated list of TKEY records', label='TKEY record', multivalue=True)
@@ -570,7 +570,7 @@ option: List('rrsigrecord?', attribute=True, cli_name='rrsig_rec',ist('rrsigreco
 option: List('rprecord?', attribute=True, cli_name='rp_rec',ist('rprecord?', attribute=True, cli_name='rp_rec', doc='comma-separated list of RP records', label='RP record', multivalue=True)
 option: List('sigrecord?', attribute=True, cli_name='sig_rec',ist('sigrecord?', attribute=True, cli_name='sig_rec', doc='comma-separated list of SIG records', label='SIG record', multivalue=True)
 option: List('spfrecord?', attribute=True, cli_name='spf_rec',ist('spfrecord?', attribute=True, cli_name='spf_rec', doc='comma-separated list of SPF records', label='SPF record', multivalue=True)
-option: List('srvrecord?', attribute=True, cli_name='srv_rec',ist('srvrecord?', attribute=True, cli_name='srv_rec', doc='comma-separated list of SRV records', label='SRV record', multivalue=True)
+option: List('srvrecord?', _validate_srv, attribute=True, cli_name='srv_rec',ist('srvrecord?', _validate_srv, attribute=True, cli_name='srv_rec', doc='comma-separated list of SRV records', label='SRV record', multivalue=True)
 option: List('sshfprecord?', attribute=True, cli_name='sshfp_rec',ist('sshfprecord?', attribute=True, cli_name='sshfp_rec', doc='comma-separated list of SSHFP records', label='SSHFP record', multivalue=True)
 option: List('tarecord?', attribute=True, cli_name='ta_rec',ist('tarecord?', attribute=True, cli_name='ta_rec', doc='comma-separated list of TA records', label='TA record', multivalue=True)
 option: List('tkeyrecord?', attribute=True, cli_name='tkey_rec',ist('tkeyrecord?', attribute=True, cli_name='tkey_rec', doc='comma-separated list of TKEY records', label='TKEY record', multivalue=True)
@@ -619,7 +619,7 @@ option: List('rrsigrecord?', attribute=True, cli_name='rrsig_rec',ist('rrsigreco
 option: List('rprecord?', attribute=True, 

Re: [Freeipa-devel] [PATCH] 041 Add example of DNS SRV record and a simple validator

2011-01-28 Thread Simo Sorce
On Thu, 27 Jan 2011 07:22:27 +0100
Jakub Hrozek jhro...@redhat.com wrote:

 On Wed, Jan 26, 2011 at 11:25:03AM -0500, Rob Crittenden wrote:
  Jakub Hrozek wrote:
  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1
  
  On 01/26/2011 03:38 PM, Jakub Hrozek wrote:
  https://fedorahosted.org/freeipa/ticket/846
  
  This version contains a better example (consistent zone name).
  
  This requires a change to API.txt too, otherwise the patch looks
  good.
  
  rob
 
 Thanks for catching this. I still wonder why I was able to run make
 rpms which in turn runs makeapi --validate.
 
 A new patch is attached.

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


[Freeipa-devel] [PATCH] 041 Add example of DNS SRV record and a simple validator

2011-01-26 Thread Jakub Hrozek
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

https://fedorahosted.org/freeipa/ticket/846
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk1AMfwACgkQHsardTLnvCWbCwCff34Pr/Hy6s6VUSmlFr9+++V8
dJIAn3evO4cbgokA1+xfLBG5q1LhReKI
=azjr
-END PGP SIGNATURE-
From 082d3471fdfe1133a3dd83445ab3774c0304bae6 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek jhro...@redhat.com
Date: Wed, 26 Jan 2011 09:31:50 -0500
Subject: [PATCH] Add example of DNS SRV record and a simple validator

https://fedorahosted.org/freeipa/ticket/846
---
 ipalib/plugins/dns.py |   23 +++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index 69c38b2..4aad9dd 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -39,6 +39,13 @@ EXAMPLES:
  Add new PTR record for www.example.com
ipa dnsrecord-add 15.142.80.in-addr.arpa 2 --ptr-rec www.example.com.
 
+ Add new SRV records for LDAP servers. Three quarters of the requests
+ should go to fast.example.com, one quarter to slow.example.com. If neither
+ is available, switch to backup.example.com.
+   ipa dnsrecord-add srvzone _ldap._tcp --srv-rec=0 3 389 fast.example.com
+   ipa dnsrecord-add srvzone _ldap._tcp --srv-rec=0 1 389 slow.example.com
+   ipa dnsrecord-add srvzone _ldap._tcp --srv-rec=1 1 389 backup.example.com
+
  Show zone example.com:
ipa dnszone-show example.com
 
@@ -114,10 +121,26 @@ def _validate_ipnet(ugettext, ipnet):
 return u'invalid format'
 return None
 
+def _validate_srv(ugettext, srv):
+try:
+prio, weight, port, host = srv.split()
+except ValueError:
+return u'format must be specified as priority weight port target'
+
+try:
+prio = int(prio)
+weight = int(weight)
+port = int(port)
+except ValueError:
+return u'the values of priority, weight and port must be integers'
+
+return None
+
 _record_validators = {
 u'A': _validate_ipaddr,
 u'': _validate_ipaddr,
 u'APL': _validate_ipnet,
+u'SRV': _validate_srv,
 }
 
 
-- 
1.7.3.5



jhrozek-freeipa-041-srv-validator.patch.sig
Description: PGP signature
___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Re: [Freeipa-devel] [PATCH] 041 Add example of DNS SRV record and a simple validator

2011-01-26 Thread Jakub Hrozek
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 01/26/2011 03:38 PM, Jakub Hrozek wrote:
 https://fedorahosted.org/freeipa/ticket/846

This version contains a better example (consistent zone name).
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk1AMxwACgkQHsardTLnvCW8mwCeIik86wzgTkvaUxafulWzF872
LowAoMQKSKrQWW85ovg1wQobQSE1j+cf
=XNLO
-END PGP SIGNATURE-
From 518aef649e56d0e14ba02396171c22c746aae37e Mon Sep 17 00:00:00 2001
From: Jakub Hrozek jhro...@redhat.com
Date: Wed, 26 Jan 2011 09:31:50 -0500
Subject: [PATCH] Add example of DNS SRV record and a simple validator

https://fedorahosted.org/freeipa/ticket/846
---
 ipalib/plugins/dns.py |   23 +++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index 5b5411f..69ae1aa 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -39,6 +39,13 @@ EXAMPLES:
  Add new PTR record for www.example.com
ipa dnsrecord-add 15.142.80.in-addr.arpa 2 --ptr-rec www.example.com.
 
+ Add new SRV records for LDAP servers. Three quarters of the requests
+ should go to fast.example.com, one quarter to slow.example.com. If neither
+ is available, switch to backup.example.com.
+   ipa dnsrecord-add example.com _ldap._tcp --srv-rec=0 3 389 fast.example.com
+   ipa dnsrecord-add example.com _ldap._tcp --srv-rec=0 1 389 slow.example.com
+   ipa dnsrecord-add example.com _ldap._tcp --srv-rec=1 1 389 backup.example.com
+
  Show zone example.com:
ipa dnszone-show example.com
 
@@ -114,10 +121,26 @@ def _validate_ipnet(ugettext, ipnet):
 return u'invalid format'
 return None
 
+def _validate_srv(ugettext, srv):
+try:
+prio, weight, port, host = srv.split()
+except ValueError:
+return u'format must be specified as priority weight port target'
+
+try:
+prio = int(prio)
+weight = int(weight)
+port = int(port)
+except ValueError:
+return u'the values of priority, weight and port must be integers'
+
+return None
+
 _record_validators = {
 u'A': _validate_ipaddr,
 u'': _validate_ipaddr,
 u'APL': _validate_ipnet,
+u'SRV': _validate_srv,
 }
 
 
-- 
1.7.3.4



jhrozek-freeipa-041-02-srv-validator.patch.sig
Description: PGP signature
___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Re: [Freeipa-devel] [PATCH] 041 Add example of DNS SRV record and a simple validator

2011-01-26 Thread Jan Zelený
Jakub Hrozek jhro...@redhat.com wrote:
 On 01/26/2011 03:38 PM, Jakub Hrozek wrote:
  https://fedorahosted.org/freeipa/ticket/846
 
 This version contains a better example (consistent zone name).

ack

Jan

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


Re: [Freeipa-devel] [PATCH] 041 Add example of DNS SRV record and a simple validator

2011-01-26 Thread Rob Crittenden

Jakub Hrozek wrote:

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 01/26/2011 03:38 PM, Jakub Hrozek wrote:

https://fedorahosted.org/freeipa/ticket/846


This version contains a better example (consistent zone name).


This requires a change to API.txt too, otherwise the patch looks good.

rob

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


Re: [Freeipa-devel] [PATCH] 041 Add example of DNS SRV record and a simple validator

2011-01-26 Thread Jakub Hrozek
On Wed, Jan 26, 2011 at 11:25:03AM -0500, Rob Crittenden wrote:
 Jakub Hrozek wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 On 01/26/2011 03:38 PM, Jakub Hrozek wrote:
 https://fedorahosted.org/freeipa/ticket/846
 
 This version contains a better example (consistent zone name).
 
 This requires a change to API.txt too, otherwise the patch looks good.
 
 rob

Thanks for catching this. I still wonder why I was able to run make rpms
which in turn runs makeapi --validate.

A new patch is attached.
From af17c43e77cab88ec001f4bd94c3002bd7a4494d Mon Sep 17 00:00:00 2001
From: Jakub Hrozek jhro...@redhat.com
Date: Wed, 26 Jan 2011 09:31:50 -0500
Subject: [PATCH] Add example of DNS SRV record and a simple validator

https://fedorahosted.org/freeipa/ticket/846
---
 API.txt   |8 
 ipalib/plugins/dns.py |   23 +++
 2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/API.txt b/API.txt
index c9a56f6..8e30a7e 100644
--- a/API.txt
+++ b/API.txt
@@ -522,7 +522,7 @@ option: List('rrsigrecord?', attribute=True, 
cli_name='rrsig_rec',ist('rrsigreco
 option: List('rprecord?', attribute=True, cli_name='rp_rec',ist('rprecord?', 
attribute=True, cli_name='rp_rec', doc='comma-separated list of RP records', 
label='RP record', multivalue=True)
 option: List('sigrecord?', attribute=True, 
cli_name='sig_rec',ist('sigrecord?', attribute=True, cli_name='sig_rec', 
doc='comma-separated list of SIG records', label='SIG record', multivalue=True)
 option: List('spfrecord?', attribute=True, 
cli_name='spf_rec',ist('spfrecord?', attribute=True, cli_name='spf_rec', 
doc='comma-separated list of SPF records', label='SPF record', multivalue=True)
-option: List('srvrecord?', attribute=True, 
cli_name='srv_rec',ist('srvrecord?', attribute=True, cli_name='srv_rec', 
doc='comma-separated list of SRV records', label='SRV record', multivalue=True)
+option: List('srvrecord?', _validate_srv, attribute=True, 
cli_name='srv_rec',ist('srvrecord?', _validate_srv, attribute=True, 
cli_name='srv_rec', doc='comma-separated list of SRV records', label='SRV 
record', multivalue=True)
 option: List('sshfprecord?', attribute=True, 
cli_name='sshfp_rec',ist('sshfprecord?', attribute=True, cli_name='sshfp_rec', 
doc='comma-separated list of SSHFP records', label='SSHFP record', 
multivalue=True)
 option: List('tarecord?', attribute=True, cli_name='ta_rec',ist('tarecord?', 
attribute=True, cli_name='ta_rec', doc='comma-separated list of TA records', 
label='TA record', multivalue=True)
 option: List('tkeyrecord?', attribute=True, 
cli_name='tkey_rec',ist('tkeyrecord?', attribute=True, cli_name='tkey_rec', 
doc='comma-separated list of TKEY records', label='TKEY record', 
multivalue=True)
@@ -570,7 +570,7 @@ option: List('rrsigrecord?', attribute=True, 
cli_name='rrsig_rec',ist('rrsigreco
 option: List('rprecord?', attribute=True, cli_name='rp_rec',ist('rprecord?', 
attribute=True, cli_name='rp_rec', doc='comma-separated list of RP records', 
label='RP record', multivalue=True)
 option: List('sigrecord?', attribute=True, 
cli_name='sig_rec',ist('sigrecord?', attribute=True, cli_name='sig_rec', 
doc='comma-separated list of SIG records', label='SIG record', multivalue=True)
 option: List('spfrecord?', attribute=True, 
cli_name='spf_rec',ist('spfrecord?', attribute=True, cli_name='spf_rec', 
doc='comma-separated list of SPF records', label='SPF record', multivalue=True)
-option: List('srvrecord?', attribute=True, 
cli_name='srv_rec',ist('srvrecord?', attribute=True, cli_name='srv_rec', 
doc='comma-separated list of SRV records', label='SRV record', multivalue=True)
+option: List('srvrecord?', _validate_srv, attribute=True, 
cli_name='srv_rec',ist('srvrecord?', _validate_srv, attribute=True, 
cli_name='srv_rec', doc='comma-separated list of SRV records', label='SRV 
record', multivalue=True)
 option: List('sshfprecord?', attribute=True, 
cli_name='sshfp_rec',ist('sshfprecord?', attribute=True, cli_name='sshfp_rec', 
doc='comma-separated list of SSHFP records', label='SSHFP record', 
multivalue=True)
 option: List('tarecord?', attribute=True, cli_name='ta_rec',ist('tarecord?', 
attribute=True, cli_name='ta_rec', doc='comma-separated list of TA records', 
label='TA record', multivalue=True)
 option: List('tkeyrecord?', attribute=True, 
cli_name='tkey_rec',ist('tkeyrecord?', attribute=True, cli_name='tkey_rec', 
doc='comma-separated list of TKEY records', label='TKEY record', 
multivalue=True)
@@ -619,7 +619,7 @@ option: List('rrsigrecord?', attribute=True, 
cli_name='rrsig_rec',ist('rrsigreco
 option: List('rprecord?', attribute=True, cli_name='rp_rec',ist('rprecord?', 
attribute=True, cli_name='rp_rec', doc='comma-separated list of RP records', 
label='RP record', multivalue=True)
 option: List('sigrecord?', attribute=True, 
cli_name='sig_rec',ist('sigrecord?', attribute=True, cli_name='sig_rec', 
doc='comma-separated list of SIG records', label='SIG record', multivalue=True)
 option: List('spfrecord?', 

Re: [Freeipa-devel] [PATCH] 041 Add example of DNS SRV record and a simple validator

2011-01-26 Thread Jan Zelený
Rob Crittenden rcrit...@redhat.com wrote:
 Jakub Hrozek wrote:
  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1
  
  On 01/26/2011 03:38 PM, Jakub Hrozek wrote:
  https://fedorahosted.org/freeipa/ticket/846
  
  This version contains a better example (consistent zone name).
 
 This requires a change to API.txt too, otherwise the patch looks good.

Sorry for not catching that. I have problems with API.txt on a regular basis, 
so I call makeapi before each compilation. I'm not sure why I have these 
problems, happens on a clean master. I recall seeing some information about it 
somewhere, but I don't know exactly what it was.

Jan

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