resolve_target_nodes

Function resolve_target_nodes 

Source
pub async fn resolve_target_nodes(
    infra: &InfraContext<'_>,
    token: &str,
    hosts_expression_opt: Option<&str>,
    group_name_arg_opt: Option<&str>,
    settings_group_name_opt: Option<&str>,
) -> Result<Vec<String>, Error>
Expand description

Resolve target nodes from either a hosts expression, an explicit HSM group name, or the settings-level HSM group.

Priority order (first non-None wins):

  1. hosts_expression_opt — parsed and validated via from_user_hosts_expression_to_xname_vec. Returns a sorted, deduplicated Vec<String> of xnames.
  2. group_name_arg_opt — the group name supplied by the CLI’s --group flag (also accepted as --hsm-group); validated for access via crate::service::authorization::validate_user_group_access, then expanded to member xnames.
  3. settings_group_name_opt — the group configured in cli.toml’s hsm_group; same treatment as (2).

§Errors

  • [Error::BadRequest] when all three options are None, or when the caller lacks access to the chosen group.
  • Any error from from_user_hosts_expression_to_xname_vec in the hosts-expression branch.
  • [Error::NetError] / [Error::CsmError] from get_member_vec_from_group_name_vec.