Skip to content

Commit

Permalink
Fix static checks
Browse files Browse the repository at this point in the history
  • Loading branch information
vivekrnv authored Jan 13, 2025
1 parent 0eba3b6 commit 2795871
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion acl_loader/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion dump/plugins/acl_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
8 changes: 5 additions & 3 deletions dump/plugins/acl_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand All @@ -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"])
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/show_acl_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__))
Expand Down

0 comments on commit 2795871

Please sign in to comment.