mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-01 13:23:01 +02:00
cli: handle missing oper-status
Use known data from .self to avoid crashing if the oper-status is missing for a interface. Signed-off-by: Richard Alpe <richard@bit42.se>
This commit is contained in:
committed by
Joachim Wiberg
parent
fdcc6d35a4
commit
7d8b876cc7
@@ -95,8 +95,8 @@ class Iface:
|
||||
|
||||
def pr_proto_eth(self):
|
||||
row = f"{'ethernet':<{Pad.proto}}"
|
||||
dec = Decore.green if self.data['oper-status'] == "up" else Decore.red
|
||||
row += dec(f"{self.data['oper-status'].upper():<{Pad.state}}")
|
||||
dec = Decore.green if self.oper_status == "up" else Decore.red
|
||||
row += dec(f"{self.oper_status.upper():<{Pad.state}}")
|
||||
row += f"{self.data['phys-address']:<{Pad.data}}"
|
||||
print(row)
|
||||
|
||||
|
||||
@@ -322,9 +322,9 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"TEST-DESCR": "VLAN without operstatus",
|
||||
"name": "vlan20",
|
||||
"type": "infix-if-type:vlan",
|
||||
"oper-status": "up",
|
||||
"if-index": 4,
|
||||
"phys-address": "02:00:00:00:00:00",
|
||||
"statistics": {
|
||||
|
||||
Reference in New Issue
Block a user