diff --git a/appmgr/src/bin/embassy-cli.rs b/appmgr/src/bin/embassy-cli.rs index 7e27cf1d6..cab4e5424 100644 --- a/appmgr/src/bin/embassy-cli.rs +++ b/appmgr/src/bin/embassy-cli.rs @@ -23,7 +23,7 @@ fn inner_main() -> Result<(), Error> { .takes_value(false), ) .arg(Arg::with_name("host").long("host").short("h").takes_value(true)) - .arg(Arg::with_name("port").long("port").short("p").takes_value(true)), + .arg(Arg::with_name("proxy").long("proxy").short("p").takes_value(true)), context: matches => { simple_logging::log_to_stderr(match matches.occurrences_of("verbosity") { 0 => log::LevelFilter::Off, diff --git a/appmgr/src/config/mod.rs b/appmgr/src/config/mod.rs index 6e7aaf790..5083c1007 100644 --- a/appmgr/src/config/mod.rs +++ b/appmgr/src/config/mod.rs @@ -396,7 +396,7 @@ pub fn configure<'a, Db: DbHandle>( let dependents = pkg_model.clone().current_dependents().get(db, true).await?; let prev = old_config.map(Value::Object).unwrap_or_default(); let next = Value::Object(config.clone()); - for (dependent, dep_info) in &*dependents { + for (dependent, dep_info) in dependents.iter().filter(|(dep_id, _)| dep_id != &id) { fn handle_broken_dependents<'a, Db: DbHandle>( db: &'a mut Db, id: &'a PackageId, diff --git a/appmgr/src/context/cli.rs b/appmgr/src/context/cli.rs index 8a08577d9..4f965cf6f 100644 --- a/appmgr/src/context/cli.rs +++ b/appmgr/src/context/cli.rs @@ -1,6 +1,6 @@ use std::fs::File; use std::io::{BufReader, Read}; -use std::net::{IpAddr, Ipv4Addr}; +use std::net::{Ipv4Addr, SocketAddr}; use std::path::{Path, PathBuf}; use std::sync::Arc; @@ -20,10 +20,8 @@ use crate::{Error, ResultExt}; #[derive(Debug, Default, Deserialize)] #[serde(rename_all = "kebab-case")] pub struct CliContextConfig { - #[serde(deserialize_with = "deserialize_host")] - pub host: Option, - pub port: Option, - pub url: Option, + pub bind_rpc: Option, + pub host: Option, #[serde(deserialize_with = "crate::util::deserialize_from_str_opt")] pub proxy: Option, pub developer_key_path: Option, @@ -69,26 +67,16 @@ impl CliContext { } else { CliContextConfig::default() }; - if let Some(bind) = base.server_config.bind_rpc { - if base.host.is_none() { - base.host = Some(match bind.ip() { - IpAddr::V4(a) => Host::Ipv4(a), - IpAddr::V6(a) => Host::Ipv6(a), - }); - } - if base.port.is_none() { - base.port = Some(bind.port()) - } - } - let host = if let Some(host) = matches.value_of("host") { - Some(Host::parse(host).with_kind(crate::ErrorKind::ParseUrl)?) + let url = if let Some(host) = matches.value_of("host") { + host.parse()? + } else if let Some(host) = base.host { + host } else { - base.host - }; - let port = if let Some(port) = matches.value_of("port") { - Some(port.parse()?) - } else { - base.port + format!( + "http://{}", + base.bind_rpc.unwrap_or(([127, 0, 0, 1], 5959).into()) + ) + .parse()? }; let proxy = if let Some(proxy) = matches.value_of("proxy") { Some(proxy.parse()?) @@ -110,15 +98,7 @@ impl CliContext { CookieStore::default() })); Ok(CliContext(Arc::new(CliContextSeed { - url: base.url.unwrap_or_else(|| { - format!( - "http://{}:{}", - host.unwrap_or_else(|| DEFAULT_HOST.to_owned()), - port.unwrap_or(DEFAULT_PORT) - ) - .parse() - .unwrap() - }), + url, client: { let mut builder = Client::builder().cookie_provider(cookie_store.clone()); if let Some(proxy) = proxy { diff --git a/appmgr/src/dependencies.rs b/appmgr/src/dependencies.rs index 110aa140f..72d46da25 100644 --- a/appmgr/src/dependencies.rs +++ b/appmgr/src/dependencies.rs @@ -260,10 +260,14 @@ impl DependencyConfig { } } -pub async fn update_current_dependents( +pub async fn update_current_dependents< + 'a, + Db: DbHandle, + I: IntoIterator, +>( db: &mut Db, dependent_id: &PackageId, - current_dependencies: &IndexMap, + current_dependencies: I, ) -> Result<(), Error> { for (dependency, dep_info) in current_dependencies { if let Some(dependency_model) = crate::db::DatabaseModel::new()