Use argparse's error function instead of our own print + exit. Signed-off-by: Stéphane Graber <stgra...@ubuntu.com> --- src/lxc/lxc-start-ephemeral.in | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/lxc/lxc-start-ephemeral.in b/src/lxc/lxc-start-ephemeral.in index ccf6059..e11919f 100644 --- a/src/lxc/lxc-start-ephemeral.in +++ b/src/lxc/lxc-start-ephemeral.in @@ -96,20 +96,17 @@ args = parser.parse_args() # Basic requirements check ## Check that -d and CMD aren't used at the same time if args.command and args.daemon: - print(_("You can't use -d and a command at the same time.")) - sys.exit(1) + parser.error(_("You can't use -d and a command at the same time.")) ## The user needs to be uid 0 if not os.geteuid() == 0: - print(_("You must be root to run this script. Try running: sudo %s" % - (sys.argv[0]))) - sys.exit(1) + parser.error(_("You must be root to run this script. Try running: sudo %s" + % (sys.argv[0]))) # Load the orig container orig = lxc.Container(args.orig) if not orig.defined: - print(_("Source container '%s' doesn't exist." % args.orig)) - sys.exit(1) + parser.error(_("Source container '%s' doesn't exist." % args.orig)) # Create the new container paths dest_path = tempfile.mkdtemp(prefix="%s-" % args.orig, dir="@LXCPATH@") -- 1.8.0 ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel