api: tape key restore: fix optional param handling and code refactoring

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht
2022-04-13 16:51:14 +02:00
parent ae60eed310
commit ede9dc0d1a
2 changed files with 19 additions and 27 deletions

View File

@ -620,11 +620,7 @@ fn write_media_label(
},
)]
/// Try to restore a tape encryption key
pub async fn restore_key(
drive: String,
password: String,
) -> Result<(), Error> {
pub async fn restore_key(drive: String, password: String) -> Result<(), Error> {
run_drive_blocking_task(drive.clone(), "restore key".to_string(), move |config| {
let mut drive = open_drive(&config, &drive)?;