Skip to content

Commit bfc4ac7

Browse files
authored
chore: Absent state file is not a warning (#315)
User is not expected to do anything when the auth cache file is absent or cannot be opened. Because of that it makes no sense to log this as warning.
1 parent 6792561 commit bfc4ac7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

openstack_sdk/src/state.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::collections::HashMap;
2323
use std::fs::{DirBuilder, File};
2424
use std::io::prelude::*;
2525
use std::path::PathBuf;
26-
use tracing::{trace, warn};
26+
use tracing::{debug, info, trace, warn};
2727

2828
use crate::auth::{
2929
authtoken::{AuthToken, AuthTokenScope},
@@ -244,7 +244,7 @@ impl State {
244244
Some(auth)
245245
}
246246
Err(x) => {
247-
warn!(
247+
info!(
248248
"Corrupted cache file {}: {:?}. Removing ",
249249
fname.display(),
250250
x
@@ -254,13 +254,17 @@ impl State {
254254
}
255255
},
256256
_ => {
257-
warn!("Error reading file {}", fname.display());
257+
// Not able to read file, maybe it is corrupted. There is nothing user can
258+
// or is expected to do about it, but it make sense to make user aware of.
259+
info!("Error reading file {}", fname.display());
258260
None
259261
}
260262
}
261263
}
262264
_ => {
263-
warn!("Error opening file {}", fname.display());
265+
// Not able to open file, maybe it is missing. There is nothing user can or is
266+
// expected to do about it.
267+
debug!("Error opening file {}", fname.display());
264268
None
265269
}
266270
}

0 commit comments

Comments
 (0)