-----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'AAAA': _validate_ipaddr,
     u'APL': _validate_ipnet,
+    u'SRV': _validate_srv,
 }
 
 
-- 
1.7.3.4

Attachment: 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

Reply via email to