node: Fix handling absence of systemd credential

In case `radicle_systemd::credential::path` returns `Ok(None)`, a
misleading warning is logged.

Handle this case separately and do not emit a warning.
This commit is contained in:
Lorenz Leutgeb 2026-05-20 09:33:38 +02:00
parent 9381232604
commit 09b1f1f77c
No known key found for this signature in database
1 changed files with 5 additions and 1 deletions

View File

@ -241,10 +241,14 @@ fn load_credential(id_suffix: &str) -> Option<PathBuf> {
let id_xyz = format!("{}{}{}", PREFIX_XYZ, INFIX_NODE, id_suffix);
match radicle_systemd::credential::path(&id_xyz) {
Ok(option) => {
Ok(option @ Some(_)) => {
log::warn!(target: "node", "Obtained path of the systemd credential with ID '{id_xyz}'. Using this credential ID is discouraged. Please change the ID to '{id_dev}'.");
option
}
Ok(None) => {
// No credential found with either ID.
None
}
Err(err) => {
log::warn!(target: "node", "Failed to obtain path of the systemd credential with ID '{id_xyz}': {err}");
None