public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH manager 2/2] fix #3955: vzdump: new: also send mail for error during job-init hook
Date: Tue, 19 Apr 2022 10:45:22 +0200	[thread overview]
Message-ID: <20220419084522.17916-2-f.ebner@proxmox.com> (raw)
In-Reply-To: <20220419084522.17916-1-f.ebner@proxmox.com>

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 PVE/VZDump.pm | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index bdf270f7..3a394db7 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -497,13 +497,6 @@ sub new {
 	$opts->{storage} = 'local';
     }
 
-    $self->{job_init_log} = '';
-    open my $job_init_fd, '>', \$self->{job_init_log};
-    $self->run_hook_script('job-init', undef, $job_init_fd);
-    close $job_init_fd;
-
-    PVE::Cluster::cfs_update(); # Pick up possible changes made by the hook script.
-
     my $errors = '';
     my $add_error = sub {
 	my ($error) = @_;
@@ -512,6 +505,16 @@ sub new {
 	$errors .= $error;
     };
 
+    eval {
+	$self->{job_init_log} = '';
+	open my $job_init_fd, '>', \$self->{job_init_log};
+	$self->run_hook_script('job-init', undef, $job_init_fd);
+	close $job_init_fd;
+
+	PVE::Cluster::cfs_update(); # Pick up possible changes made by the hook script.
+    };
+    $add_error->($@) if $@;
+
     if ($opts->{storage}) {
 	my $storage_cfg = PVE::Storage::config();
 	eval { PVE::Storage::activate_storage($storage_cfg, $opts->{storage}) };
-- 
2.30.2





  reply	other threads:[~2022-04-19  8:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19  8:45 [pve-devel] [PATCH manager 1/2] vzdump: new: add add_error helper Fabian Ebner
2022-04-19  8:45 ` Fabian Ebner [this message]
2022-04-27  8:38 ` [pve-devel] applied-series: " Thomas Lamprecht

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=20220419084522.17916-2-f.ebner@proxmox.com \
    --to=f.ebner@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