aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/rcynic-lta15
1 files changed, 11 insertions, 4 deletions
diff --git a/scripts/rcynic-lta b/scripts/rcynic-lta
index 6422528e..7dc0f4cf 100755
--- a/scripts/rcynic-lta
+++ b/scripts/rcynic-lta
@@ -342,14 +342,21 @@ class Constraint(object):
gbr = ConstrainedGBR,
rtr = ConstrainedRTR)
+ drop_keywords = ("roas", "gbrs", "rtrs")
+
def __init__(self, y):
self.y = y # Mostly for debugging. I think.
self.prefixes = rpki.resource_set.resource_bag.from_str(str(y.get("prefix", "")))
self.asns = rpki.resource_set.resource_bag.from_str(str(y.get("asn", "")))
- drop = y.get("drop", ())
- self.drop_roas = "all" in drop or "roas" in drop
- self.drop_gbrs = "all" in drop or "gbrs" in drop
- self.drop_rtrs = "all" in drop or "rtrs" in drop
+ drop = y.get("drop", [])
+ if isinstance(drop, str):
+ drop = [drop]
+ if "all" in drop:
+ drop = self.drop_keywords
+ elif not all(d in self.drop_keywords for d in drop):
+ raise ValueError("Unexpected drop keyword %r" % drop)
+ for d in self.drop_keywords:
+ setattr(self, "drop_" + d, d in drop)
self.adds = []
for a in y.get("add", ()):
if not isinstance(a, dict) or len(a) != 1: