client: show key path when creating/changing default key

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2020-07-10 09:57:55 +02:00
parent e39974afbf
commit 0eaef8eb84
1 changed files with 13 additions and 3 deletions

View File

@ -99,7 +99,11 @@ impl Default for Kdf {
fn create(kdf: Option<Kdf>, path: Option<String>) -> Result<(), Error> { fn create(kdf: Option<Kdf>, path: Option<String>) -> Result<(), Error> {
let path = match path { let path = match path {
Some(path) => PathBuf::from(path), Some(path) => PathBuf::from(path),
None => place_default_encryption_key()?, None => {
let path = place_default_encryption_key()?;
println!("creating default key at: {:?}", path);
path
}
}; };
let kdf = kdf.unwrap_or_default(); let kdf = kdf.unwrap_or_default();
@ -156,8 +160,14 @@ fn create(kdf: Option<Kdf>, path: Option<String>) -> Result<(), Error> {
fn change_passphrase(kdf: Option<Kdf>, path: Option<String>) -> Result<(), Error> { fn change_passphrase(kdf: Option<Kdf>, path: Option<String>) -> Result<(), Error> {
let path = match path { let path = match path {
Some(path) => PathBuf::from(path), Some(path) => PathBuf::from(path),
None => find_default_encryption_key()? None => {
.ok_or_else(|| format_err!("no encryption file provided and no default file found"))?, let path = find_default_encryption_key()?
.ok_or_else(|| {
format_err!("no encryption file provided and no default file found")
})?;
println!("updating default key at: {:?}", path);
path
}
}; };
let kdf = kdf.unwrap_or_default(); let kdf = kdf.unwrap_or_default();