From f189b02996668e5d600f1abed675cb20cd72290f Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Wed, 22 Oct 2008 17:52:32 -0400 Subject: Return a value to the shell that called ipa --- ipalib/cli.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ipalib/cli.py') diff --git a/ipalib/cli.py b/ipalib/cli.py index ab7e3620..4e5e433e 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -270,7 +270,7 @@ class CLI(object): self.print_commands() print 'ipa: ERROR: unknown command %r' % key sys.exit(2) - self.run_cmd( + return self.run_cmd( self[key], list(s.decode('utf-8') for s in args[1:]) ) @@ -280,7 +280,11 @@ class CLI(object): try: self.run_interactive(cmd, kw) except KeyboardInterrupt: - return + return 0 + except errors.RuleError, e: + print e + return 2 + return 0 def run_interactive(self, cmd, kw): for param in cmd.params(): -- cgit