From 6d231b8d2e9b771ead762cebaf706c0ae75c2f79 Mon Sep 17 00:00:00 2001 From: Krzysztof Piotrowski Date: Wed, 23 Aug 2023 11:35:52 +0000 Subject: [PATCH] Return exit code 1 when connection test fails Signed-off-by: Krzysztof Piotrowski --- crates/core/tedge/src/cli/connect/command.rs | 12 ++---------- crates/core/tedge/src/cli/connect/error.rs | 3 +++ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/crates/core/tedge/src/cli/connect/command.rs b/crates/core/tedge/src/cli/connect/command.rs index 1fb13bd62b7..30841234f77 100644 --- a/crates/core/tedge/src/cli/connect/command.rs +++ b/crates/core/tedge/src/cli/connect/command.rs @@ -64,13 +64,8 @@ impl Command for ConnectCommand { println!("Connection check to {} cloud is successful.\n", cloud); Ok(()) } - Ok(DeviceStatus::Unknown) | Err(_) => { - println!( - "Connection check to {} cloud failed.\n", - self.cloud.as_str() - ); - Ok(()) - } + Ok(DeviceStatus::Unknown) => Err(ConnectError::UnknownDeviceStatus.into()), + Err(err) => Err(err.into()), }; } else { return Err((ConnectError::DeviceNotConnected { @@ -283,7 +278,6 @@ fn check_device_status_c8y(tedge_config: &TEdgeConfig) -> Result Result Result