summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
authorMartin Basti <mbasti@redhat.com>2013-10-21 09:45:21 +0200
committerPetr Viktorin <pviktori@redhat.com>2013-12-02 13:30:11 +0100
commitdb7dbbb14155883f6df7eb4739a0345073482001 (patch)
tree664ab60da3c84df582ac6d8b59910ebcd4688fbc /ipalib/cli.py
parentdb3e4507329a02e5eba85f8f3eb29361eabf5d57 (diff)
downloadfreeipa-db7dbbb14155883f6df7eb4739a0345073482001.tar.gz
freeipa-db7dbbb14155883f6df7eb4739a0345073482001.tar.xz
freeipa-db7dbbb14155883f6df7eb4739a0345073482001.zip
Changed CLI to allow to use FILE as optional param
Diffstat (limited to 'ipalib/cli.py')
-rw-r--r--ipalib/cli.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/ipalib/cli.py b/ipalib/cli.py
index b17888e5..78f2949d 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):