diff options
author | Martin Basti <mbasti@redhat.com> | 2013-10-21 09:45:21 +0200 |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2013-12-02 13:30:11 +0100 |
commit | db7dbbb14155883f6df7eb4739a0345073482001 (patch) | |
tree | 664ab60da3c84df582ac6d8b59910ebcd4688fbc /ipalib | |
parent | db3e4507329a02e5eba85f8f3eb29361eabf5d57 (diff) | |
download | freeipa-db7dbbb14155883f6df7eb4739a0345073482001.tar.gz freeipa-db7dbbb14155883f6df7eb4739a0345073482001.tar.xz freeipa-db7dbbb14155883f6df7eb4739a0345073482001.zip |
Changed CLI to allow to use FILE as optional param
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/cli.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py index b17888e52..78f2949d2 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -1254,11 +1254,13 @@ class cli(backend.Executioner): raise ValidationError( name=to_cli(p.cli_name), error=e[1] ) - if not raw: - raise ValidationError( - name=to_cli(p.cli_name), error=_('No file to read') - ) - kw[p.name] = self.Backend.textui.decode(raw) + + if raw: + kw[p.name] = self.Backend.textui.decode(raw) + elif p.required: + raise ValidationError( + name=to_cli(p.cli_name), error=_('No file to read') + ) class IPAHelpFormatter(optparse.IndentedHelpFormatter): |