all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager 1/4] api: views: return config digest when retrieving views
Date: Fri, 10 Apr 2026 16:01:16 +0200	[thread overview]
Message-ID: <20260410140119.338714-2-l.wagner@proxmox.com> (raw)
In-Reply-To: <20260410140119.338714-1-l.wagner@proxmox.com>

This allows us to verify it later when PUTing a view config.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
 server/src/api/config/views.rs | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/server/src/api/config/views.rs b/server/src/api/config/views.rs
index 6f187eb3..731f2a42 100644
--- a/server/src/api/config/views.rs
+++ b/server/src/api/config/views.rs
@@ -38,7 +38,7 @@ pub const ROUTER: Router = Router::new()
 )]
 /// List views.
 pub fn get_views(rpcenv: &mut dyn RpcEnvironment) -> Result<Vec<ViewConfig>, Error> {
-    let (config, _) = pdm_config::views::config()?;
+    let (config, config_digest) = pdm_config::views::config()?;
 
     let user_info = CachedUserInfo::new()?;
     let auth_id = rpcenv
@@ -65,6 +65,8 @@ pub fn get_views(rpcenv: &mut dyn RpcEnvironment) -> Result<Vec<ViewConfig>, Err
         })
         .collect();
 
+    rpcenv["digest"] = config_digest.to_hex().into();
+
     Ok(views)
 }
 
@@ -263,8 +265,8 @@ pub fn remove_view(id: String, digest: Option<ConfigDigest>) -> Result<(), Error
     returns: { type: ViewConfig },
 )]
 /// Get the config of a single view.
-pub fn read_view(id: String) -> Result<ViewConfig, Error> {
-    let (config, _) = pdm_config::views::config()?;
+pub fn read_view(id: String, rpcenv: &mut dyn RpcEnvironment) -> Result<ViewConfig, Error> {
+    let (config, config_digest) = pdm_config::views::config()?;
 
     let view = config
         .get(&id)
@@ -274,5 +276,7 @@ pub fn read_view(id: String) -> Result<ViewConfig, Error> {
         ViewConfigEntry::View(view) => view.clone(),
     };
 
+    rpcenv["digest"] = config_digest.to_hex().into();
+
     Ok(view)
 }
-- 
2.47.3





  reply	other threads:[~2026-04-10 14:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 14:01 [PATCH datacenter-manager 0/4] views: verify digest, schema improvements Lukas Wagner
2026-04-10 14:01 ` Lukas Wagner [this message]
2026-04-10 14:01 ` [PATCH datacenter-manager 2/4] ui: views: submit config digest when updating a view Lukas Wagner
2026-04-10 14:01 ` [PATCH datacenter-manager 3/4] api: views: run API handlers in proxy process Lukas Wagner
2026-04-10 14:01 ` [PATCH datacenter-manager 4/4] api: views: improve API schema definitions Lukas Wagner

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=20260410140119.338714-2-l.wagner@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pdm-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal