summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-07-15 14:35:49 +0200
committerGitHub <noreply@github.com>2023-07-15 14:35:49 +0200
commit9285b9a571ee944daf6f17847a62f115146834a4 (patch)
tree4eb86a725c2070b72734161c706951610bd30e26 /src
parent9f7b51370732606611253e2e6a16692bf706659b (diff)
parent960cace189d7ace2bea0968646b1348b415e0363 (diff)
downloadvyos-1x-9285b9a571ee944daf6f17847a62f115146834a4.tar.gz
vyos-1x-9285b9a571ee944daf6f17847a62f115146834a4.zip
Merge pull request #2091 from jvoss/policy_bgp_communities
policy: T5357: only delete migrated BGP community rules
Diffstat (limited to 'src')
-rwxr-xr-xsrc/migration-scripts/policy/3-to-48
1 files changed, 5 insertions, 3 deletions
diff --git a/src/migration-scripts/policy/3-to-4 b/src/migration-scripts/policy/3-to-4
index bae30cffc..49e0b4c38 100755
--- a/src/migration-scripts/policy/3-to-4
+++ b/src/migration-scripts/policy/3-to-4
@@ -51,7 +51,7 @@ def community_migrate(config: ConfigTree, rule: list[str]) -> bool:
:rtype: bool
"""
community_list = list((config.return_value(rule)).split(" "))
- config.delete(rule)
+
if 'none' in community_list:
config.set(rule + ['none'])
return False
@@ -61,8 +61,10 @@ def community_migrate(config: ConfigTree, rule: list[str]) -> bool:
community_action = 'add'
community_list.remove('additive')
for community in community_list:
- config.set(rule + [community_action], value=community,
- replace=False)
+ if len(community):
+ config.set(rule + [community_action], value=community,
+ replace=False)
+ config.delete(rule)
if community_action == 'replace':
return False
else: