From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: "Max R. Carrara" <m.carrara@proxmox.com>
Cc: pmg-devel@lists.proxmox.com
Subject: Re: [pmg-devel] [PATCH pmg-api master v1] config: silence ENOENT when comparing SMTP filter config
Date: Mon, 22 Sep 2025 23:51:20 +0200 [thread overview]
Message-ID: <20250922235120.1966c3b8@rosa.proxmox.com> (raw)
In-Reply-To: <20250922152518.550638-1-m.carrara@proxmox.com>
works as advertised - still one question inline:
On Mon, 22 Sep 2025 17:24:57 +0200
"Max R. Carrara" <m.carrara@proxmox.com> wrote:
> If `/run/pmg-smtp-filter.cfg` doesn't yet exist when `pmgsync.service`
> runs, a "No such file or directory" warning is logged. While this has
> been around since a while [0], the warning might look suspicious to
> some (as it did to me during testing).
>
> Therefore, handle ENOENT separately without emitting any warnings.
>
> [0]: https://git.proxmox.com/?p=pmg-api.git;a=commitdiff;h=e5b31a6178118981e784b225941f1502ba644ee5
>
> Signed-off-by: Max R. Carrara <m.carrara@proxmox.com>
> ---
> src/PMG/Config.pm | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/src/PMG/Config.pm b/src/PMG/Config.pm
> index 44e5463..46e8aa2 100644
> --- a/src/PMG/Config.pm
> +++ b/src/PMG/Config.pm
> @@ -1909,7 +1909,9 @@ sub compare_smtp_filter_config {
> my $old;
> eval { $old = PVE::Tools::file_get_contents($smtp_filter_cfg); };
>
> - if (my $err = $@) {
> + if ($!{ENOENT}) {
> + $ret = 1;
> + } elsif (my $err = $@) {
> syslog('warning', "reloading pmg-smtp-filter: $err");
why not simply replace the line above with:
`syslog('warning', "reloading pmg-smtp-filter: $err") if ! $!{ENOENT};`
(this would seem a bit more readable to me - but maybe I'm missing
something)
> $ret = 1;
> } else {
_______________________________________________
pmg-devel mailing list
pmg-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pmg-devel
prev parent reply other threads:[~2025-09-22 21:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-22 15:24 Max R. Carrara
2025-09-22 21:51 ` Stoiko Ivanov [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=20250922235120.1966c3b8@rosa.proxmox.com \
--to=s.ivanov@proxmox.com \
--cc=m.carrara@proxmox.com \
--cc=pmg-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.