# Warn if quiet and verbosity are both specified check_verbosity(opt) if opt.verbosity is None: verbosity = 0 else: verbosity = opt.verbosity quiet = opt.quiet if opt.quiet is None: quiet = False if opt.hide_util and not opt.add_util: # TODO: move to common/messages.py parser.error("You can only use --hide_utils option along the " "--add-util option.") extra_utils_dict = {} for utility in opt.add_util: extra_utils_dict[utility] = () options = { 'verbosity': verbosity, 'quiet': quiet, 'width': opt.width, 'utildir': opt.utildir, 'variables': build_variable_dictionary_list(args), 'prompt': 'mysqluc> ', 'welcome': WELCOME_MESSAGE.format(VERSION_STRING, COPYRIGHT_FULL), 'goodbye': GOODBYE_MESSAGE, 'commands': opt.commands,
# Warn if quiet and verbosity are both specified check_verbosity(opt) if opt.verbosity is None: verbosity = 0 else: verbosity = opt.verbosity quiet = opt.quiet if opt.quiet is None: quiet = False if opt.hide_util and not opt.add_util: # TODO: move to common/messages.py parser.error("You can only use --hide_utils option along the " "--add-util option.") extra_utils_dict = {} for utility in opt.add_util: extra_utils_dict[utility] = () options = { 'verbosity': verbosity, 'quiet': quiet, 'width': opt.width, 'utildir': opt.utildir, 'variables': build_variable_dictionary_list(args), 'prompt': 'mysqluc> ', 'welcome': WELCOME_MESSAGE.format(VERSION_STRING, COPYRIGHT_FULL), 'goodbye': GOODBYE_MESSAGE, 'commands': opt.commands,
# 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": if opt.master is None and opt.daemon != "stop": parser.error("You must specify a master to monitor.") if opt.slaves is None and opt.discover is None and opt.daemon != "stop": parser.error("You must supply a list of slaves or the "
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: # 也就是说 最坏的情况下 会在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": if opt.master is None and opt.daemon != "stop": parser.error("You must specify a master to monitor.") # 需要自己选择候选的slave 可能带来运维上的负担 if opt.slaves is None and opt.discover is None and opt.daemon != "stop":