scripts: migrate-rules: detect rules that aren't in the migration plan

This commit is contained in:
William Ballenthin
2020-06-22 06:59:10 -06:00
parent 5eddc9d3f4
commit ffd926c84c

View File

@@ -72,6 +72,15 @@ def main(argv=None):
rules = read_rules(args.source)
logger.info("read %d rules", len(rules))
planned_rules = set([row["existing name"] for row in plan])
missing = [rule for (name, rule) in rules.items() if name not in planned_rules]
if missing:
logger.error("plan does not account for %d rules:" % (len(missing)))
for rule in missing:
logger.error(" " + rule.name)
return -1
for row in plan:
if not row["existing name"]:
continue