[pbs-devel] [PATCH proxmox-backup] fix: api2: make tasks endpoint work with new prune job worker type
Stefan Sterz
s.sterz at proxmox.com
Wed Jul 13 16:36:29 CEST 2022
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 at 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
More information about the pbs-devel
mailing list