From bc174c686c5b15c267353b81e979478a2ef85273 Mon Sep 17 00:00:00 2001 From: jcaiMR <111116206+jcaiMR@users.noreply.github.com> Date: Sun, 20 Nov 2022 20:20:31 +0800 Subject: [PATCH] add fix for key not exists case (#12769) --- src/sonic-bgpcfgd/bgpcfgd/static_rt_timer.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sonic-bgpcfgd/bgpcfgd/static_rt_timer.py b/src/sonic-bgpcfgd/bgpcfgd/static_rt_timer.py index 0af4bc26d0..f9b5993fd1 100644 --- a/src/sonic-bgpcfgd/bgpcfgd/static_rt_timer.py +++ b/src/sonic-bgpcfgd/bgpcfgd/static_rt_timer.py @@ -16,6 +16,9 @@ class StaticRouteTimer(object): def set_timer(self): """ Check for custom route expiry time in STATIC_ROUTE:EXPIRY_TIME """ + keys = self.db.keys(self.db.APPL_DB, "STATIC_ROUTE_EXPIRY_TIME") + if len(keys) == 0: + return timer = self.db.get(self.db.APPL_DB, "STATIC_ROUTE_EXPIRY_TIME", "time") if timer is not None: timer = int(timer)