Skip to content

Commit

Permalink
Merge pull request #53 from tinythings/isbm-minion-debug-logging
Browse files Browse the repository at this point in the history
Add more debug logging for the minion initialisation
  • Loading branch information
isbm authored Dec 13, 2024
2 parents ad6fe26 + c0f2002 commit a612645
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions libsysinspect/src/cfg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ static _MINION_CFG: OnceCell<MinionConfig> = OnceCell::new();

/// Returns a copy of initialised traits.
pub fn get_minion_config(p: Option<&str>) -> Result<MinionConfig, SysinspectError> {
log::debug!("Getting minion config");
Ok(_MINION_CFG.get_or_try_init(|| MinionConfig::new(select_config_path(p)?))?.to_owned())
}
8 changes: 8 additions & 0 deletions sysminion/src/minion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ pub struct SysMinion {
impl SysMinion {
pub async fn new(cfp: &str, fingerprint: Option<String>) -> Result<Arc<SysMinion>, SysinspectError> {
let cfg = get_minion_config(Some(cfp))?;

log::debug!("Configuration: {:#?}", cfg);
log::debug!("Trying to connect at {}", cfg.master());

let (rstm, wstm) = TcpStream::connect(cfg.master()).await.unwrap().into_split();
log::debug!("Network bound at {}", cfg.master());
let instance = SysMinion {
cfg: cfg.clone(),
fingerprint,
Expand All @@ -47,8 +52,11 @@ impl SysMinion {
wstm: Arc::new(Mutex::new(wstm)),
filedata: Mutex::new(MinionFiledata::new(cfg.models_dir())?),
};
log::debug!("Instance set up with root directory at {}", cfg.root_dir().to_str().unwrap_or_default());
instance.init()?;

log::debug!("Initialisation done");

Ok(Arc::new(instance))
}

Expand Down
3 changes: 3 additions & 0 deletions sysminion/src/rsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ impl MinionRSAKeyManager {
}

self.mn_pbk_pem = pbk_pem.to_owned().unwrap();

log::info!("Writing public keys to {:?}", pbk_pth.parent());

fs::write(prk_pth, prk_pem.unwrap())?;
fs::write(pbk_pth, pbk_pem.unwrap())?;

Expand Down

0 comments on commit a612645

Please sign in to comment.