public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/4] config: sync: use same config section type `sync` for push and pull
Date: Mon, 25 Nov 2024 18:40:09 +0100	[thread overview]
Message-ID: <20241125174012.678523-2-c.ebner@proxmox.com> (raw)
In-Reply-To: <20241125174012.678523-1-c.ebner@proxmox.com>

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 <c.ebner@proxmox.com>
---
 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 7fc977e77..10f528b5e 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
 }
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


  reply	other threads:[~2024-11-25 17:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-25 17:40 [pbs-devel] [PATCH proxmox-backup 0/4] use same config section type for all sync jobs Christian Ebner
2024-11-25 17:40 ` Christian Ebner [this message]
2024-11-25 17:40 ` [pbs-devel] [PATCH proxmox-backup 2/4] api: admin/config: introduce sync direction as job config parameter Christian Ebner
2024-11-25 17:40 ` [pbs-devel] [PATCH proxmox-backup 3/4] bin: show direction in sync job list output Christian Ebner
2024-11-25 17:40 ` [pbs-devel] [PATCH proxmox-backup 4/4] api types: drop unused config type helpers for sync direction Christian Ebner
2024-11-26  9:20 ` [pbs-devel] [PATCH proxmox-backup] (List)SyncDirection: extract match check into impl fn Fabian Grünbichler
2024-11-26  9:21 ` [pbs-devel] [PATCH proxmox-backup 0/4] use same config section type for all sync jobs Fabian Grünbichler
2024-11-26 14:47 ` [pbs-devel] [PATCH proxmox-backup] sync jobs: remove superfluous direction property Dominik Csapak
2024-11-26 14:50 ` [pbs-devel] [PATCH proxmox-backup 0/4] use same config section type for all sync jobs Dominik Csapak
2024-11-26 15:04 ` [pbs-devel] applied-series: " Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241125174012.678523-2-c.ebner@proxmox.com \
    --to=c.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal