mirror of
https://github.com/topjohnwu/selinux.git
synced 2024-11-28 14:00:45 +00:00
policycoreutils: fix 'semanage permissive -l' subcommand
This reverts the commit 97d06737
which introduced a regression on '-l'
which started to require at least one argument and fixes the original
problem other way. A args.parser value is set now and handlePermissive
function uses it to print an usage message when args.type is not set.
Fixes: semanage permissive -l
usage: semanage permissive [-h] (-a | -d | -l) [-n] [-N] [-S STORE]
type [type ...]
semanage permissive: error: the following arguments are required: type
Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
This commit is contained in:
parent
d257b02dde
commit
b300d3d43a
@ -700,12 +700,17 @@ def handlePermissive(args):
|
||||
OBJECT = object_dict['permissive']()
|
||||
OBJECT.set_reload(args.noreload)
|
||||
|
||||
if args.action is "add":
|
||||
OBJECT.add(args.type)
|
||||
if args.action is "list":
|
||||
OBJECT.list(args.noheading)
|
||||
if args.action is "delete":
|
||||
OBJECT.delete(args.type)
|
||||
elif args.type != None:
|
||||
if args.action is "add":
|
||||
OBJECT.add(args.type)
|
||||
if args.action is "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)
|
||||
|
||||
|
||||
def setupPermissiveParser(subparsers):
|
||||
@ -721,8 +726,9 @@ def setupPermissiveParser(subparsers):
|
||||
parser_add_noheading(permissiveParser, "permissive")
|
||||
parser_add_noreload(permissiveParser, "permissive")
|
||||
parser_add_store(permissiveParser, "permissive")
|
||||
permissiveParser.add_argument('type', nargs='+', default=None, help=_('type'))
|
||||
permissiveParser.add_argument('type', nargs='?', default=None, help=_('type'))
|
||||
permissiveParser.set_defaults(func=handlePermissive)
|
||||
permissiveParser.set_defaults(parser=permissiveParser)
|
||||
|
||||
|
||||
def handleDontaudit(args):
|
||||
|
Loading…
Reference in New Issue
Block a user