From df8f71ed2cc31b22292f1882e502f8a106f877b1 Mon Sep 17 00:00:00 2001 From: Ivan Druzhitskiy Date: Thu, 28 Sep 2023 18:23:00 +0300 Subject: [PATCH 1/3] fix logger for testmode --- bob-apps/bin/bobd.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/bob-apps/bin/bobd.rs b/bob-apps/bin/bobd.rs index 5167c47b..40989f1b 100755 --- a/bob-apps/bin/bobd.rs +++ b/bob-apps/bin/bobd.rs @@ -83,16 +83,9 @@ async fn main() { }).expect("Node config parsing error"); check_folders(&node, matches.is_present("init_folders")); + initialize_logger(&node, &cluster); } - let mut extra_logstash_fields = HashMap::new(); - extra_logstash_fields.insert("node_name".to_string(), serde_json::Value::String(node.name().to_string())); - if let Some(cluster_node_info) = cluster.nodes().iter().find(|item| item.name() == node.name()) { - extra_logstash_fields.insert("node_address".to_string(), serde_json::Value::String(cluster_node_info.address().to_string())); - } - log4rs::init_file(node.log_config(), log4rs::config::Deserializers::default().with_logstash_extra(extra_logstash_fields)) - .expect("can't find log config"); - let mut mapper = VirtualMapper::new(&node, &cluster); let bind = node.bind(); @@ -344,6 +337,16 @@ fn spawn_signal_handler Date: Thu, 28 Sep 2023 18:32:09 +0300 Subject: [PATCH 2/3] update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0e8e1f2..74ebe127 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Bob versions changelog #### Fixed +- Fix testmode launch prerequisites (#843) #### Updated From dba4223d466de5fc03c0222feaebdb4201d44cc6 Mon Sep 17 00:00:00 2001 From: Ivan Druzhitskiy Date: Fri, 29 Sep 2023 16:56:13 +0300 Subject: [PATCH 3/3] add dir creation --- bob-apps/bin/bobd.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/bob-apps/bin/bobd.rs b/bob-apps/bin/bobd.rs index 40989f1b..b3fefbcf 100755 --- a/bob-apps/bin/bobd.rs +++ b/bob-apps/bin/bobd.rs @@ -191,9 +191,15 @@ fn configure_testmode(sub_matches: &ArgMatches) -> AnyResult<(ClusterConfig, Nod addresses.push(format!("127.0.0.1:{port}")) } let this_node_index = this_node.ok_or(anyhow!("current node address not found"))?; - let cluster = ClusterConfig::get_testmode( - sub_matches.value_of("data").unwrap_or(format!("data_{this_node_index}").as_str()).to_string(), - addresses)?; + let dir = match sub_matches.value_of("data") { + Some(d) => d.to_string(), + None => { + let dir = format!("data_{this_node_index}"); + create_dir(&dir)?; + dir + }, + }; + let cluster = ClusterConfig::get_testmode(dir, addresses)?; let http_api_port = match sub_matches.value_of("restapi-port") { Some(v) => Some(v.parse().context("could not parse --restapi-port")?), None => None