summaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2020-12-28 21:56:05 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2020-12-28 21:56:05 +0100
commit9851dffc8d915ff01117a5ed8070e5b2a1ef2bb5 (patch)
tree6fe7914b793a782079738a936bac595a08902b44 /utils.py
parentb8af5cdf274a60f364d34192d4f483f4f4800282 (diff)
downloadrules-sandbox-9851dffc8d915ff01117a5ed8070e5b2a1ef2bb5.tar.gz
rules-sandbox-9851dffc8d915ff01117a5ed8070e5b2a1ef2bb5.tar.bz2
rules-sandbox-9851dffc8d915ff01117a5ed8070e5b2a1ef2bb5.tar.xz
rules-sandbox-9851dffc8d915ff01117a5ed8070e5b2a1ef2bb5.zip
Better structure.
Splitting machines and terraform machines, ditto with dns.
Diffstat (limited to 'utils.py')
-rw-r--r--utils.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/utils.py b/utils.py
index 06c6500..bc47d8f 100644
--- a/utils.py
+++ b/utils.py
@@ -32,14 +32,22 @@ def write_facts(ruleset: set):
os.mkdir(typedir)
fs = []
- for f in facts:
- if f["type"] != t:
+ for fact in facts:
+ if fact["type"] != t:
continue
+
+ if fact["type"] == "meta":
+ continue
+
+ if fact.get("key") is None:
+ raise Exception(f"Bad fact: no 'key' {fact}")
+
try:
- del f["sid"]
+ del fact["sid"]
except KeyError:
pass
- fs.append(f)
+
+ fs.append(fact)
i = 0
for fact in sorted(fs, key=lambda f: f["key"]):