From f32b0f9a2fdd37ba0a47a5b078b67dde63df5c38 Mon Sep 17 00:00:00 2001 From: Nathaniel Cook Date: Mon, 24 Jun 2024 12:39:52 -0600 Subject: [PATCH] fix: use list of args for migration_cmd --- operator/src/network/controller.rs | 4 +-- operator/src/network/ipfs.rs | 27 +++++++++---------- operator/src/network/spec.rs | 2 +- runner/src/scenario/ceramic/mod.rs | 6 ++--- runner/src/scenario/ceramic/model_instance.rs | 1 + 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/operator/src/network/controller.rs b/operator/src/network/controller.rs index fe4604d..c0a06c7 100644 --- a/operator/src/network/controller.rs +++ b/operator/src/network/controller.rs @@ -861,8 +861,8 @@ async fn update_peer_status( for ceramic in ceramics { for i in 0..ceramic.info.replicas { let pod_name = ceramic.info.pod_name(i); - let pod = pods.get_status(&pod_name).await?; - if !is_pod_ready(&pod) { + let pod = pods.get_status(&pod_name).await; + if pod.map(|pod| !is_pod_ready(&pod)).unwrap_or(true) { debug!(pod_name, "peer is not ready skipping"); continue; } diff --git a/operator/src/network/ipfs.rs b/operator/src/network/ipfs.rs index 38473a6..7c0c622 100644 --- a/operator/src/network/ipfs.rs +++ b/operator/src/network/ipfs.rs @@ -105,7 +105,7 @@ pub struct RustIpfsConfig { storage: PersistentStorageConfig, rust_log: String, env: Option>, - migration_cmd: Option, + migration_cmd: Option>, } impl RustIpfsConfig { @@ -273,20 +273,17 @@ impl RustIpfsConfig { } fn init_container(&self, net_config: &NetworkConfig) -> Option { - if let Some(cmd) = &self.migration_cmd { - Some(Container { - command: Some( - vec!["/usr/bin/ceramic-one", "migrations"] - .into_iter() - .chain(cmd.split_whitespace()) - .map(ToOwned::to_owned) - .collect(), - ), - ..self.container(net_config) - }) - } else { - None - } + self.migration_cmd.as_ref().map(|cmd| Container { + name: "ipfs-migration".to_string(), + command: Some( + vec!["/usr/bin/ceramic-one", "migrations"] + .into_iter() + .chain(cmd.iter().map(String::as_str)) + .map(ToOwned::to_owned) + .collect(), + ), + ..self.container(net_config) + }) } } diff --git a/operator/src/network/spec.rs b/operator/src/network/spec.rs index 6c56d67..f19a4e7 100644 --- a/operator/src/network/spec.rs +++ b/operator/src/network/spec.rs @@ -205,7 +205,7 @@ pub struct RustIpfsSpec { /// CAUTION: Any env vars specified in this set will override any predefined values. pub env: Option>, /// Migration command that should run before a node comes up - pub migration_cmd: Option, + pub migration_cmd: Option>, } /// Describes how the Go IPFS node for a peer should behave. diff --git a/runner/src/scenario/ceramic/mod.rs b/runner/src/scenario/ceramic/mod.rs index 08fdefb..0aab8cb 100644 --- a/runner/src/scenario/ceramic/mod.rs +++ b/runner/src/scenario/ceramic/mod.rs @@ -30,7 +30,7 @@ impl Credentials { let did = Document::new(&std::env::var("DID_KEY").expect("DID_KEY is required")); let private_key = std::env::var("DID_PRIVATE_KEY").expect("DID_PRIVATE_KEY is required"); let signer = JwkSigner::new(did.clone(), &private_key).await?; - Ok(Self { signer }) + Ok(Self { signer, did }) } pub async fn admin_from_env() -> Result { @@ -51,13 +51,13 @@ impl Credentials { let did = Self::generate_did_for_jwk(&key)?; let signer = JwkSigner::new(did.clone(), &private_key).await?; - Ok(Self { signer }) + Ok(Self { signer, did }) } pub async fn new_generate_did_key() -> Result { let (pk, did) = Self::generate_did_and_pk()?; let signer = JwkSigner::new(did.clone(), &pk).await?; - Ok(Self { signer }) + Ok(Self { signer, did }) } fn generate_did_for_jwk(key: &JWK) -> anyhow::Result { diff --git a/runner/src/scenario/ceramic/model_instance.rs b/runner/src/scenario/ceramic/model_instance.rs index b90c02d..220d4fd 100644 --- a/runner/src/scenario/ceramic/model_instance.rs +++ b/runner/src/scenario/ceramic/model_instance.rs @@ -259,6 +259,7 @@ impl CeramicModelInstanceTestUser { user_info: GooseUserInfo { lead_user, lead_worker: is_goose_lead_worker(), + global_leader, }, small_model_id, small_model_instance_ids,