From a95c9f4f2df2f109b5b83aeebe89b0a45a368db2 Mon Sep 17 00:00:00 2001 From: Keagan McClelland Date: Mon, 28 Feb 2022 15:24:10 -0700 Subject: [PATCH] treat the old config as null when we install/recover for the first time (#1297) * treat the old config as null when we install/recover for the first time * reduce scope of change Co-authored-by: Aiden McClelland --- backend/src/config/mod.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/backend/src/config/mod.rs b/backend/src/config/mod.rs index d0a9f89e9..2bcd052a0 100644 --- a/backend/src/config/mod.rs +++ b/backend/src/config/mod.rs @@ -348,6 +348,12 @@ pub fn configure_rec<'a, Db: DbHandle>( .get(db, true) .await?; let volumes = pkg_model.clone().manifest().volumes().get(db, true).await?; + let is_needs_config = !*pkg_model + .clone() + .status() + .configured() + .get(db, true) + .await?; // get current config and current spec let ConfigRes { @@ -473,7 +479,9 @@ pub fn configure_rec<'a, Db: DbHandle>( // handle dependents let dependents = pkg_model.clone().current_dependents().get(db, true).await?; - let prev = old_config.map(Value::Object).unwrap_or_default(); + let prev = if is_needs_config { None } else { old_config } + .map(Value::Object) + .unwrap_or_default(); let next = Value::Object(config.clone()); for (dependent, dep_info) in dependents.iter().filter(|(dep_id, _)| dep_id != &id) { // check if config passes dependent check