summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2011-01-26 09:31:50 -0500
committerSimo Sorce <ssorce@redhat.com>2011-01-28 11:44:38 -0500
commit682ca8658aa3b1c517848bc72e6531fea782ed07 (patch)
tree4c0ab1545d5943ff2859289c5095e57437e26fce /ipalib
parenta641f1f23d40dec7dc596c9d6d2bf7265ea54f97 (diff)
downloadfreeipa-682ca8658aa3b1c517848bc72e6531fea782ed07.tar.gz
freeipa-682ca8658aa3b1c517848bc72e6531fea782ed07.tar.xz
freeipa-682ca8658aa3b1c517848bc72e6531fea782ed07.zip
Add example of DNS SRV record and a simple validator
https://fedorahosted.org/freeipa/ticket/846
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/plugins/dns.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index b4f56d4b1..f0c24ad56 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,
}
def has_cli_options(entry, no_option_msg):