11// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22// SPDX-License-Identifier: Apache-2.0
33
4- use crate :: RemoteOptions ;
54use crate :: container_runtime:: ContainerRuntime ;
65use crate :: paths:: { active_gateway_path, gateways_dir, last_sandbox_path} ;
6+ use crate :: RemoteOptions ;
77use miette:: { IntoDiagnostic , Result , WrapErr } ;
88use openshell_core:: paths:: ensure_parent_dir_restricted;
99use serde:: { Deserialize , Serialize } ;
@@ -289,7 +289,11 @@ pub fn load_active_gateway() -> Option<String> {
289289 let path = active_gateway_path ( ) . ok ( ) ?;
290290 let contents = std:: fs:: read_to_string ( & path) . ok ( ) ?;
291291 let name = contents. trim ( ) . to_string ( ) ;
292- if name. is_empty ( ) { None } else { Some ( name) }
292+ if name. is_empty ( ) {
293+ None
294+ } else {
295+ Some ( name)
296+ }
293297}
294298
295299/// Save the last-used sandbox name for a gateway to persistent storage.
@@ -309,7 +313,11 @@ pub fn load_last_sandbox(gateway: &str) -> Option<String> {
309313 let path = last_sandbox_path ( gateway) . ok ( ) ?;
310314 let contents = std:: fs:: read_to_string ( & path) . ok ( ) ?;
311315 let name = contents. trim ( ) . to_string ( ) ;
312- if name. is_empty ( ) { None } else { Some ( name) }
316+ if name. is_empty ( ) {
317+ None
318+ } else {
319+ Some ( name)
320+ }
313321}
314322
315323/// Clear the last-used sandbox record for a gateway if it matches the given name.
@@ -570,6 +578,7 @@ mod tests {
570578 auth_mode : None ,
571579 edge_team_domain : None ,
572580 edge_auth_url : None ,
581+ container_runtime : ContainerRuntime :: default ( ) ,
573582 } ;
574583 assert_eq ! ( meta. gateway_host( ) , None ) ;
575584 }
@@ -586,6 +595,7 @@ mod tests {
586595 auth_mode : None ,
587596 edge_team_domain : None ,
588597 edge_auth_url : None ,
598+ container_runtime : ContainerRuntime :: default ( ) ,
589599 } ;
590600 assert_eq ! ( meta. gateway_host( ) , Some ( "10.0.0.5" ) ) ;
591601 }
0 commit comments