mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
frontend: do not forward argument defaults to server
When forwarding a command call to a server, use only arguments which were explicitly specified by the caller. This increases compatibility between new clients and old servers. https://fedorahosted.org/freeipa/ticket/4739 Reviewed-By: David Kupka <dkupka@redhat.com>
This commit is contained in:
@@ -1243,6 +1243,8 @@ class cli(backend.Executioner):
|
||||
if param.autofill:
|
||||
kw[param.name] = cmd.get_default_of(param.name, **kw)
|
||||
if param.name in kw and kw[param.name] is not None:
|
||||
if param.autofill:
|
||||
del kw[param.name]
|
||||
continue
|
||||
if param.password:
|
||||
kw[param.name] = self.Backend.textui.prompt_password(
|
||||
|
||||
@@ -442,6 +442,7 @@ class Command(HasParam):
|
||||
self.debug(
|
||||
'raw: %s(%s)', self.name, ', '.join(self._repr_iter(**params))
|
||||
)
|
||||
if self.api.env.in_server:
|
||||
params.update(self.get_default(**params))
|
||||
params = self.normalize(**params)
|
||||
params = self.convert(**params)
|
||||
@@ -598,7 +599,7 @@ class Command(HasParam):
|
||||
# Backend.textui.prompt does not fill in the default value,
|
||||
# we have to do it ourselves
|
||||
if not raw.strip():
|
||||
raw = default
|
||||
return None
|
||||
|
||||
try:
|
||||
return param(raw, **kw)
|
||||
|
||||
Reference in New Issue
Block a user