Skip to content

Commit

Permalink
Catch acl table KeyError in caclmgrd to avoid crash
Browse files Browse the repository at this point in the history
Signed-off-by: Zhaohui Sun <[email protected]>
  • Loading branch information
ZhaohuiS committed Mar 6, 2024
1 parent 970e7b3 commit a474701
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scripts/caclmgrd
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ try:
import sys
import threading
import time
import json
from sonic_py_common.general import getstatusoutput_noshell_pipe
from sonic_py_common import daemon_base, device_info, multi_asic
from swsscommon import swsscommon
Expand Down Expand Up @@ -1078,9 +1079,13 @@ class ControlPlaneAclManager(daemon_base.DaemonBase):
ctrl_plane_acl_notification.add(namespace)
# Check ACL Rule notification and make sure Rule point to ACL Table which is Controlplane
else:
acl_table = key.split(acl_rule_table_seprator)[0]
if self.config_db_map[namespace].get_table(self.ACL_TABLE)[acl_table]["type"] == self.ACL_TABLE_TYPE_CTRLPLANE:
ctrl_plane_acl_notification.add(namespace)
try:
acl_table = key.split(acl_rule_table_seprator)[0]
if self.config_db_map[namespace].get_table(self.ACL_TABLE)[acl_table]["type"] == self.ACL_TABLE_TYPE_CTRLPLANE:
ctrl_plane_acl_notification.add(namespace)
except KeyError:
self.log_error("ACL table '{}' not found in Config DB. ACL_TABLE={}".format(acl_table, json.dumps(self.config_db_map[namespace].get_table(self.ACL_TABLE), indent=4)))
continue

# Update the Control Plane ACL of the namespace that got config db acl table event
for namespace in ctrl_plane_acl_notification:
Expand Down

0 comments on commit a474701

Please sign in to comment.