from_hosts_expression_to_xname_vec

Function from_hosts_expression_to_xname_vec 

Source
pub fn from_hosts_expression_to_xname_vec(
    user_input: &str,
    is_include_siblings: bool,
    node_metadata_available_vec: &[Component],
) -> Result<Vec<String>, Error>
Expand description

Translates a ‘host expression’ into a list of xnames.

The expression is first run through [hostlist_parser::parse]; the expanded vector is then required to be uniformly NIDs or uniformly xnames (mixing the two in a single expression is rejected). See the module docs for the supported grammar.

With is_include_siblings = true, every resolved xname is widened to its 10-character blade prefix and every node in node_metadata_available_vec sharing that prefix is included — this is how --include-siblings brings in all four nodes of a blade when only one was named.

§Errors

  • [Error::InvalidNodeId] when hostlist_parser::parse cannot tokenize the input.
  • [Error::BadRequest] when the expanded list is neither all-NID nor all-xname, or when the final xname set is empty (either because the expression resolved to nothing, or because the parser rejected the input).