From 89a318de54e9686cdeced780a34b24afefc83f2e Mon Sep 17 00:00:00 2001 From: Kevin Petremann Date: Thu, 3 Oct 2024 13:53:39 +0200 Subject: [PATCH] fix: get_route_maps not working starting 202211 Let's stop doing crappy hack, and use a proper query instead :) --- _modules/sonic.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/_modules/sonic.py b/_modules/sonic.py index 3b3c740..167e95c 100644 --- a/_modules/sonic.py +++ b/_modules/sonic.py @@ -811,16 +811,8 @@ def get_route_maps(): "FABRIC-IN", ] """ - # for now we only need the name of the route-maps, ? is a small hack - route_map = __salt__["cmd.run"]("show route-map ?", "").split("\n") - - # doing some cleaning - del route_map[2] - del route_map[1] - del route_map[0] - route_map = [r.strip() for r in route_map] - - return route_map + cmd = "vtysh -c 'show route-map' | awk '/route-map/ {print $2}' | sort -u" + return __salt__["cmd.shell"](cmd).split("\n") def _upload_candidate_bgp_config(remote_tmpfile, content):