From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 690D7904ED for ; Tue, 2 Apr 2024 13:08:14 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4221B43E6 for ; Tue, 2 Apr 2024 13:08:14 +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 ; Tue, 2 Apr 2024 13:08:13 +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 5A295449FA for ; Tue, 2 Apr 2024 13:08:13 +0200 (CEST) From: Stefan Lendl To: pve-devel@lists.proxmox.com Date: Tue, 2 Apr 2024 13:07:39 +0200 Message-ID: <20240402110740.291710-5-s.lendl@proxmox.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240402110740.291710-3-s.lendl@proxmox.com> References: <20240402110740.291710-3-s.lendl@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.025 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 Subject: [pve-devel] [PATCH v3 pve-network 2/5] evpn: extract read_local_frr_config X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Apr 2024 11:08:14 -0000 to allow mocking local fs access Signed-off-by: Stefan Lendl Reviewed-by: Max Carrara Tested-by: Max Carrara --- src/PVE/Network/SDN/Controllers/EvpnPlugin.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm index c2fdf88..836a689 100644 --- a/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm +++ b/src/PVE/Network/SDN/Controllers/EvpnPlugin.pm @@ -487,6 +487,12 @@ sub generate_frr_list { } } +sub read_local_frr_config { + if (-e "/etc/frr/frr.conf.local") { + return file_get_contents("/etc/frr/frr.conf.local"); + } +}; + sub generate_controller_rawconfig { my ($class, $plugin_config, $config) = @_; @@ -500,8 +506,8 @@ sub generate_controller_rawconfig { push @{$final_config}, "service integrated-vtysh-config"; push @{$final_config}, "!"; - if (-e "/etc/frr/frr.conf.local") { - my $local_conf = file_get_contents("/etc/frr/frr.conf.local"); + my $local_conf = read_local_frr_config(); + if ($local_conf) { parse_merge_frr_local_config($config, $local_conf); } -- 2.44.0