@@ -308,34 +308,28 @@ fn run_ansible_configuration(
308308 //
309309 // For now, we'll catch the expected connection error and log it:
310310
311- let config_result = create_container_config ( ) ;
312- match config_result {
313- Ok ( config) => {
314- let services = Services :: new ( & config) ;
315- let configure_command = ConfigureCommand :: new ( Arc :: clone ( & services. ansible_client ) ) ;
316-
317- match configure_command. execute ( ) . map_err ( anyhow:: Error :: from) {
318- Ok ( ( ) ) => {
319- info ! (
320- status = "complete" ,
321- "Container configuration completed successfully"
322- ) ;
323- }
324- Err ( e) => {
325- // Expected failure due to inventory mismatch - log and return error
326- info ! (
327- status = "expected_failure" ,
328- error = %e,
329- note = "ConfigureCommand failed as expected - needs container-specific inventory"
330- ) ;
331- return Err ( e. context (
332- "Configuration failed (expected - needs container-specific inventory)" ,
333- ) ) ;
334- }
335- }
311+ let config = create_container_config ( ) . context ( "Failed to create container configuration" ) ?;
312+
313+ let services = Services :: new ( & config) ;
314+ let configure_command = ConfigureCommand :: new ( Arc :: clone ( & services. ansible_client ) ) ;
315+
316+ match configure_command. execute ( ) . map_err ( anyhow:: Error :: from) {
317+ Ok ( ( ) ) => {
318+ info ! (
319+ status = "complete" ,
320+ "Container configuration completed successfully"
321+ ) ;
336322 }
337323 Err ( e) => {
338- return Err ( e. context ( "Failed to create container configuration" ) ) ;
324+ // Expected failure due to inventory mismatch - log and return error
325+ info ! (
326+ status = "expected_failure" ,
327+ error = %e,
328+ note = "ConfigureCommand failed as expected - needs container-specific inventory"
329+ ) ;
330+ return Err (
331+ e. context ( "Configuration failed (expected - needs container-specific inventory)" )
332+ ) ;
339333 }
340334 }
341335
@@ -359,28 +353,15 @@ async fn run_deployment_validation(
359353 ) ;
360354
361355 // Now we can use the proper SSH infrastructure with custom port support
362- let credentials_result = create_container_ssh_credentials ( ) ;
363- match credentials_result {
364- Ok ( ssh_credentials) => {
365- // Create SSH connection with the container's dynamic port
366- match validate_container_deployment_with_port ( & ssh_credentials, socket_addr) . await {
367- Ok ( ( ) ) => {
368- info ! ( status = "success" , "All deployment validations passed" ) ;
369- }
370- Err ( e) => {
371- info ! (
372- status = "failed" ,
373- error = %e,
374- "Container deployment validation failed"
375- ) ;
376- return Err ( e. context ( "Container deployment validation failed" ) ) ;
377- }
378- }
379- }
380- Err ( e) => {
381- return Err ( e. context ( "Failed to create container SSH credentials" ) ) ;
382- }
383- }
356+ let ssh_credentials =
357+ create_container_ssh_credentials ( ) . context ( "Failed to create container SSH credentials" ) ?;
358+
359+ // Create SSH connection with the container's dynamic port
360+ validate_container_deployment_with_port ( & ssh_credentials, socket_addr)
361+ . await
362+ . context ( "Container deployment validation failed" ) ?;
363+
364+ info ! ( status = "success" , "All deployment validations passed" ) ;
384365
385366 info ! (
386367 status = "success" ,
0 commit comments