diff options
| author | Jan Cholasta <jcholast@redhat.com> | 2016-06-06 12:14:21 +0200 |
|---|---|---|
| committer | Jan Cholasta <jcholast@redhat.com> | 2016-06-09 09:11:28 +0200 |
| commit | 9c19dd3506a28d4966adb950c8f5016d6d5ce55a (patch) | |
| tree | 3cbbd941d65554b957a3ceca967c5fb188085539 /ipalib | |
| parent | 4660bb7ff0197649c8777151a3a2a5378929e842 (diff) | |
| download | freeipa-9c19dd3506a28d4966adb950c8f5016d6d5ce55a.tar.gz freeipa-9c19dd3506a28d4966adb950c8f5016d6d5ce55a.tar.xz freeipa-9c19dd3506a28d4966adb950c8f5016d6d5ce55a.zip | |
schema: do not validate unrequested params in command_defaults
Request specific params when getting the defaults instead of getting
defaults for all params and filtering the result.
This fixes command_defaults failing with validation errors on unrequested
params.
https://fedorahosted.org/freeipa/ticket/4739
Reviewed-By: David Kupka <dkupka@redhat.com>
Diffstat (limited to 'ipalib')
| -rw-r--r-- | ipalib/frontend.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 81e9cd4c2..ffcf71b5a 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -670,7 +670,7 @@ class Command(HasParam): if kw.get(param.name, None) is None: continue - def get_default(self, **kw): + def get_default(self, _params=None, **kw): """ Return a dictionary of defaults for all missing required values. @@ -687,8 +687,10 @@ class Command(HasParam): >>> c.get_default(color=u'Yellow') {} """ - params = [p.name for p in self.params() if p.name not in kw and (p.required or p.autofill)] - return dict(self.__get_default_iter(params, kw)) + if _params is None: + _params = [p.name for p in self.params() + if p.name not in kw and (p.required or p.autofill)] + return dict(self.__get_default_iter(_params, kw)) def get_default_of(self, _name, **kw): """ |
