public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: [pve-devel] applied-series: [PATCH manager 1/2] fix #4351: vzdump: send mail if job-end hook fails with mailnotification=failure
Date: Wed, 16 Nov 2022 11:31:34 +0100	[thread overview]
Message-ID: <1668594678.ah8d7ocmsz.astroid@yuna.none> (raw)
In-Reply-To: <20221116083014.27457-1-f.ebner@proxmox.com>

thanks!

On November 16, 2022 9:30 am, Fiona Ebner wrote:
> Since all tasks succeeded, previously no mail was sent in that case.
> 
> Note that the error passed to $self->sendmail() is added to the
> subject of the mail if it is a single line or the beginning of the
> mail otherwise. Thus changing the mail slightly compared to previously
> for the case where the job-start hook fails and the case where the
> job-end hook fails with mailnotification=always. But can be considered
> an improvement, because the user sees the error right away.
> 
> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
> ---
>  PVE/VZDump.pm | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
> index d5b3c500..9ef3c7b4 100644
> --- a/PVE/VZDump.pm
> +++ b/PVE/VZDump.pm
> @@ -1305,10 +1305,14 @@ sub exec_backup {
>      my $totaltime = time() - $starttime;
>  
>      eval {
> +	# otherwise $self->sendmail() will interpret it as multiple problems
> +	my $chomped_err = $err;
> +	chomp($chomped_err) if $chomped_err;
> +
>  	$self->sendmail(
>  	    $tasklist,
>  	    $totaltime,
> -	    undef,
> +	    $chomped_err,
>  	    $self->{job_init_log} . $job_start_log,
>  	    $job_end_log,
>  	);
> -- 
> 2.30.2
> 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 
> 




      parent reply	other threads:[~2022-11-16 10:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16  8:30 [pve-devel] " Fiona Ebner
2022-11-16  8:30 ` [pve-devel] [PATCH manager 2/2] vzdump: send mail if job-abort hook fails Fiona Ebner
2022-11-16 10:31 ` Fabian Grünbichler [this message]

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=1668594678.ah8d7ocmsz.astroid@yuna.none \
    --to=f.gruenbichler@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