all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Sterz <s.sterz@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] fix: api2: make tasks endpoint work with new prune job worker type
Date: Wed, 13 Jul 2022 16:36:29 +0200	[thread overview]
Message-ID: <20220713143629.459837-1-s.sterz@proxmox.com> (raw)

when prune jobs were refactored, their worker type was changed from
"prune" to "prunejob" this broke `check_job_store` and
`check_job_privs`

as reported in the forum: https://forum.proxmox.com/threads/problem-with-apirequest-on-pbs-2-2-3.112131/#post-483835

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
---
afaict: we can't just remove the "prune" branches here, because there
are tasks that will still use this worker id. e.g. prune tasks created
by the `POST /api2/json/admin/datastore/{store}/prune-datastore` 
endpoint

 src/api2/node/tasks.rs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/api2/node/tasks.rs b/src/api2/node/tasks.rs
index 592e927d..cbd0894e 100644
--- a/src/api2/node/tasks.rs
+++ b/src/api2/node/tasks.rs
@@ -64,7 +64,7 @@ fn check_job_privs(auth_id: &Authid, user_info: &CachedUserInfo, upid: &UPID) ->
                 true,
             )
         }
-        ("prune", Some(workerid)) => {
+        ("prune", Some(workerid)) | ("prunejob", Some(workerid)) => {
             let mut acl_path = vec!["datastore"];
             acl_path.extend(workerid.split(':'));
             let acl_path = match acl_path.len() {
@@ -103,6 +103,7 @@ fn check_job_store(upid: &UPID, store: &str) -> bool {
             }
         }
         ("prune", Some(workerid))
+        | ("prunejob", Some(workerid))
         | ("backup", Some(workerid))
         | ("garbage_collection", Some(workerid)) => {
             return workerid == store || workerid.starts_with(&format!("{}:", store));
-- 
2.30.2





             reply	other threads:[~2022-07-13 14:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 14:36 Stefan Sterz [this message]
2022-07-14 12:46 ` [pbs-devel] applied: " Fabian Grünbichler

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=20220713143629.459837-1-s.sterz@proxmox.com \
    --to=s.sterz@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 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