# Only one positional argument is allowed: the audit log file num_args = len(args) if num_args < 1: parser.error("You must specify the audit log file to be processed.") elif num_args > 1: parser.error("You can only process one audit log file at a time.") # Check if the specified argument is a file if not os.path.isfile(args[0]): parser.error("The specified argument is not a file: %s" % args[0]) # Check date/time ranges start_date = None if opt.start_date and opt.start_date != "0": start_date = check_date_time(parser, opt.start_date, 'start') end_date = None if opt.end_date and opt.end_date != "0": end_date = check_date_time(parser, opt.end_date, 'end') # Check if the value specified for the --users option is valid users = None if opt.users: users = opt.users.split(",") users = [user for user in users if user] if not len(users) > 0: parser.error("The value for the option --users is not valid: " "'{0}'".format(opt.users)) # Check if the value specified for the --query-type option is valid query_types = None
if not os.access(relay_log_index_file, os.R_OK | os.W_OK): parser.error("You do not have enough privileges to access the " "specified relay log index file: " "{0}.".format(opt.relay_log_index)) # Check values specified for the --sequence option. sequence_list = [] if opt.sequence: sequence_list = get_value_intervals_list(parser, opt.sequence, '--sequence', 'sequence') # Check values specified for the --modified-before option. modified_before = None if opt.modified_before: modified_before = check_date_time(parser, opt.modified_before, 'modified', allow_days=True) # Check options not required for specific log types. if opt.log_type == LOG_TYPE_BIN: if opt.relay_log_basename: print( WARN_OPT_NOT_REQUIRED_FOR_TYPE.format( opt='--relay-log-basename', type='{0}log'.format(LOG_TYPE_BIN))) if opt.relay_log_index: print( WARN_OPT_NOT_REQUIRED_FOR_TYPE.format( opt='--relay-log-index', type='{0}log'.format(LOG_TYPE_BIN))) if opt.log_type == LOG_TYPE_RELAY:
# Only one positional argument is allowed: the audit log file num_args = len(args) if num_args < 1: parser.error("You must specify the audit log file to be processed.") elif num_args > 1: parser.error("You can only process one audit log file at a time.") # Check if the specified argument is a file if not os.path.isfile(args[0]): parser.error("The specified argument is not a file: %s" % args[0]) # Check date/time ranges start_date = None if opt.start_date and opt.start_date != "0": start_date = check_date_time(parser, opt.start_date, 'start') end_date = None if opt.end_date and opt.end_date != "0": end_date = check_date_time(parser, opt.end_date, 'end') # Check if the value specified for the --users option is valid users = None if opt.users: users = opt.users.split(",") users = [user for user in users if user] if len(users) <= 0: parser.error("The value for the option --users is not valid: " "'{0}'".format(opt.users)) # Check if the value specified for the --query-type option is valid query_types = None
"file: {0}".format(opt.relay_log_index)) if not os.access(relay_log_index_file, os.R_OK | os.W_OK): parser.error("You do not have enough privileges to access the " "specified relay log index file: " "{0}.".format(opt.relay_log_index)) # Check values specified for the --sequence option. sequence_list = [] if opt.sequence: sequence_list = get_value_intervals_list(parser, opt.sequence, '--sequence', 'sequence') # Check values specified for the --modified-before option. modified_before = None if opt.modified_before: modified_before = check_date_time(parser, opt.modified_before, 'modified', allow_days=True) # Check options not required for specific log types. if opt.log_type == LOG_TYPE_BIN: if opt.relay_log_basename: print(WARN_OPT_NOT_REQUIRED_FOR_TYPE.format( opt='--relay-log-basename', type='{0}log'.format(LOG_TYPE_BIN))) if opt.relay_log_index: print(WARN_OPT_NOT_REQUIRED_FOR_TYPE.format( opt='--relay-log-index', type='{0}log'.format(LOG_TYPE_BIN))) if opt.log_type == LOG_TYPE_RELAY: if opt.bin_log_basename: print(WARN_OPT_NOT_REQUIRED_FOR_TYPE.format( opt='--bin-log-basename',