[pve-devel] [PATCH v2 pve-network 2/5] refactor(evpn): extract read_local_frr_config

Max Carrara m.carrara at proxmox.com
Mon Mar 25 14:20:17 CET 2024


Should just be "evpn: [...]" as per our commit guidelines [0], but this
can honestly be changed while applying.

Otherwise LGTM!

[0]: https://pve.proxmox.com/wiki/Developer_Documentation#Commits_and_Commit_Messages

On Thu Mar 7, 2024 at 4:13 PM CET, Stefan Lendl wrote:
> to allow mocking local fs access
>
> Signed-off-by: Stefan Lendl <s.lendl at proxmox.com>
> ---
>  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);
>      }
>  





More information about the pve-devel mailing list