diff --git a/Cargo.lock b/Cargo.lock index 9c03e46e5..29258e165 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -804,7 +804,7 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "core" -version = "0.2.14" +version = "0.3.0" dependencies = [ "anyhow", "async_timing_util", @@ -824,7 +824,7 @@ dependencies = [ "jwt", "merge_config_files", "monitor_helpers", - "monitor_types 0.2.14", + "monitor_types 0.3.0", "mungos", "periphery_client", "serde", @@ -1058,10 +1058,10 @@ checksum = "23d8666cb01533c39dde32bcbab8e227b4ed6679b2c925eba05feabea39508fb" [[package]] name = "db_client" -version = "0.2.14" +version = "0.3.0" dependencies = [ "anyhow", - "monitor_types 0.2.14", + "monitor_types 0.3.0", "mungos", ] @@ -1934,12 +1934,12 @@ dependencies = [ [[package]] name = "monitor_cli" -version = "0.2.14" +version = "0.3.0" dependencies = [ "async_timing_util", "clap", "colored", - "monitor_types 0.2.14", + "monitor_types 0.3.0", "rand", "run_command", "serde", @@ -1951,12 +1951,12 @@ dependencies = [ [[package]] name = "monitor_client" -version = "0.2.14" +version = "0.3.0" dependencies = [ "anyhow", "envy", "futures-util", - "monitor_types 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "monitor_types 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest", "serde", "serde_derive", @@ -1968,11 +1968,11 @@ dependencies = [ [[package]] name = "monitor_helpers" -version = "0.2.14" +version = "0.3.0" dependencies = [ "anyhow", "axum", - "monitor_types 0.2.14", + "monitor_types 0.3.0", "rand", "serde", "serde_json", @@ -1981,7 +1981,7 @@ dependencies = [ [[package]] name = "monitor_periphery" -version = "0.2.14" +version = "0.3.0" dependencies = [ "anyhow", "async_timing_util", @@ -1994,7 +1994,7 @@ dependencies = [ "futures", "merge_config_files", "monitor_helpers", - "monitor_types 0.2.14", + "monitor_types 0.3.0", "run_command", "serde", "serde_derive", @@ -2008,7 +2008,7 @@ dependencies = [ [[package]] name = "monitor_types" -version = "0.2.14" +version = "0.3.0" dependencies = [ "anyhow", "bollard", @@ -2025,9 +2025,9 @@ dependencies = [ [[package]] name = "monitor_types" -version = "0.2.14" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19f0b594fa8c0af0c9d4ad7962a15782c7aa4afa575c60df69341f2de012e0c5" +checksum = "8bba1f3fb118a665daf75e64267e24630825319903fc6967c3939eeb6a2f2baa" dependencies = [ "anyhow", "bollard", @@ -2268,11 +2268,11 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "periphery_client" -version = "0.2.14" +version = "0.3.0" dependencies = [ "anyhow", "futures-util", - "monitor_types 0.2.14", + "monitor_types 0.3.0", "reqwest", "serde", "serde_json", diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 2bc763328..789b9676b 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "monitor_cli" -version = "0.2.14" +version = "0.3.0" edition = "2021" authors = ["MoghTech"] description = "monitor cli | tools to setup monitor system" diff --git a/core/Cargo.toml b/core/Cargo.toml index e847b741d..3643faf38 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "core" -version = "0.2.14" +version = "0.3.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/lib/db_client/Cargo.toml b/lib/db_client/Cargo.toml index 84efecd8f..9b4362ec1 100644 --- a/lib/db_client/Cargo.toml +++ b/lib/db_client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "db_client" -version = "0.2.14" +version = "0.3.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/lib/helpers/Cargo.toml b/lib/helpers/Cargo.toml index 5d279d95c..481d185d3 100644 --- a/lib/helpers/Cargo.toml +++ b/lib/helpers/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "monitor_helpers" -version = "0.2.14" +version = "0.3.0" edition = "2021" authors = ["MoghTech"] description = "helpers used as dependency for mogh tech monitor" diff --git a/lib/monitor_client/Cargo.toml b/lib/monitor_client/Cargo.toml index 3f3bd259b..a56abe7a0 100644 --- a/lib/monitor_client/Cargo.toml +++ b/lib/monitor_client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "monitor_client" -version = "0.2.14" +version = "0.3.0" edition = "2021" authors = ["MoghTech"] description = "a client to interact with the monitor system" @@ -9,7 +9,7 @@ license = "GPL-3.0-or-later" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -monitor_types = "0.2.14" +monitor_types = "0.3.0" reqwest = { version = "0.11", features = ["json"] } tokio-tungstenite = { version = "0.18", features=["native-tls"] } tokio = { version = "1.25", features = ["full"] } diff --git a/lib/periphery_client/Cargo.toml b/lib/periphery_client/Cargo.toml index 29c40ceac..851561fe1 100644 --- a/lib/periphery_client/Cargo.toml +++ b/lib/periphery_client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "periphery_client" -version = "0.2.14" +version = "0.3.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/lib/types/Cargo.toml b/lib/types/Cargo.toml index 811abf7fc..962a91ea3 100644 --- a/lib/types/Cargo.toml +++ b/lib/types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "monitor_types" -version = "0.2.14" +version = "0.3.0" edition = "2021" authors = ["MoghTech"] description = "types for the mogh tech monitor" diff --git a/periphery/Cargo.toml b/periphery/Cargo.toml index 989c1f97b..8e414a128 100644 --- a/periphery/Cargo.toml +++ b/periphery/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "monitor_periphery" -version = "0.2.14" +version = "0.3.0" edition = "2021" authors = ["MoghTech"] description = "monitor periphery binary" diff --git a/periphery/src/helpers/git.rs b/periphery/src/helpers/git.rs index 649401ef2..1ffece407 100644 --- a/periphery/src/helpers/git.rs +++ b/periphery/src/helpers/git.rs @@ -25,14 +25,16 @@ pub async fn pull( } logs.push(pull_log); if let Some(on_pull) = on_pull { - path.push(&on_pull.path); - let path = path.display().to_string(); - let on_pull_log = run_monitor_command( - "on pull command", - format!("cd {path} && {}", on_pull.command), - ) - .await; - logs.push(on_pull_log); + if on_pull.path.len() > 0 && on_pull.command.len() > 0 { + path.push(&on_pull.path); + let path = path.display().to_string(); + let on_pull_log = run_monitor_command( + "on pull", + format!("cd {path} && {}", on_pull.command), + ) + .await; + logs.push(on_pull_log); + } } logs } @@ -57,22 +59,26 @@ pub async fn clone_repo( let clone_log = clone(repo, &destination, &branch, access_token).await; let mut logs = vec![clone_log]; if let Some(command) = on_clone { - let on_clone_path = repo_dir.join(&command.path); - let on_clone_log = run_monitor_command( - "on clone", - format!("cd {} && {}", on_clone_path.display(), command.command), - ) - .await; - logs.push(on_clone_log); + if command.path.len() > 0 && command.command.len() > 0 { + let on_clone_path = repo_dir.join(&command.path); + let on_clone_log = run_monitor_command( + "on clone", + format!("cd {} && {}", on_clone_path.display(), command.command), + ) + .await; + logs.push(on_clone_log); + } } if let Some(command) = on_pull { - let on_pull_path = repo_dir.join(&command.path); - let on_pull_log = run_monitor_command( - "on pull", - format!("cd {} && {}", on_pull_path.display(), command.command), - ) - .await; - logs.push(on_pull_log); + if command.path.len() > 0 && command.command.len() > 0 { + let on_pull_path = repo_dir.join(&command.path); + let on_pull_log = run_monitor_command( + "on pull", + format!("cd {} && {}", on_pull_path.display(), command.command), + ) + .await; + logs.push(on_pull_log); + } } Ok(logs) }