diff --git a/CHANGELOG.md b/CHANGELOG.md index 58c7733323..0cf77d0bdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ # UNRELEASED +# fix: DFX sometimes omits a canister in `.env` + # fix: display error cause of some http-related errors Some commands that download http resources, for example `dfx extension install`, will diff --git a/src/dfx/src/lib/operations/canister/install_canister.rs b/src/dfx/src/lib/operations/canister/install_canister.rs index 2f68de8b27..ff696549a4 100644 --- a/src/dfx/src/lib/operations/canister/install_canister.rs +++ b/src/dfx/src/lib/operations/canister/install_canister.rs @@ -253,6 +253,8 @@ The command line value will be used.", info!(log, "Uploading assets to asset canister..."); post_install_store_assets(canister_info, agent, log).await?; } + + // bad, untested code if !canister_info.get_post_install().is_empty() { let config = env.get_config()?; run_post_install_tasks( @@ -262,6 +264,15 @@ The command line value will be used.", pool, env_file.or_else(|| config.as_ref()?.get_config().output_env_file.as_deref()), )?; + } else { + if let Some(pool) = pool { + let dependencies = pool + .get_canister_list() + .iter() + .map(|can| can.canister_id()) + .collect_vec(); + get_and_write_environment_variables(canister_info, &network.name, pool, dependencies.as_slice(), env_file)?; + } } Ok(())