Skip to content

Commit

Permalink
[acl-loader] change helper functions to pop_*
Browse files Browse the repository at this point in the history
Signed-off-by: Stepan Blyschak <[email protected]>
  • Loading branch information
Stepan Blyschak committed Jul 5, 2019
1 parent a0d4b37 commit 0674d80
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions acl_loader/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ def validate_actions(self, table_name, action_props):

if action_value not in capability[key]:
del action_props[action_key]
continue

return action_count == len(action_props)

Expand Down Expand Up @@ -666,11 +667,11 @@ def show_rule(self, table_name, rule_id):
"""
header = ("Table", "Rule", "Priority", "Action", "Match")

def show_priority(val):
def pop_priority(val):
priority = val.pop("PRIORITY")
return priority

def show_action(val):
def pop_action(val):
action = ""

for key in dict(val):
Expand All @@ -688,7 +689,7 @@ def show_action(val):

return action

def show_matches(val):
def pop_matches(val):
matches = list(sorted(["%s: %s" % (k, val[k]) for k in val]))
if len(matches) == 0:
matches.append("N/A")
Expand All @@ -703,9 +704,9 @@ def show_matches(val):
if rule_id and rule_id != rid:
continue

priority = show_priority(val)
action = show_action(val)
matches = show_matches(val)
priority = pop_priority(val)
action = pop_action(val)
matches = pop_matches(val)

rule_data = [[tname, rid, priority, action, matches[0]]]
if len(matches) > 1:
Expand Down

0 comments on commit 0674d80

Please sign in to comment.