diff options
author | Ana Krivokapic <akrivoka@redhat.com> | 2013-05-09 18:47:12 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2013-05-16 11:01:33 +0200 |
commit | c5bfeb1ed0fc8a31fcfea475cccc98da37f7c17e (patch) | |
tree | 14c3f46121ed968a58764259a2c3c67741734a61 /ipalib | |
parent | 78774916c89a3feac7ab8b380fcd483285951a8d (diff) | |
download | freeipa.git-c5bfeb1ed0fc8a31fcfea475cccc98da37f7c17e.tar.gz freeipa.git-c5bfeb1ed0fc8a31fcfea475cccc98da37f7c17e.tar.xz freeipa.git-c5bfeb1ed0fc8a31fcfea475cccc98da37f7c17e.zip |
Prompt for nameserver IP address in dnszone-add
Prompt for nameserver IP address in interactive mode of dnszone-add.
Add a corresponding field to dnszone creation dialog in the web UI.
This parameter is required if and only if:
* New zone is a forward zone
* Nameserver is defined inside the new zone
Add a new unit test to cover this functionality.
https://fedorahosted.org/freeipa/ticket/3603
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/plugins/dns.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index 3ad03402..fbc44521 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -1781,9 +1781,30 @@ class dnszone_add(LDAPCreate): ), Str('ip_address?', _validate_ipaddr, doc=_('Add forward record for nameserver located in the created zone'), + label=_('Nameserver IP address'), ), ) + def interactive_prompt_callback(self, kw): + """ + Interactive mode should prompt for nameserver IP address only if all + of the following conditions are true: + * New zone is a forward zone + * NS is defined inside the new zone (NS can be given either in the + form of absolute or relative name) + """ + if kw.get('ip_address', None): + return + + zone = normalize_zone(kw['idnsname']) + ns = kw['idnssoamname'] + relative_ns = not ns.endswith('.') + ns_in_zone = self.obj.get_name_in_zone(zone, ns) + + if not zone_is_reverse(zone) and (relative_ns or ns_in_zone): + ip_address = self.Backend.textui.prompt(_(u'Nameserver IP address')) + kw['ip_address'] = ip_address + def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options): assert isinstance(dn, DN) if not dns_container_exists(self.api.Backend.ldap2): |