From fa334865b1eb24c6eabfe4c80a339c84ffc2d250 Mon Sep 17 00:00:00 2001 From: Martin Preisler Date: Tue, 31 May 2016 13:05:56 -0400 Subject: [PATCH] oscap-docker fixed to be source compatible with py2 and py3 set_defaults is problematic on subparsers in argparse, it changed behavior in python2 and python3 upstream discussion: http://bugs.python.org/issue9351#msg244786 --- utils/oscap-docker.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/oscap-docker.in b/utils/oscap-docker.in index 4ed62fe..f4b0f80 100644 --- a/utils/oscap-docker.in +++ b/utils/oscap-docker.in @@ -65,7 +65,6 @@ if __name__ == '__main__': parser = argparse.ArgumentParser(description='oscap docker', epilog='See `man oscap` to learn \ more about OSCAP-ARGUMENTS') - parser.set_defaults(func=parser.print_help) subparser = parser.add_subparsers(help="commands") # Scan CVEs in image @@ -98,6 +97,10 @@ if __name__ == '__main__': args, unknown = parser.parse_known_args() + if "func" not in args: + parser.print_help() + sys.exit(2) + try: ping_docker()