public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] fix: api2: make tasks endpoint work with new prune job worker type
@ 2022-07-13 14:36 Stefan Sterz
  2022-07-14 12:46 ` [pbs-devel] applied: " Fabian Grünbichler
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Sterz @ 2022-07-13 14:36 UTC (permalink / raw)
  To: pbs-devel

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pbs-devel] applied: [PATCH proxmox-backup] fix: api2: make tasks endpoint work with new prune job worker type
  2022-07-13 14:36 [pbs-devel] [PATCH proxmox-backup] fix: api2: make tasks endpoint work with new prune job worker type Stefan Sterz
@ 2022-07-14 12:46 ` Fabian Grünbichler
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2022-07-14 12:46 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion

thanks!

On July 13, 2022 4:36 pm, Stefan Sterz wrote:
> 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
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-14 12:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-13 14:36 [pbs-devel] [PATCH proxmox-backup] fix: api2: make tasks endpoint work with new prune job worker type Stefan Sterz
2022-07-14 12:46 ` [pbs-devel] applied: " Fabian Grünbichler

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