diff --git a/golem_cli/src/command/provider.rs b/golem_cli/src/command/provider.rs index 1e3ce11572..08c03fa3cf 100644 --- a/golem_cli/src/command/provider.rs +++ b/golem_cli/src/command/provider.rs @@ -3,10 +3,9 @@ use serde::Deserialize; use std::{collections::BTreeMap, process::Stdio}; use tokio::process::{Child, Command}; -use ya_core_model::payment::local::NetworkName; pub use ya_provider::GlobalsState as ProviderConfig; -use crate::command::NETWORK_GROUP_MAP; +use crate::command::{NetworkGroup, NETWORK_GROUP_MAP}; use crate::setup::RunConfig; const CLASSIC_RUNTIMES: &'static [&'static str] = &["wasmtime", "vm"]; @@ -50,7 +49,7 @@ impl YaProviderCommand { pub async fn set_config( self, config: &ProviderConfig, - networks: &Vec, + network_group: &NetworkGroup, ) -> anyhow::Result<()> { let mut cmd = self.cmd; @@ -66,7 +65,7 @@ impl YaProviderCommand { if let Some(account) = &config.account { cmd.args(&["--account", &account.to_string()]); } - for n in networks.iter() { + for n in NETWORK_GROUP_MAP[&network_group].iter() { cmd.args(&["--payment-network", &n.to_string()]); } @@ -151,7 +150,7 @@ impl YaProviderCommand { disk: Option, ) -> anyhow::Result<()> { let cmd = &mut self.cmd; - cmd.arg("profile").arg("update").arg(name); + cmd.arg("profile").arg("update").arg("--name").arg(name); if let Some(cores) = cores { cmd.arg("--cpu-threads").arg(cores.to_string()); } @@ -183,7 +182,7 @@ impl YaProviderCommand { cmd.arg("--price").arg(format!("Init price={}", initial)); } for runtime_name in CLASSIC_RUNTIMES { - cmd.arg(format!("--name {}", runtime_name)); + cmd.arg("--name").arg(runtime_name); } self.exec_no_output().await } diff --git a/golem_cli/src/settings.rs b/golem_cli/src/settings.rs index defbcc0fa4..6b0f7b7925 100644 --- a/golem_cli/src/settings.rs +++ b/golem_cli/src/settings.rs @@ -1,10 +1,11 @@ -use crate::command::{ProviderConfig, YaCommand}; +use crate::{ + command::{ProviderConfig, YaCommand}, + setup::ConfigAccount, +}; use anyhow::Result; use byte_unit::{Byte as Bytes, ByteUnit}; use structopt::StructOpt; -use ya_provider::ReceiverAccount; - /// Manage settings #[derive(StructOpt, Debug)] pub struct Settings { @@ -36,7 +37,7 @@ pub struct Settings { cpu_per_hour: Option, #[structopt(flatten)] - pub account: ReceiverAccount, + pub account: ConfigAccount, } pub async fn run(settings: Settings) -> Result { @@ -50,7 +51,7 @@ pub async fn run(settings: Settings) -> Result { node_name: settings.node_name, ..ProviderConfig::default() }, - &settings.account.networks, + &settings.account.network, ) .await?; } @@ -62,7 +63,7 @@ pub async fn run(settings: Settings) -> Result { account: settings.account.account, ..ProviderConfig::default() }, - &settings.account.networks, + &settings.account.network, ) .await?; } diff --git a/golem_cli/src/setup.rs b/golem_cli/src/setup.rs index 73f1442508..f5dae88c80 100644 --- a/golem_cli/src/setup.rs +++ b/golem_cli/src/setup.rs @@ -10,8 +10,8 @@ use strum::VariantNames; use ya_core_model::NodeId; +use crate::command::NetworkGroup; use crate::command::UsageDef; -use crate::command::{NetworkGroup, NETWORK_GROUP_MAP}; use crate::terminal::clear_stdin; const OLD_DEFAULT_SUBNETS: &[&'static str] = &["community", "community.3", "community.4"]; @@ -147,7 +147,7 @@ pub async fn setup(run_config: &RunConfig, force: bool) -> Result { config.node_name = Some(node_name); config.subnet = Some(subnet); cmd.ya_provider()? - .set_config(&config, &NETWORK_GROUP_MAP[&run_config.account.network]) + .set_config(&config, &run_config.account.network) .await?; }