From 27958718609af645b492cdb72dc58523d64f6eba Mon Sep 17 00:00:00 2001 From: Vivek Date: Mon, 13 Jan 2025 09:04:10 -0800 Subject: [PATCH] Fix static checks --- acl_loader/main.py | 2 +- dump/plugins/acl_rule.py | 2 +- dump/plugins/acl_table.py | 8 +++++--- tests/show_acl_test.py | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/acl_loader/main.py b/acl_loader/main.py index f98f32fc6f..c83ad6997b 100644 --- a/acl_loader/main.py +++ b/acl_loader/main.py @@ -209,7 +209,7 @@ def read_tables_info(self): appl_db_keys = self.appldb.keys(self.appldb.APPL_DB, "{}:*".format(self.APPL_ACL_TABLE)) if not appl_db_keys: - return + return for app_acl_tbl in appl_db_keys: key = app_acl_tbl.split(":")[-1] diff --git a/dump/plugins/acl_rule.py b/dump/plugins/acl_rule.py index 0a1fd5c12a..3057aeb34f 100755 --- a/dump/plugins/acl_rule.py +++ b/dump/plugins/acl_rule.py @@ -27,7 +27,7 @@ def get_all_args(self, ns=""): req_app = MatchRequest(db="APPL_DB", table=APP_RULE_NAME, key_pattern="*", ns=ns) ret_app = self.match_engine.fetch(req_app) return [f"{CFG_DB_SEPARATOR}".join(key.split(CFG_DB_SEPARATOR)[1:]) for key in ret.get("keys")] + \ - [f"{APP_DB_SEPARATOR}".join(key.split(APP_DB_SEPARATOR)[1:]) for key in ret_app.get("keys")] + [f"{APP_DB_SEPARATOR}".join(key.split(APP_DB_SEPARATOR)[1:]) for key in ret_app.get("keys")] def execute(self, params): self.ret_temp = create_template_dict(dbs=["CONFIG_DB", "APPL_DB", "ASIC_DB"]) diff --git a/dump/plugins/acl_table.py b/dump/plugins/acl_table.py index aca5e06940..6bb781dff1 100755 --- a/dump/plugins/acl_table.py +++ b/dump/plugins/acl_table.py @@ -29,7 +29,7 @@ def get_all_args(self, ns=""): req_app = MatchRequest(db="APPL_DB", table=APP_TABLE_NAME, key_pattern="*", ns=ns) ret_app = self.match_engine.fetch(req_app) return [key.split(CFG_DB_SEPARATOR)[-1] for key in ret.get("keys")] + \ - [key.split(APP_DB_SEPARATOR)[-1] for key in ret_app.get("keys")] + [key.split(APP_DB_SEPARATOR)[-1] for key in ret_app.get("keys")] def execute(self, params): self.ret_temp = create_template_dict(dbs=["CONFIG_DB", "APPL_DB", "ASIC_DB"]) @@ -56,7 +56,8 @@ def init_acl_table_config_info(self, acl_table_name): self.add_to_ret_template(req.table, req.db, ret["keys"], ret["error"]) def init_acl_table_appl_info(self, acl_table_name): - req = MatchRequest(db="APPL_DB", table=APP_TABLE_NAME, key_pattern=acl_table_name, return_fields=["type"], ns=self.ns) + req = MatchRequest(db="APPL_DB", table=APP_TABLE_NAME, key_pattern=acl_table_name, + return_fields=["type"], ns=self.ns) ret = self.match_engine.fetch(req) if ret["keys"]: self.add_to_ret_template(req.table, req.db, ret["keys"], ret["error"]) @@ -78,7 +79,8 @@ def find_any_rule(self, acl_table_name): return acl_rules[0].split(CFG_DB_SEPARATOR)[-1] # Check in APPL_DB - req = MatchRequest(db="APPL_DB", table=APP_RULE_NAME, key_pattern=APP_DB_SEPARATOR.join([acl_table_name, "*"]), ns=self.ns) + req = MatchRequest(db="APPL_DB", table=APP_RULE_NAME, + key_pattern=APP_DB_SEPARATOR.join([acl_table_name, "*"]), ns=self.ns) ret = self.match_engine.fetch(req) acl_rules = ret["keys"] if acl_rules: diff --git a/tests/show_acl_test.py b/tests/show_acl_test.py index 91b7982323..3cf5f1add9 100644 --- a/tests/show_acl_test.py +++ b/tests/show_acl_test.py @@ -4,7 +4,7 @@ import acl_loader.main as acl_loader_show from acl_loader import * -from acl_loader.main import * +from acl_loader.main import AclLoader from importlib import reload root_path = os.path.dirname(os.path.abspath(__file__))