Skip to content

Commit 2cbc79e

Browse files
authored
Merge pull request #201 from mssonicbld/sonicbld/202503-merge
```<br>* 39cd720 - (HEAD -> 202503) Merge branch '202412' of https://github.com/Azure/sonic-utilities.msft into 202503 (2025-07-11) [Sonic Automation] * 1e6c132 - (base/202412) Merge pull request #200 from mssonicbld/sonicbld/202412-merge (2025-07-10) [mssonicbld] * 0522c0f - Merge branch '202411' of https://github.com/sonic-net/sonic-utilities into 202412 (2025-07-10) [Sonic Automation] * 58f250e - (origin/202411) backport PR 3947 (#3960) (2025-07-09) [Liping Xu]<br>```
2 parents 5d641fe + 39cd720 commit 2cbc79e

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

clear/main.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,21 +79,21 @@ def get_command(self, ctx, cmd_name):
7979
# location (configdb?), so that we prevent the continous execution of this
8080
# bash oneliner. To be revisited once routing-stack info is tracked somewhere.
8181
def get_routing_stack():
82-
cmd0 = ["sudo", "docker", "ps"]
83-
cmd1 = ["grep", "bgp"]
84-
cmd2 = ["awk", '{print$2}']
85-
cmd3 = ["cut", "-d-", "-f3"]
86-
cmd4 = ["cut", "-d:", "-f1"]
82+
result = 'frr'
83+
84+
cmd0 = ["sudo", "docker", "ps", "--format", "{{.Image}}\t{{.Names}}"]
85+
cmd1 = ["awk", '$2 == "bgp"']
86+
cmd2 = ["cut", "-d-", "-f3"]
87+
cmd3 = ["cut", "-d:", "-f1"]
88+
cmd4 = ["head", "-n", "1"]
8789

8890
try:
8991
_, result = getstatusoutput_noshell_pipe(cmd0, cmd1, cmd2, cmd3, cmd4)
90-
9192
except OSError as e:
9293
raise OSError("Cannot detect routing-stack")
9394

9495
return (result)
9596

96-
9797
# Global Routing-Stack variable
9898
routing_stack = get_routing_stack()
9999

show/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@
8686
# location (configdb?), so that we prevent the continous execution of this
8787
# bash oneliner. To be revisited once routing-stack info is tracked somewhere.
8888
def get_routing_stack():
89-
result = None
90-
command = "sudo docker ps | grep bgp | awk '{print$2}' | cut -d'-' -f3 | cut -d':' -f1 | head -n 1"
89+
result = 'frr'
90+
command = "sudo docker ps --format '{{.Image}}\t{{.Names}}' | awk '$2 == \"bgp\"' | cut -d'-' -f3 | cut -d':' -f1 | head -n 1" # noqa: E501
9191

9292
try:
9393
stdout = subprocess.check_output(command, shell=True, text=True, timeout=COMMAND_TIMEOUT)

0 commit comments

Comments
 (0)