From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id F313A8466
 for <pve-devel@lists.proxmox.com>; Wed, 21 Jun 2023 14:30:33 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id D41C61D14B
 for <pve-devel@lists.proxmox.com>; Wed, 21 Jun 2023 14:30:33 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pve-devel@lists.proxmox.com>; Wed, 21 Jun 2023 14:30:33 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 2D2034229B
 for <pve-devel@lists.proxmox.com>; Wed, 21 Jun 2023 14:30:33 +0200 (CEST)
From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Wed, 21 Jun 2023 14:30:31 +0200
Message-Id: <20230621123032.744374-1-d.csapak@proxmox.com>
X-Mailer: git-send-email 2.30.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.016 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 T_SCC_BODY_TEXT_LINE    -0.01 -
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [main.rs, options.rs]
Subject: [pve-devel] [PATCH 1/2] tui: always use mail@example.invalid as
 default email address
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 21 Jun 2023 12:30:34 -0000

like the gui installer

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 proxmox-tui-installer/src/main.rs    |  2 +-
 proxmox-tui-installer/src/options.rs | 14 +++-----------
 2 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs
index 90da81d..77cfb63 100644
--- a/proxmox-tui-installer/src/main.rs
+++ b/proxmox-tui-installer/src/main.rs
@@ -179,7 +179,7 @@ fn main() {
         options: InstallerOptions {
             bootdisk: BootdiskOptions::defaults_from(&runtime_info.disks[0]),
             timezone: TimezoneOptions::defaults_from(&runtime_info, &locales),
-            password: PasswordOptions::defaults_from(&runtime_info),
+            password: Default::default(),
             network: NetworkOptions::from(&runtime_info.network),
             autoreboot: false,
         },
diff --git a/proxmox-tui-installer/src/options.rs b/proxmox-tui-installer/src/options.rs
index 6855f4a..5f3d295 100644
--- a/proxmox-tui-installer/src/options.rs
+++ b/proxmox-tui-installer/src/options.rs
@@ -306,18 +306,10 @@ pub struct PasswordOptions {
     pub root_password: String,
 }
 
-impl PasswordOptions {
-    pub fn defaults_from(info: &RuntimeInfo) -> Self {
-        let domain = info
-            .network
-            .dns
-            .domain
-            .clone()
-            // Safety: The provided default domain will always be valid.
-            .unwrap_or_else(|| Fqdn::from("example.invalid").unwrap());
-
+impl Default for PasswordOptions {
+    fn default() -> Self {
         Self {
-            email: format!("mail@{domain}"),
+            email: "mail@example.invalid".to_string(),
             root_password: String::new(),
         }
     }
-- 
2.30.2