fix(load-balancer): implement missing HAProxy reload and sanitize output handling

Implement the `reload_restart` method in `LoadBalancerConfig` to ensure proper HAProxy configuration management. Additionally, enhance SSH command execution by sanitizing and logging outputs effectively. This ensures robust handling of HAProxy configurations and improves debugging capabilities through trace-level logs.
This commit is contained in:
jeangab
2025-01-08 16:30:56 -05:00
parent a55c63ffa6
commit 0af8e7e6a8
7 changed files with 56 additions and 23 deletions

View File

@@ -6,7 +6,7 @@ use std::{
use tokio_stream::StreamExt;
use async_trait::async_trait;
use log::{debug, info};
use log::{debug, info, trace};
use russh::{
client::{Config, Handler, Msg},
Channel,
@@ -205,5 +205,7 @@ async fn wait_for_completion(channel: &mut Channel<Msg>) -> Result<String, Error
}
}
Ok(String::from_utf8(output).unwrap_or_default())
let output = String::from_utf8(output).expect("Output should be UTF-8 compatible");
trace!("{output}");
Ok(output)
}