From b5814a41422fb35aeea4ee4fd8024740cc9c7283 Mon Sep 17 00:00:00 2001 From: Christian Ebner Date: Mon, 25 Nov 2024 18:40:09 +0100 Subject: [PATCH] config: sync: use same config section type `sync` for push and pull Use `sync` as config section type string for both, sync jobs in push and pull direction, renaming the now combined config plugin to sync plugin. Commit bcd80bf9 ("api types/config: add `sync-push` config type for push sync jobs") introduced the additional config type with the intend to reduce possible misconfiguration. Partially revert this to use the same config type string again, since the misconfiguration can happen nevertheless (by editing the config type) and currently sync job configs are only listed partially when fetched via the config api endpoint. The filtering based on the additional api parameter is however retained. Signed-off-by: Christian Ebner Reviewed-by: Dominik Csapak Tested-by: Dominik Csapak --- pbs-config/src/sync.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/pbs-config/src/sync.rs b/pbs-config/src/sync.rs index 7fc977e7..10f528b5 100644 --- a/pbs-config/src/sync.rs +++ b/pbs-config/src/sync.rs @@ -6,7 +6,7 @@ use anyhow::Error; use proxmox_schema::{ApiType, Schema}; use proxmox_section_config::{SectionConfig, SectionConfigData, SectionConfigPlugin}; -use pbs_api_types::{SyncDirection, SyncJobConfig, JOB_ID_SCHEMA}; +use pbs_api_types::{SyncJobConfig, JOB_ID_SCHEMA}; use crate::{open_backup_lockfile, replace_backup_config, BackupLockGuard}; @@ -18,19 +18,10 @@ fn init() -> SectionConfig { _ => unreachable!(), }; - let pull_plugin = SectionConfigPlugin::new( - SyncDirection::Pull.as_config_type_str().to_string(), - Some(String::from("id")), - obj_schema, - ); - let push_plugin = SectionConfigPlugin::new( - SyncDirection::Push.as_config_type_str().to_string(), - Some(String::from("id")), - obj_schema, - ); + let sync_plugin = + SectionConfigPlugin::new("sync".to_string(), Some(String::from("id")), obj_schema); let mut config = SectionConfig::new(&JOB_ID_SCHEMA); - config.register_plugin(pull_plugin); - config.register_plugin(push_plugin); + config.register_plugin(sync_plugin); config }