From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 55C8A1FF09F for ; Thu, 03 Sep 2026 10:40:44 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 8700A2156E; Thu, 03 Sep 2026 10:40:43 +0200 (CEST) Content-Type: text/plain; charset=UTF-8 Date: Thu, 03 Sep 2026 10:40:40 +0200 Message-Id: To: "Dominik Csapak" , Subject: Re: [PATCH guest-common v4 1/7] helpers: exec hookscript: add optional parameters From: "Elias Huhsovitz" Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 X-Mailer: aerc 0.20.0 References: <20260825135502.3971930-1-d.csapak@proxmox.com> <20260825135502.3971930-2-d.csapak@proxmox.com> In-Reply-To: <20260825135502.3971930-2-d.csapak@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1788424837896 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.701 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: K3C4N5EAR4CVPMZ3GLVHPP4Y2QVKAVBQ X-Message-ID-Hash: K3C4N5EAR4CVPMZ3GLVHPP4Y2QVKAVBQ X-MailFrom: e.huhsovitz@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Good change. 1 small nit inline. On Tue Aug 25, 2026 at 3:54 PM CEST, Dominik Csapak wrote: [...] > =20 > sub exec_hookscript { > - my ($conf, $vmid, $phase, $stop_on_error) =3D @_; > + my ($conf, $vmid, $phase, $stop_on_error, $params) =3D @_; > =20 > return if !$conf->{hookscript}; > =20 > + $params //=3D {}; > + > eval { > my $hookscript =3D check_hookscript($conf->{hookscript}); > die $@ if $@; > =20 > + # copy EVN before adding to it nit: I would prefer a comment that explains why we need this line instead of what it does. e.g. something like # do not clear global ENV: hookscript keeps inherited ENV > + local %ENV =3D (%ENV); > + > + for my $key (keys $params->%*) { > + my $new_key =3D "PVE_HOOK_" . uc($key); > + $ENV{$new_key} =3D $params->{$key}; > + } > + > PVE::Tools::run_command([$hookscript, $vmid, $phase]); > }; > if (my $err =3D $@) {