From patchwork Wed Feb 6 19:43:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petr Lautrbach X-Patchwork-Id: 10799989 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0CD541390 for ; Wed, 6 Feb 2019 19:43:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF90E2C2A6 for ; Wed, 6 Feb 2019 19:43:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0FB42C423; Wed, 6 Feb 2019 19:43:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DB222C2A6 for ; Wed, 6 Feb 2019 19:43:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726454AbfBFTng (ORCPT ); Wed, 6 Feb 2019 14:43:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44066 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726442AbfBFTng (ORCPT ); Wed, 6 Feb 2019 14:43:36 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2BBA530254D for ; Wed, 6 Feb 2019 19:43:36 +0000 (UTC) Received: from workstation.redhat.com (ovpn-204-32.brq.redhat.com [10.40.204.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0E3FD45D1; Wed, 6 Feb 2019 19:43:34 +0000 (UTC) From: Petr Lautrbach To: selinux@vger.kernel.org Cc: Petr Lautrbach Subject: [PATCH 2/2] python/semanage: Use standard argparse.error() method in handlePermissive Date: Wed, 6 Feb 2019 20:43:25 +0100 Message-Id: <20190206194325.24875-2-plautrba@redhat.com> In-Reply-To: <20190206194325.24875-1-plautrba@redhat.com> References: <20190206194325.24875-1-plautrba@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 06 Feb 2019 19:43:36 +0000 (UTC) Sender: selinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This method prints a usage message including the message to the standard error and terminates the program with a status code of 2. Signed-off-by: Petr Lautrbach Acked-by: Nicolas Iooss --- python/semanage/semanage | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/python/semanage/semanage b/python/semanage/semanage index 9b737fa8..a9fcb319 100644 --- a/python/semanage/semanage +++ b/python/semanage/semanage @@ -743,9 +743,7 @@ def handlePermissive(args): if args.action == "delete": OBJECT.delete(args.type) else: - args.parser.print_usage(sys.stderr) - sys.stderr.write(_('semanage permissive: error: the following argument is required: type\n')) - sys.exit(1) + args.parser.error(message=_('semanage permissive: error: the following argument is required: type\n')) def setupPermissiveParser(subparsers):