[pve-devel] [PATCH v2 cluster 3/4] pvecm: updatecerts: silence warning that potentially has no context
Fiona Ebner
f.ebner at proxmox.com
Fri Jun 30 13:49:22 CEST 2023
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 at 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
More information about the pve-devel
mailing list