Skip to main content

prepare_cluster_env

Function prepare_cluster_env 

Source
pub fn prepare_cluster_env(
    cluster: &ClusterConfig,
    overlay_env: Option<&str>,
    cmd: &str,
) -> Result<Vec<String>, String>
Expand description

Prepare the env vars needed for the user binary’s flodl launcher to detect launcher role and fan out. Caller continues to normal dispatch (RunScript / ExecCommand); the spawned subprocess inherits these env vars and the launcher takes over.

overlay_env is the overlay name from fdl @<env> (e.g. Some("cluster")); propagated to remote hosts via the launcher so they see the same overlay-merged commands: resolution.

Returns Err if the cluster config is invalid or JSON serialization fails — surfaces the error before the user binary even starts.

On success returns a Vec<String> of non-fatal resolution warnings (one entry per host whose NSS lookup failed or yielded only loopback addresses). The cluster-dispatch site in main.rs is the one that chooses to print them. Tests that exercise this function for its env-setting behavior simply ignore the returned Vec.