diff --git a/tuned-adm.py b/tuned-adm.py index 4b7e9ed..1df8cc3 100755 --- a/tuned-adm.py +++ b/tuned-adm.py @@ -94,16 +94,17 @@ if __name__ == "__main__": parser_profile_mode = subparsers.add_parser("profile_mode", help="show current profile selection mode") parser_profile_mode.set_defaults(action="profile_mode") - if len(sys.argv) < 2: - parser.print_usage(file = sys.stderr) - sys.exit(1) args = parser.parse_args(sys.argv[1:]) options = vars(args) debug = options.pop("debug") asynco = options.pop("async") timeout = options.pop("timeout") - action_name = options.pop("action") + try: + action_name = options.pop("action") + except KeyError: + parser.print_usage(file = sys.stderr) + sys.exit(1) log_level = options.pop("loglevel") result = False