public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH v2 cluster 3/4] pvecm: updatecerts: silence warning that potentially has no context
Date: Fri, 30 Jun 2023 13:49:22 +0200	[thread overview]
Message-ID: <20230630114923.65506-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20230630114923.65506-1-f.ebner@proxmox.com>

If timeout is reached, run_fork_with_timeout will warn "got timeout".
When processing triggers for pve-manager (because of ExecStartPre of
pveproxy.service invoking pvecm updatecerts) that warning can appear
in the apt output without any context (output of the forked sub
doesn't appear there). So make sure to silence it, if the silent param
is set.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

New in v2.

Can't use a normal if here, because of the 'local'.

 src/PVE/CLI/pvecm.pm | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/PVE/CLI/pvecm.pm b/src/PVE/CLI/pvecm.pm
index a0550c2..2cdc2cd 100755
--- a/src/PVE/CLI/pvecm.pm
+++ b/src/PVE/CLI/pvecm.pm
@@ -574,6 +574,17 @@ __PACKAGE__->register_method ({
     code => sub {
 	my ($param) = @_;
 
+	# If timeout is reached, run_fork_with_timeout will warn "got timeout". When processing
+	# triggers for pve-manager (because of ExecStartPre of pveproxy.service invoking this
+	# command here) that warning can appear in the apt output without any context (output of the
+	# forked sub doesn't appear there). So make sure to silence it, if the silent param is set.
+	my $filter_timeout_warning = sub {
+	    my ($msg) = @_;
+	    return if $msg =~ m/^got timeout/;
+	    print STDERR $msg;
+	};
+	local $SIG{__WARN__} = $filter_timeout_warning if $param->{silent};
+
 	# we get called by the pveproxy.service ExecStartPre and as we do
 	# IO (on /etc/pve) which can hang (uninterruptedly D state). That'd be
 	# no-good for ExecStartPre as it fails the whole service in this case
-- 
2.39.2





  parent reply	other threads:[~2023-06-30 11:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-30 11:49 [pve-devel] [PATCH v2 cluster 1/4] setup: split generation of local (i.e. non-pmxcfs) files out into helper Fiona Ebner
2023-06-30 11:49 ` [pve-devel] [PATCH v2 cluster 2/4] pvecm: updatecerts: allow specifying time to wait for quorum via CLI argument Fiona Ebner
2023-06-30 11:55   ` Fiona Ebner
2023-06-30 11:49 ` Fiona Ebner [this message]
2023-06-30 11:49 ` [pve-devel] [PATCH v2 cluster 4/4] fix typo Fiona 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=20230630114923.65506-3-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