def auth_cmd(lib, argv, modifiers): # pylint: disable=unused-argument """ Options: * -u - username * -p - password * --token - auth token * --request-timeout - timeout for HTTP requests """ modifiers.ensure_only_supported("-u", "-p", "--request-timeout", "--token") if not argv: raise CmdLineInputError("No host specified") host_dict = { host: _parse_host_options(host, opts) for host, opts in parse_args.split_list_by_any_keywords( argv, "host name").items() } token = modifiers.get("--token") if token: token_value = utils.get_token_from_file(token) for host_info in host_dict.values(): host_info.update(dict(token=token_value)) utils.auth_hosts_token(host_dict) return username, password = utils.get_user_and_pass() for host_info in host_dict.values(): host_info.update(dict(username=username, password=password)) utils.auth_hosts(host_dict)
def auth_cmd(lib, argv, modifiers): if not argv: raise CmdLineInputError("No host specified") host_dict = { host: _parse_host_options(host, opts) for host, opts in parse_args.split_list_by_any_keywords( argv, "host name").items() } username, password = utils.get_user_and_pass() for host_info in host_dict.values(): host_info.update(dict(username=username, password=password)) utils.auth_hosts(host_dict)
def cluster_setup(lib, argv, modifiers): DEFAULT_TRANSPORT_TYPE = KNET_KEYWORD if len(argv) < 2: raise CmdLineInputError() cluster_name, *argv = argv keywords = [TRANSPORT_KEYWORD, "totem", "quorum"] parsed_args = parse_args.group_by_keywords( argv, keywords, implicit_first_group_key="nodes", keyword_repeat_allowed=False, only_found_keywords=True, ) nodes = [ _parse_node_options(node, options) for node, options in parse_args.split_list_by_any_keywords( parsed_args["nodes"], "node name", ).items() ] transport_type = DEFAULT_TRANSPORT_TYPE transport_options = {} if TRANSPORT_KEYWORD in parsed_args: transport_type, transport_options = _parse_transport( parsed_args[TRANSPORT_KEYWORD]) lib.cluster.setup( cluster_name, nodes, transport_type=transport_type, transport_options=transport_options.get(TRANSPORT_DEFAULT_SECTION, {}), link_list=transport_options.get(LINK_KEYWORD, []), compression_options=transport_options.get("compression", {}), crypto_options=transport_options.get("crypto", {}), totem_options=parse_args.prepare_options(parsed_args.get("totem", [])), quorum_options=parse_args.prepare_options(parsed_args.get( "quorum", [])), wait=modifiers["wait"], start=modifiers["start"], enable=modifiers["enable"], force=modifiers["force"], force_unresolvable=modifiers["force"])
def auth_cmd(lib, argv, modifiers): """ Options: * -u - username * -p - password * --request-timeout - timeout for HTTP requests """ modifiers.ensure_only_supported("-u", "-p", "--request-timeout") if not argv: raise CmdLineInputError("No host specified") host_dict = { host: _parse_host_options(host, opts) for host, opts in parse_args.split_list_by_any_keywords( argv, "host name").items() } username, password = utils.get_user_and_pass() for host_info in host_dict.values(): host_info.update(dict(username=username, password=password)) utils.auth_hosts(host_dict)
def auth_cmd(lib, argv, modifiers): # pylint: disable=unused-argument """ Options: * -u - username * -p - password * --request-timeout - timeout for HTTP requests """ modifiers.ensure_only_supported("-u", "-p", "--request-timeout") if not argv: raise CmdLineInputError("No host specified") host_dict = { host: _parse_host_options(host, opts) for host, opts in parse_args.split_list_by_any_keywords( argv, "host name" ).items() } username, password = utils.get_user_and_pass() for host_info in host_dict.values(): host_info.update(dict(username=username, password=password)) utils.auth_hosts(host_dict)