From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pve-devel-bounces@lists.proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
	by lore.proxmox.com (Postfix) with ESMTPS id 542371FF18C
	for <inbox@lore.proxmox.com>; Mon, 24 Mar 2025 14:20:56 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 2F2941BD3C;
	Mon, 24 Mar 2025 14:20:51 +0100 (CET)
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Date: Mon, 24 Mar 2025 14:19:58 +0100
Message-ID: <20250324132000.770784-2-c.heiss@proxmox.com>
X-Mailer: git-send-email 2.48.1
MIME-Version: 1.0
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.029 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
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [config.pm]
Subject: [pve-devel] [PATCH installer] proxinstall: replace usage of hacky
 `mngmt_nic_id` config option
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>
Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

The option was more or less a hack from the beginning anyway, introduced
during the split of the GUI and the installation configuration.

The required information is already there from `mngmt_nic` - which
carries the name of the network interface - and is easily reused to
replace the functionality.

In short, the `mngmt_nic_id` setting was only used to check whether
another NIC was selected, avoiding needless updates to the IP address
and mask textboxes.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 Proxmox/Install/Config.pm | 6 ------
 proxinstall               | 9 ++++-----
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/Proxmox/Install/Config.pm b/Proxmox/Install/Config.pm
index b3a257e..0adb019 100644
--- a/Proxmox/Install/Config.pm
+++ b/Proxmox/Install/Config.pm
@@ -102,9 +102,6 @@ my sub init_cfg {
 
 	# network related
 	mngmt_nic => undef,
-	# FIXME: fix call sites and remove below, it's just an ugly relict of GTK GUI and time
-	# pressure on creating the single source of truth for installation config
-	mngmt_nic_id => undef,
 	hostname => undef,
 	domain => undef,
 	cidr => undef,
@@ -248,9 +245,6 @@ sub get_root_ssh_keys { return get('root_ssh_keys'); }
 sub set_mngmt_nic { set_key('mngmt_nic', $_[0]); }
 sub get_mngmt_nic { return get('mngmt_nic'); }
 
-sub set_mngmt_nic_id { set_key('mngmt_nic_id', $_[0]); }
-sub get_mngmt_nic_id { return get('mngmt_nic_id'); }
-
 sub set_hostname { set_key('hostname', $_[0]); }
 sub get_hostname { return get('hostname'); }
 
diff --git a/proxinstall b/proxinstall
index fe7e29f..9bbd2f9 100755
--- a/proxinstall
+++ b/proxinstall
@@ -377,11 +377,11 @@ sub create_ipconf_view {
 	my $current = shift;
 
 	my $new = $device_active_map->{$current->get_active()};
-	my $selected = Proxmox::Install::Config::get_mngmt_nic_id();
-	return if defined($selected) && $new eq $selected;
-
-	Proxmox::Install::Config::set_mngmt_nic_id($new);
 	my $iface = $ipconf->{ifaces}->{$new};
+
+	my $selected = Proxmox::Install::Config::get_mngmt_nic();
+	return if defined($selected) && $iface->{name} eq $selected;
+
 	Proxmox::Install::Config::set_mngmt_nic($iface->{name});
 	$ipconf_entry_addr->set_text($iface->{inet}->{addr} || $iface->{inet6}->{addr})
 	    if $iface->{inet}->{addr} || $iface->{inet6}->{addr};
@@ -414,7 +414,6 @@ sub create_ipconf_view {
 	$initial_active_device_pos = $device_active_reverse_map->{$nic};
     } elsif ($initial_active_device_pos >= 0) {
 	my $iface_id = $device_active_map->{$initial_active_device_pos};
-	Proxmox::Install::Config::set_mngmt_nic_id($iface_id);
 	my $iface = $ipconf->{ifaces}->{$iface_id};
 	Proxmox::Install::Config::set_mngmt_nic($iface->{name});
     }
-- 
2.48.1



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