From 2acfac712cde23c636840a5d13407063026d419e Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 23 Jan 2019 18:47:05 -0800 Subject: [PATCH] [caclmgrd] Don't crash if we find empty/null rule_props (#2475) * [caclmgrd] Don't crash if we find empty/null rule_props --- files/image_config/caclmgrd/caclmgrd | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/files/image_config/caclmgrd/caclmgrd b/files/image_config/caclmgrd/caclmgrd index a7ec952ca21f..5e8d83074de1 100755 --- a/files/image_config/caclmgrd/caclmgrd +++ b/files/image_config/caclmgrd/caclmgrd @@ -183,7 +183,15 @@ class ControlPlaneAclManager(object): for ((rule_table_name, rule_id), rule_props) in self._rules_db_info.iteritems(): if rule_table_name == table_name: - acl_rules[rule_props["PRIORITY"]] = rule_props + if not rule_props: + log_warning("rule_props for rule_id {} empty or null!".format(rule_id)) + continue + + try: + acl_rules[rule_props["PRIORITY"]] = rule_props + except KeyError: + log_error("rule_props for rule_id {} does not have key 'PRIORITY'!".format(rule_id)) + continue # If we haven't determined the IP version for this ACL table yet, # try to do it now. We determine heuristically based on whether the