At this point, this value will definitely be set & valid and *should*
never be `None`. Still, better be safe than sorry and just unwrap_or()
with a sane default value instead.

Signed-off-by: Christoph Heiss <c.he...@proxmox.com>
---
 proxmox-auto-installer/src/utils.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/proxmox-auto-installer/src/utils.rs 
b/proxmox-auto-installer/src/utils.rs
index 1789fd8..655fecb 100644
--- a/proxmox-auto-installer/src/utils.rs
+++ b/proxmox-auto-installer/src/utils.rs
@@ -424,7 +424,11 @@ pub fn parse_answer(
 
         mngmt_nic: network_settings.ifname,
 
-        hostname: network_settings.fqdn.host().unwrap().to_string(),
+        hostname: network_settings
+            .fqdn
+            .host()
+            .unwrap_or(setup_info.config.product.default_hostname())
+            .to_string(),
         domain: network_settings.fqdn.domain(),
         cidr: network_settings.address,
         gateway: network_settings.gateway,
-- 
2.48.1



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to