From db7dbbb14155883f6df7eb4739a0345073482001 Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Mon, 21 Oct 2013 09:45:21 +0200 Subject: Changed CLI to allow to use FILE as optional param --- ipalib/cli.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'ipalib/cli.py') 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): -- cgit