summaryrefslogtreecommitdiffstats
path: root/ipalib/cli.py
diff options
context:
space:
mode:
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 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):