]> git.proxmox.com Git - pve-manager.git/commitdiff
vzdump: apt: notification: do not include domain in 'hostname' field
authorLukas Wagner <l.wagner@proxmox.com>
Mon, 10 Jun 2024 08:40:25 +0000 (10:40 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 4 Jul 2024 12:57:08 +0000 (14:57 +0200)
 - 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>
PVE/API2/APT.pm
PVE/VZDump.pm

index ec7c21b2f1602251adc9aff7ca024e250e212c72..47c509619ea3cdd49b9cac04e516bbc04e5d41c1 100644 (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(
index 33e08f9ec16b03ccbf3563f33f2383f7d29c3a3b..8dbcc4a922a26cb4ddb261a17d43f64c07b2e464 100644 (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";