without this patch the hostname ends up as the empty string in
run-env-info.json, which results in a parse-error in the TUI code
(an empty string is not None, but still too short as hostname)
Minimally tested on a VM.
Fixes: bda1cdf ("run env: retrieve and store hostname from DHCP lease
if available")
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
};
# Cannot be put directly in the above hash as it might return undef ..
- $output->{network}->{hostname} = Proxmox::Sys::Net::get_dhcp_hostname();
+ if ( my $hostname = Proxmox::Sys::Net::get_dhcp_hostname()) {
+ $output->{network}->{hostname} = $hostname;
+ }
# FIXME: move whatever makes sense over to Proxmox::Sys::Net:: and keep that as single source,
# it can then use some different structure just fine (after adapting the GTK GUI to that) but
}
close($fh);
- return $1 if defined($name) && $name =~ m/^([^\.]+)(?:\.(?:\S+))?$/;
+ return $name if defined($name) && $name =~ m/^([^\.]+)(?:\.(?:\S+))?$/;
}
1;