api2/config/tape_backup_job: fix duplicate id parameter
since the PUT api call is using the 'Updater', the 'id' parameter is already encoded in there, tripping up the api verify tests with 'Duplicate keys found in AllOf schema: id' "fixing" it by removing the explicit id from the api call and taking it from the Updater (and failing if it does not exists there; even though that should never happen) Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
875d375d7a
commit
52d8db7925
|
@ -1,4 +1,4 @@
|
||||||
use anyhow::{bail, Error};
|
use anyhow::{bail, format_err, Error};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
use ::serde::{Deserialize, Serialize};
|
use ::serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
@ -123,9 +123,6 @@ pub enum DeletableProperty {
|
||||||
protected: true,
|
protected: true,
|
||||||
input: {
|
input: {
|
||||||
properties: {
|
properties: {
|
||||||
id: {
|
|
||||||
schema: JOB_ID_SCHEMA,
|
|
||||||
},
|
|
||||||
update: {
|
update: {
|
||||||
flatten: true,
|
flatten: true,
|
||||||
type: TapeBackupJobConfigUpdater,
|
type: TapeBackupJobConfigUpdater,
|
||||||
|
@ -147,13 +144,14 @@ pub enum DeletableProperty {
|
||||||
)]
|
)]
|
||||||
/// Update the tape backup job
|
/// Update the tape backup job
|
||||||
pub fn update_tape_backup_job(
|
pub fn update_tape_backup_job(
|
||||||
id: String,
|
mut update: TapeBackupJobConfigUpdater,
|
||||||
update: TapeBackupJobConfigUpdater,
|
|
||||||
delete: Option<Vec<String>>,
|
delete: Option<Vec<String>>,
|
||||||
digest: Option<String>,
|
digest: Option<String>,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let _lock = open_file_locked(TAPE_JOB_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?;
|
let _lock = open_file_locked(TAPE_JOB_CFG_LOCKFILE, std::time::Duration::new(10, 0), true)?;
|
||||||
|
|
||||||
|
let id = update.id.take().ok_or_else(|| format_err!("no id given"))?;
|
||||||
|
|
||||||
let (mut config, expected_digest) = config::tape_job::config()?;
|
let (mut config, expected_digest) = config::tape_job::config()?;
|
||||||
|
|
||||||
let mut job: TapeBackupJobConfig = config.lookup("backup", &id)?;
|
let mut job: TapeBackupJobConfig = config.lookup("backup", &id)?;
|
||||||
|
|
Loading…
Reference in New Issue