Skip to content

Commit

Permalink
bugfix messages multineighbor
Browse files Browse the repository at this point in the history
  • Loading branch information
jirivrany committed Jul 12, 2023
1 parent 880723b commit 9af2ec9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions flowapp/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,11 @@ def create_rtbh(rule, message_type=ANNOUNCE):
try:
if current_app.config["USE_MULTI_NEIGHBOR"] and rule.community.comm:
if rule.community.comm in current_app.config["MULTI_NEIGHBOR"].keys():
target = current_app.config["MULTI_NEIGHBOR"].get(rule.community.comm)
neighbor = "neighbor {target} ".format(target=target)
targets = current_app.config["MULTI_NEIGHBOR"].get(rule.community.comm)
else:
targets = current_app.config["MULTI_NEIGHBOR"].get("primary")
neighbor = prepare_multi_neighbor(targets)


neighbor = prepare_multi_neighbor(targets)
else:
neighbor = ""
except KeyError:
Expand Down Expand Up @@ -253,9 +252,9 @@ def sanitize_mask(rule_mask, default_mask=IPV4_DEFMASK):
return default_mask


def prepare_multi_neighbor(targets):
def prepare_multi_neighbor(targets: list):
"""
prepare multi neighbor string
"""
neigbors = ["neighbor {}".format(tgt) for tgt in targets]
neigbors = [f"neighbor {tgt}" for tgt in targets]
return ", ".join(neigbors) + " "

0 comments on commit 9af2ec9

Please sign in to comment.