From 8ff5f37e3325c8ee3a98df38ee054086c6d7460e Mon Sep 17 00:00:00 2001 From: anamehra <54692434+anamehra@users.noreply.github.com> Date: Tue, 20 Sep 2022 08:26:46 -0700 Subject: [PATCH] Use get() to fetch default value from dictionary for port admin_status #286 Fixes https://github.com/sonic-net/sonic-buildimage/issues/11707 --- sonic-xcvrd/xcvrd/xcvrd.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonic-xcvrd/xcvrd/xcvrd.py b/sonic-xcvrd/xcvrd/xcvrd.py index a5c53b0eb05f..55d5da8f1e2f 100644 --- a/sonic-xcvrd/xcvrd/xcvrd.py +++ b/sonic-xcvrd/xcvrd/xcvrd.py @@ -1250,7 +1250,7 @@ def get_port_admin_status(self, lport): found, port_info = cfg_port_tbl.get(lport) if found: # Check admin_status too ...just in case - admin_status = dict(port_info)['admin_status'] + admin_status = dict(port_info).get('admin_status', 'down') return admin_status def configure_tx_output_power(self, api, lport, tx_power):