diff options
Diffstat (limited to 'crates/core/tedge/src/cli/disconnect')
-rw-r--r-- | crates/core/tedge/src/cli/disconnect/cli.rs | 15 | ||||
-rw-r--r-- | crates/core/tedge/src/cli/disconnect/disconnect_bridge.rs | 2 |
2 files changed, 12 insertions, 5 deletions
diff --git a/crates/core/tedge/src/cli/disconnect/cli.rs b/crates/core/tedge/src/cli/disconnect/cli.rs index 12181669..1b77aff6 100644 --- a/crates/core/tedge/src/cli/disconnect/cli.rs +++ b/crates/core/tedge/src/cli/disconnect/cli.rs @@ -1,5 +1,6 @@ use crate::cli::disconnect::disconnect_bridge::*; use crate::command::*; +use crate::system_services::service_manager; use structopt::StructOpt; const C8Y_CONFIG_FILENAME: &str = "c8y-bridge.conf"; @@ -17,20 +18,26 @@ impl BuildCommand for TEdgeDisconnectBridgeCli { fn build_command(self, context: BuildContext) -> Result<Box<dyn Command>, crate::ConfigError> { let cmd = match self { TEdgeDisconnectBridgeCli::C8y => DisconnectBridgeCommand { - config_location: context.config_location, + config_location: context.config_location.clone(), config_file: C8Y_CONFIG_FILENAME.into(), cloud: Cloud::C8y, use_mapper: true, use_agent: true, - service_manager: context.service_manager.clone(), + service_manager: service_manager( + context.user_manager.clone(), + context.config_location.tedge_config_root_path, + )?, }, TEdgeDisconnectBridgeCli::Az => DisconnectBridgeCommand { - config_location: context.config_location, + config_location: context.config_location.clone(), config_file: AZURE_CONFIG_FILENAME.into(), cloud: Cloud::Azure, use_mapper: true, use_agent: false, - service_manager: context.service_manager.clone(), + service_manager: service_manager( + context.user_manager.clone(), + context.config_location.tedge_config_root_path, + )?, }, }; Ok(cmd.into_boxed()) diff --git a/crates/core/tedge/src/cli/disconnect/disconnect_bridge.rs b/crates/core/tedge/src/cli/disconnect/disconnect_bridge.rs index d1854a8c..295dd641 100644 --- a/crates/core/tedge/src/cli/disconnect/disconnect_bridge.rs +++ b/crates/core/tedge/src/cli/disconnect/disconnect_bridge.rs @@ -63,7 +63,7 @@ impl DisconnectBridgeCommand { // If this fails, do not continue with applying changes and stopping/disabling tedge-mapper. self.remove_bridge_config_file()?; - if let Err(SystemServiceError::ServiceManagerUnavailable(name)) = + if let Err(SystemServiceError::ServiceManagerUnavailable { cmd: _, name }) = self.service_manager.check_operational() { println!( |