vzdump: apt: notification: do not include domain in 'hostname' field

- The man page warns about the usage of `hostname -f`, since a host
   may have multiple domains (or none at all)
 - The fallback PVE::INotify::nodename() already only returned the
   hostname without the domain part
 - Fencing notifications didn't include the domain part anyway

This may result in soft-breakage for any users who have already relied
on the domain being present. If there is need for it, it could include
a fqdn metadata field.

The hostname property used for rendering the notification template
is unaffected for now.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
This commit is contained in:
Lukas Wagner 2024-06-10 10:40:25 +02:00 committed by Fabian Grünbichler
parent 431ae86b08
commit 2952bfe413
2 changed files with 6 additions and 5 deletions

View File

@ -348,7 +348,8 @@ __PACKAGE__->register_method({
# matchers.
my $metadata_fields = {
type => 'package-updates',
hostname => $hostname,
# Hostname (without domain part)
hostname => PVE::INotify::nodename(),
};
PVE::Notify::info(

View File

@ -516,10 +516,9 @@ sub send_notification {
"See Task History for details!\n";
};
my $hostname = get_hostname();
my $notification_props = {
"hostname" => $hostname,
# Hostname, might include domain part
"hostname" => get_hostname(),
"error-message" => $err,
"guest-table" => build_guest_table($tasklist),
"logs" => $text_log_part,
@ -533,7 +532,8 @@ sub send_notification {
# backup job id here... (I think pvescheduler would need
# to pass that to the vzdump call?)
type => "vzdump",
hostname => $hostname,
# Hostname (without domain part)
hostname => PVE::INotify::nodename(),
};
my $severity = $failed ? "error" : "info";