Skip to content

Commit

Permalink
fix: use list of args for migration_cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanielc committed Jun 25, 2024
1 parent 4586551 commit f32b0f9
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 21 deletions.
4 changes: 2 additions & 2 deletions operator/src/network/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
27 changes: 12 additions & 15 deletions operator/src/network/ipfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ pub struct RustIpfsConfig {
storage: PersistentStorageConfig,
rust_log: String,
env: Option<BTreeMap<String, String>>,
migration_cmd: Option<String>,
migration_cmd: Option<Vec<String>>,
}

impl RustIpfsConfig {
Expand Down Expand Up @@ -273,20 +273,17 @@ impl RustIpfsConfig {
}

fn init_container(&self, net_config: &NetworkConfig) -> Option<Container> {
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)
})
}
}

Expand Down
2 changes: 1 addition & 1 deletion operator/src/network/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ pub struct RustIpfsSpec {
/// CAUTION: Any env vars specified in this set will override any predefined values.
pub env: Option<BTreeMap<String, String>>,
/// Migration command that should run before a node comes up
pub migration_cmd: Option<String>,
pub migration_cmd: Option<Vec<String>>,
}

/// Describes how the Go IPFS node for a peer should behave.
Expand Down
6 changes: 3 additions & 3 deletions runner/src/scenario/ceramic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self, anyhow::Error> {
Expand All @@ -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<Self, anyhow::Error> {
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<Document> {
Expand Down
1 change: 1 addition & 0 deletions runner/src/scenario/ceramic/model_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit f32b0f9

Please sign in to comment.