diff --git a/packages/host/mk-sql/src/ms_sql/instance.rs b/packages/host/mk-sql/src/ms_sql/instance.rs index 81310362876..ffe7b2a9d8a 100644 --- a/packages/host/mk-sql/src/ms_sql/instance.rs +++ b/packages/host/mk-sql/src/ms_sql/instance.rs @@ -2016,7 +2016,7 @@ async fn find_working_instances( ms_sql: &config::ms_sql::Config, environment: &Env, ) -> Result> { - let builders = find_allowed_instance_builders(ms_sql).await?; + let builders = find_all_instance_builders(ms_sql).await?; if builders.is_empty() { log::warn!("Found NO allowed SQL server instances"); return Ok(Vec::new()); @@ -2033,32 +2033,21 @@ async fn find_working_instances( .collect::>()) } -async fn find_allowed_instance_builders( - ms_sql: &config::ms_sql::Config, -) -> Result> { - let builders = find_all_instance_builders(ms_sql).await?; - Ok(builders - .into_iter() - .filter(|i| ms_sql.is_instance_allowed(&i.get_name())) - .collect::>()) -} - pub async fn find_all_instance_builders( ms_sql: &config::ms_sql::Config, ) -> Result> { - let found = find_detectable_instance_builders(ms_sql).await; - log::info!( - "Found {} instances by discovery: [ {} ]", - found.len(), - found - .iter() - .map(|i| format!("{}", i.get_name())) - .collect::>() - .join(", ") - ); - let detected = if ms_sql.discovery().detect() { - found + let builders = detect_instance_builders(ms_sql).await; + log::info!( + "Found {} instances by discovery: [ {} ]", + builders.len(), + builders + .iter() + .map(|i| format!("{}", i.get_name())) + .collect::>() + .join(", ") + ); + builders } else { ms_sql .discovery() @@ -2086,9 +2075,7 @@ pub async fn find_all_instance_builders( } /// find instances described in the config but not detected by the discovery -async fn find_detectable_instance_builders( - ms_sql: &config::ms_sql::Config, -) -> Vec { +async fn detect_instance_builders(ms_sql: &config::ms_sql::Config) -> Vec { obtain_instance_builders(&ms_sql.endpoint(), &[], ms_sql.discovery()) .await .unwrap_or_else(|e| {