proxmox-tape: api: restore_key-code moved to tape-encryption-keys
The restore_key api-endpoint is tape/drive/{drive}/restore-key. Since I cannot set the url parameter for the drivename to null or undefined, when restoring by exported-key, I moved the added restore_key-api-code to "create_key aka POST api2/json/config/tape-encryption-keys" and added an ApiHandler call in the cli's "restore_key" to call "create_key" in the api. Signed-off-by: Markus Frank <m.frank@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
e3746a329e
commit
ae60eed310
@ -247,12 +247,19 @@ async fn restore_key(
|
||||
|
||||
let password = tty::read_password("Tape Encryption Key Password: ")?;
|
||||
param["password"] = String::from_utf8(password)?.into();
|
||||
|
||||
let info = &api2::tape::drive::API_METHOD_RESTORE_KEY;
|
||||
match info.handler {
|
||||
ApiHandler::Async(handler) => (handler)(param, info, rpcenv).await?,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
if drive_passed {
|
||||
let info = &api2::tape::drive::API_METHOD_RESTORE_KEY;
|
||||
match info.handler {
|
||||
ApiHandler::Async(handler) => (handler)(param, info, rpcenv).await?,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
} else {
|
||||
let info = &api2::config::tape_encryption_keys::API_METHOD_CREATE_KEY;
|
||||
match info.handler {
|
||||
ApiHandler::Sync(handler) => (handler)(param, info, rpcenv)?,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user