From 8b1eb8dcd81331dab15cd7f5d332e1e03cd2421e Mon Sep 17 00:00:00 2001 From: Laxmikant Chintakindi Date: Mon, 25 Nov 2024 17:30:19 +0530 Subject: [PATCH] Address comments --- .../j2templates/eos/aaa-server-groups-ldap.j2 | 9 ++------- .../j2templates/eos/aaa-server-groups-radius.j2 | 11 +++-------- .../j2templates/eos/aaa-server-groups-tacacs-plus.j2 | 9 ++------- 3 files changed, 7 insertions(+), 22 deletions(-) diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/aaa-server-groups-ldap.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/aaa-server-groups-ldap.j2 index 5a995f862a7..82706b9ed8b 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/aaa-server-groups-ldap.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/aaa-server-groups-ldap.j2 @@ -5,13 +5,8 @@ #} {# eos - aaa server groups ldap #} {% if aaa_server_groups is arista.avd.defined %} -{% set filtered_groups = [] %} -{% for aaa_server_group in aaa_server_groups %} -{% if aaa_server_group.type is arista.avd.defined %} -{% do filtered_groups.append(aaa_server_group) %} -{% endif %} -{% endfor %} -{% for aaa_server_group in filtered_groups | arista.avd.natural_sort('name') | arista.avd.natural_sort("type") %} +{% set filtered_groups = aaa_server_groups | selectattr("type") %} +{% for aaa_server_group in filtered_groups | arista.avd.natural_sort('name') %} {% if aaa_server_group.type | arista.avd.default == 'ldap' %} ! aaa group server {{ aaa_server_group.type }} {{ aaa_server_group.name }} diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/aaa-server-groups-radius.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/aaa-server-groups-radius.j2 index 60a6c03487a..7d084f10c8f 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/aaa-server-groups-radius.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/aaa-server-groups-radius.j2 @@ -5,14 +5,9 @@ #} {# eos - aaa server groups #} {% if aaa_server_groups is arista.avd.defined %} -{% set filtered_groups = [] %} -{% for aaa_server_group in aaa_server_groups %} -{% if aaa_server_group.type is arista.avd.defined %} -{% do filtered_groups.append(aaa_server_group) %} -{% endif %} -{% endfor %} -{% for aaa_server_group in filtered_groups | arista.avd.natural_sort('name') | arista.avd.natural_sort('type') %} -{% if aaa_server_group.type | arista.avd.default("") == 'radius' %} +{% set filtered_groups = aaa_server_groups | selectattr("type") %} +{% for aaa_server_group in filtered_groups | arista.avd.natural_sort('name') %} +{% if aaa_server_group.type | arista.avd.default == 'radius' %} ! aaa group server {{ aaa_server_group.type }} {{ aaa_server_group.name }} {% if aaa_server_group.servers is arista.avd.defined %} diff --git a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/aaa-server-groups-tacacs-plus.j2 b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/aaa-server-groups-tacacs-plus.j2 index bc5d12f0af4..921b3e43c1a 100644 --- a/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/aaa-server-groups-tacacs-plus.j2 +++ b/python-avd/pyavd/_eos_cli_config_gen/j2templates/eos/aaa-server-groups-tacacs-plus.j2 @@ -5,13 +5,8 @@ #} {# eos - aaa server groups #} {% if aaa_server_groups is arista.avd.defined %} -{% set filtered_groups = [] %} -{% for aaa_server_group in aaa_server_groups %} -{% if aaa_server_group.type is arista.avd.defined %} -{% do filtered_groups.append(aaa_server_group) %} -{% endif %} -{% endfor %} -{% for aaa_server_group in filtered_groups | arista.avd.natural_sort('name') | arista.avd.natural_sort("type") %} +{% set filtered_groups = aaa_server_groups | selectattr("type") %} +{% for aaa_server_group in filtered_groups | arista.avd.natural_sort('name') %} {% if aaa_server_group.type is arista.avd.defined('tacacs+') %} ! aaa group server {{ aaa_server_group.type }} {{ aaa_server_group.name }}