valid_ets = [e_type.lower() for e_type in audit_log.EVENT_TYPES] for et in event_types: if et not in valid_ets: parser.error("The specified EVENT_TYPE value is not " "valid: '{0}'\nSupported values: {1}" "".format(et, ",".join(valid_ets))) # Check specified pattern if opt.use_regexp and not opt.pattern: parser.error("The --pattern option is required if REGEXP option is " "set.") pattern = opt.pattern if opt.pattern and not opt.use_regexp: # Convert SQL LIKE pattern to Python REGEXP pattern = pattern_matching.convertSQL_LIKE2REGEXP(opt.pattern) # Check if the values specified for the --status option are valid status_list = [] if opt.status: status_list = get_value_intervals_list(parser, opt.status, '--status', 'status') # Create dictionary of options options = { 'log_name': args[0], 'verbosity': opt.verbosity, 'format': opt.format, 'users': users, 'start_date': start_date, 'end_date': end_date,
else: valid_ets = map((lambda x: x.lower()), audit_log.EVENT_TYPES) for et in event_types: if et not in valid_ets: parser.error("The specified EVENT_TYPE value is not valid: '" + et + "'\nSupported values: " + ",".join(valid_ets)) # Check specified pattern if opt.use_regexp and not opt.pattern: parser.error("The --pattern option is required if REGEXP option is set.") pattern = opt.pattern if opt.pattern and not opt.use_regexp: # Convert SQL LIKE pattern to Python REGEXP pattern = pattern_matching.convertSQL_LIKE2REGEXP(opt.pattern) # Create dictionary of options options = { 'log_name': args[0], 'verbosity': opt.verbosity, 'format': opt.format, 'users': users, 'start_date': start_date, 'end_date': end_date, 'pattern': pattern, 'use_regexp': opt.use_regexp, 'query_type': query_types, 'event_type': event_types, }