diff options
author | Alex <alex@adnab.me> | 2021-04-05 23:50:33 +0200 |
---|---|---|
committer | Alex <alex@adnab.me> | 2021-04-05 23:50:33 +0200 |
commit | 8225fa2e4b85349709f840df45b3ecc3bcfb8284 (patch) | |
tree | b300d7e3df823a878686d71cf7e728aeca7e56cc /src/garage | |
parent | 7d772737a58b3c8dce147e4704152e2e6471bd90 (diff) | |
parent | ab67bd88decc4f27876aaf7a1448070875c90258 (diff) | |
download | garage-8225fa2e4b85349709f840df45b3ecc3bcfb8284.tar.gz garage-8225fa2e4b85349709f840df45b3ecc3bcfb8284.zip |
Merge pull request 'Improved bootstraping procedure' (#56) from better_bootstrap into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/56
Diffstat (limited to 'src/garage')
-rw-r--r-- | src/garage/admin_rpc.rs | 4 | ||||
-rw-r--r-- | src/garage/cli.rs | 12 | ||||
-rw-r--r-- | src/garage/server.rs | 2 |
3 files changed, 11 insertions, 7 deletions
diff --git a/src/garage/admin_rpc.rs b/src/garage/admin_rpc.rs index df00fcaf..d04dd7a1 100644 --- a/src/garage/admin_rpc.rs +++ b/src/garage/admin_rpc.rs @@ -246,15 +246,13 @@ impl AdminRpcHandler { ))) } KeyOperation::Import(query) => { - let prev_key = self.garage.key_table.get(&EmptyKey, &query.key_id) - .await?; + let prev_key = self.garage.key_table.get(&EmptyKey, &query.key_id).await?; if prev_key.is_some() { return Err(Error::Message(format!("Key {} already exists in data store. Even if it is deleted, we can't let you create a new key with the same ID. Sorry.", query.key_id))); } let imported_key = Key::import(&query.key_id, &query.secret_key, &query.name); self.garage.key_table.insert(&imported_key).await?; Ok(AdminRPC::KeyInfo(imported_key)) - } } } diff --git a/src/garage/cli.rs b/src/garage/cli.rs index 886cf384..eb8275a9 100644 --- a/src/garage/cli.rs +++ b/src/garage/cli.rs @@ -5,8 +5,8 @@ use std::path::PathBuf; use serde::{Deserialize, Serialize}; use structopt::StructOpt; -use garage_util::error::Error; use garage_util::data::UUID; +use garage_util::error::Error; use garage_util::time::*; use garage_rpc::membership::*; @@ -384,7 +384,10 @@ pub async fn cmd_status( Ok(()) } -pub fn find_matching_node(cand: impl std::iter::Iterator<Item=UUID>, pattern: &str) -> Result<UUID, Error> { +pub fn find_matching_node( + cand: impl std::iter::Iterator<Item = UUID>, + pattern: &str, +) -> Result<UUID, Error> { let mut candidates = vec![]; for c in cand { if hex::encode(&c).starts_with(&pattern) { @@ -428,7 +431,10 @@ pub async fn cmd_configure( for replaced in args.replace.iter() { let replaced_node = find_matching_node(config.members.keys().cloned(), replaced)?; if config.members.remove(&replaced_node).is_none() { - return Err(Error::Message(format!("Cannot replace node {:?} as it is not in current configuration", replaced_node))); + return Err(Error::Message(format!( + "Cannot replace node {:?} as it is not in current configuration", + replaced_node + ))); } } diff --git a/src/garage/server.rs b/src/garage/server.rs index c45a69b8..feb858e4 100644 --- a/src/garage/server.rs +++ b/src/garage/server.rs @@ -52,7 +52,7 @@ pub async fn run_server(config_file: PathBuf) -> Result<(), Error> { info!("Initializing Garage main data store..."); let garage = Garage::new(config.clone(), db, background, &mut rpc_server); let bootstrap = garage.system.clone().bootstrap( - &config.bootstrap_peers[..], + config.bootstrap_peers, config.consul_host, config.consul_service_name, ); |