dns: fix dnsrecord_add interactive mode

`dnsrecord_add` interactive mode might prompt for value of non-existent
arguments `a_part_create_reverse` and `aaaa_part_create_reverse`. This
happens because `dnsrecord_add` extra flags are incorrectly defined as
parts of the respective DNS records.

Remove extra flags from DNS record parts to fix the interactive mode on old
clients talking to new servers. Skip non-existent arguments in the
interactive mode to fix new clients talking to old servers.

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

Reviewed-By: Martin Basti <mbasti@redhat.com>
This commit is contained in:
Jan Cholasta 2017-02-23 13:21:59 +00:00 committed by David Kupka
parent 25fa2bb6c9
commit 1e912f5b83
2 changed files with 7 additions and 1 deletions

View File

@ -73,6 +73,10 @@ def prompt_parts(rrtype, cmd, mod_dnsvalue=None):
return user_options
for part_id, part in enumerate(rrobj.params()):
name = part_name_format % (rrtype.lower(), part.name)
if name not in cmd.params:
continue
if mod_parts:
default = mod_parts[part_id]
else:
@ -92,6 +96,8 @@ def prompt_missing_parts(rrtype, cmd, kw, prompt_optional=False):
for part in rrobj.params():
name = part_name_format % (rrtype.lower(), part.name)
if name not in cmd.params:
continue
if name in kw:
continue

View File

@ -3531,7 +3531,7 @@ for param in _dns_records:
'dns{}record'.format(param.rrtype.lower()),
(Object,),
dict(
takes_params=(param.parts or ()) + (param.extra or ()),
takes_params=param.parts or (),
)
)
)