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:
parent
9381232604
commit
09b1f1f77c
|
|
@ -241,10 +241,14 @@ fn load_credential(id_suffix: &str) -> Option<PathBuf> {
|
||||||
|
|
||||||
let id_xyz = format!("{}{}{}", PREFIX_XYZ, INFIX_NODE, id_suffix);
|
let id_xyz = format!("{}{}{}", PREFIX_XYZ, INFIX_NODE, id_suffix);
|
||||||
match radicle_systemd::credential::path(&id_xyz) {
|
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}'.");
|
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
|
option
|
||||||
}
|
}
|
||||||
|
Ok(None) => {
|
||||||
|
// No credential found with either ID.
|
||||||
|
None
|
||||||
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
log::warn!(target: "node", "Failed to obtain path of the systemd credential with ID '{id_xyz}': {err}");
|
log::warn!(target: "node", "Failed to obtain path of the systemd credential with ID '{id_xyz}': {err}");
|
||||||
None
|
None
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue