From 6a51d1f6e3abfc5e939d727c69ff5df27a3ad347 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..a8429b95fb4 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 aaa_server_groups = aaa_server_groups | selectattr('type', 'arista.avd.defined') | list %} +{% for aaa_server_group in aaa_server_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..8172b882845 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 aaa_server_groups = aaa_server_groups | selectattr('type', 'arista.avd.defined') | list %} +{% for aaa_server_group in aaa_server_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..52548c8a428 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 aaa_server_groups = aaa_server_groups | selectattr('type', 'arista.avd.defined') | list %} +{% for aaa_server_group in aaa_server_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 }}