if opt.discover and not opt.master: parser.error(PARSE_ERR_OPT_REQ_OPT.format(opt="--discover-slaves-login", opts="--master")) # Check timeout values, must be greater than zero. 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})
# Replication user and password add_rpl_user(parser) # Add ssl options add_ssl_options(parser) # Now we process the rest of the arguments. opt, args = parser.parse_args() # Check security settings check_password_security(opt, args) # Check slaves list if opt.daemon != "stop": check_server_lists(parser, opt.master, opt.slaves) # Check for errors if int(opt.interval) < 5: parser.error("The --interval option requires a value greater than or " "equal to 5.") # The value for --timeout needs to be an integer > 0. try: if int(opt.timeout) <= 0: parser.error("The --timeout option requires a value greater " "than 0.") except ValueError: parser.error("The --timeout option requires an integer value.") # if opt.master is None and opt.daemon and opt.daemon != "stop":