public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Oguz Bektas <o.bektas@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH common 2/2] REST environment: default to 'root@pam' for forked workers in case no user was specified
Date: Mon,  7 Mar 2022 10:20:43 +0100	[thread overview]
Message-ID: <20220307092043.571640-2-o.bektas@proxmox.com> (raw)
In-Reply-To: <20220307092043.571640-1-o.bektas@proxmox.com>

previously we had a default of 'root@pve', which doesn't exist.
since the username is only relevant for the task logs, we can change it
to 'root@pam' without ill effects.

also add a warning in case there are other call sites that we missed
where fork_worker is called without a user variable (found call sites
only in pve-container where this was unset, namely in 'push_file' and
'pull_file').

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
---
 src/PVE/RESTEnvironment.pm | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/PVE/RESTEnvironment.pm b/src/PVE/RESTEnvironment.pm
index 1b2af08..5352aad 100644
--- a/src/PVE/RESTEnvironment.pm
+++ b/src/PVE/RESTEnvironment.pm
@@ -492,7 +492,10 @@ sub fork_worker {
     $dtype = 'unknown' if !defined ($dtype);
     $id = '' if !defined ($id);
 
-    $user = 'root@pve' if !defined ($user);
+    if (!defined($user)) {
+	warn 'Worker user was not specified, defaulting to "root@pam"!';
+	$user = 'root@pam';
+    }
 
     my $sync = ($self->{type} eq 'cli' && !$background) ? 1 : 0;
 
-- 
2.30.2





  reply	other threads:[~2022-03-07  9:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-07  9:20 [pve-devel] [PATCH pve-container 1/2] pct: set worker user for pull_file/push_file calls Oguz Bektas
2022-03-07  9:20 ` Oguz Bektas [this message]
2022-03-10 12:01   ` [pve-devel] [PATCH common 2/2] REST environment: default to 'root@pam' for forked workers in case no user was specified Fabian Ebner
2022-03-11  8:00     ` Fabian Ebner

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=20220307092043.571640-2-o.bektas@proxmox.com \
    --to=o.bektas@proxmox.com \
    --cc=pve-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