if opt.failover_mode == 'elect' and opt.candidates is None: parser.error("Failover mode = 'elect' requires at least one " "candidate.") if opt.fail_retry and opt.exec_fail: parser.error("The --master-fail-retry option cannot be used " "with --exec-fail-check.") if opt.fail_retry and opt.fail_retry < 1: parser.error("The --master-fail-retry option must be a positive " "integer > 0.") # Parse the master, slaves, and candidates connection parameters try: master_val, slaves_val, candidates_val = parse_topology_connections( opt) except UtilRplError: _, e, _ = sys.exc_info() print("ERROR: {0}".format(e.errmsg)) sys.exit(1) # Check hostname alias for slave_val in slaves_val: if check_hostname_alias(master_val, slave_val): parser.error("The master and one of the slaves are the same " "host and port.") for cand_val in candidates_val: if check_hostname_alias(master_val, cand_val): parser.error("The master and one of the candidates are the same " "host and port.")
if opt.rpl_timeout < 0: parser.error(PARSE_ERR_OPT_REQ_NON_NEGATIVE_VALUE.format(opt="--rpl-timeout")) if opt.checksum_timeout < 0: parser.error(PARSE_ERR_OPT_REQ_NON_NEGATIVE_VALUE.format(opt="--checksum-timeout")) # Check interval value, must be greater than zero. if opt.interval < 1: parser.error(PARSE_ERR_OPT_REQ_GREATER_VALUE.format(opt="--interval", val="zero")) # Check slaves list (master cannot be included in slaves list). if opt.master: check_server_lists(parser, opt.master, opt.slaves) # Parse the master and slaves connection parameters (no candidates). try: master_val, slaves_val, _ = parse_topology_connections(opt, parse_candidates=False) except UtilRplError: _, err, _ = sys.exc_info() sys.stderr.write("ERROR: {0}\n".format(err.errmsg)) sys.exit(1) # Check host aliases (master cannot be included in slaves list). if master_val: for slave_val in slaves_val: if check_hostname_alias(master_val, slave_val): master = Server({"conn_info": master_val}) slave = Server({"conn_info": slave_val}) parser.error( ERROR_MASTER_IN_SLAVES.format( master_host=master.host, master_port=master.port,
PARSE_ERR_OPT_REQ_NON_NEGATIVE_VALUE.format( opt='--checksum-timeout')) # Check interval value, must be greater than zero. if opt.interval < 1: parser.error( PARSE_ERR_OPT_REQ_GREATER_VALUE.format(opt='--interval', val='zero')) # Check slaves list (master cannot be included in slaves list). if opt.master: check_server_lists(parser, opt.master, opt.slaves) # Parse the master and slaves connection parameters (no candidates). try: master_val, slaves_val, _ = parse_topology_connections( opt, parse_candidates=False) except UtilRplError: _, err, _ = sys.exc_info() sys.stderr.write("ERROR: {0}\n".format(err.errmsg)) sys.exit(1) # Check host aliases (master cannot be included in slaves list). if master_val: for slave_val in slaves_val: if check_hostname_alias(master_val, slave_val): master = Server({'conn_info': master_val}) slave = Server({'conn_info': slave_val}) parser.error( ERROR_MASTER_IN_SLAVES.format(master_host=master.host, master_port=master.port, slaves_candidates="slaves",