diff --git a/src/dfx/src/commands/build.rs b/src/dfx/src/commands/build.rs index 0a5c1010b6..c162a60c0f 100644 --- a/src/dfx/src/commands/build.rs +++ b/src/dfx/src/commands/build.rs @@ -65,7 +65,6 @@ pub fn exec(env: &dyn Environment, args: &ArgMatches<'_>) -> DfxResult { slog::info!(logger, "Building canisters..."); - // TODO: remove the forcing of generating canister id once we have an update flow. canister_pool.build_or_fail( BuildConfig::from_config(&config)? .with_skip_frontend(args.is_present("skip-frontend")) diff --git a/src/dfx/src/commands/canister/create.rs b/src/dfx/src/commands/canister/create.rs index 9a41e50d3c..18daf3f104 100644 --- a/src/dfx/src/commands/canister/create.rs +++ b/src/dfx/src/commands/canister/create.rs @@ -3,6 +3,7 @@ use crate::lib::error::{DfxError, DfxResult}; use crate::lib::message::UserMessage; use crate::lib::models::canister_id_store::CanisterIdStore; use crate::lib::progress_bar::ProgressBar; +use crate::lib::provider::get_network_context; use crate::lib::waiter::create_waiter; use clap::{App, Arg, ArgMatches, SubCommand}; @@ -44,11 +45,20 @@ fn create_canister(env: &dyn Environment, canister_name: &str) -> DfxResult { let mut canister_id_store = CanisterIdStore::for_env(env)?; + let network_name = get_network_context()?; + + let non_default_network = if network_name == "local" { + format!("") + } else { + format!("on network {:?} ", network_name) + }; + match canister_id_store.find(&canister_name) { Some(canister_id) => { let message = format!( - "{:?} canister was already created and has canister id: {:?}", + "{:?} canister was already created {}and has canister id: {:?}", canister_name, + non_default_network, canister_id.to_text() ); b.finish_with_message(&message); @@ -58,8 +68,8 @@ fn create_canister(env: &dyn Environment, canister_name: &str) -> DfxResult { let cid = runtime.block_on(mgr.create_canister(create_waiter()))?; let canister_id = cid.to_text(); let message = format!( - "{:?} canister created with canister id: {:?}", - canister_name, canister_id + "{:?} canister created {}with canister id: {:?}", + canister_name, non_default_network, canister_id ); b.finish_with_message(&message); canister_id_store.add(&canister_name, canister_id)