From b400a6aaa930a2a42aae4573537a485193e1f8f5 Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Thu, 28 Mar 2024 17:10:43 +0100 Subject: [PATCH] statd: restore MAC address for bridges in CLI "show interfaces" Fixes #358 Signed-off-by: Joachim Wiberg --- src/statd/cli-pretty | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/statd/cli-pretty b/src/statd/cli-pretty index 9c6660d1..761f387d 100755 --- a/src/statd/cli-pretty +++ b/src/statd/cli-pretty @@ -206,7 +206,6 @@ class Iface: def pr_name(self, pipe=""): print(f"{pipe}{self.name:<{Pad.iface - len(pipe)}}", end="") - def pr_proto_ipv4(self, pipe=''): for addr in self.ipv4_addr: origin = f"({addr['origin']})" if addr.get('origin') else "" @@ -225,8 +224,12 @@ class Iface: row += f"{'':<{Pad.state}}{addr['ip']}/{addr['prefix-length']} {origin}" print(row) - def pr_proto_eth(self): - row = f"{'ethernet':<{Pad.proto}}" + def pr_proto_eth(self, pipe=''): + row = "" + if len(pipe) > 0: + row = f"{pipe:<{Pad.iface}}" + + row += f"{'ethernet':<{Pad.proto}}" dec = Decore.green if self.oper_status == "up" else Decore.red row += dec(f"{self.oper_status.upper():<{Pad.state}}") row += f"{self.phys_address:<{Pad.data}}" @@ -276,9 +279,11 @@ class Iface: lowers.append(_iface) if lowers: + self.pr_proto_eth(pipe='│') self.pr_proto_ipv4(pipe='│') self.pr_proto_ipv6(pipe='│') else: + self.pr_proto_eth(pipe=' ') self.pr_proto_ipv4() self.pr_proto_ipv6()