summaryrefslogtreecommitdiff
path: root/7/firewall.pl
diff options
context:
space:
mode:
Diffstat (limited to '7/firewall.pl')
-rw-r--r--7/firewall.pl10
1 files changed, 6 insertions, 4 deletions
diff --git a/7/firewall.pl b/7/firewall.pl
index 7e7b7e7..b1c2a14 100644
--- a/7/firewall.pl
+++ b/7/firewall.pl
@@ -22,7 +22,7 @@
warning(Msg) :-
fw_rule(Host, Attr),
- \+ get_assoc("from", Attr, _),
+ \+ get_assoc(from, Attr, _),
format("Missing 'from' on fw_rule for host '~w', ~w", [Host, Attr], Msg).
rules_from(From, Rules) :-
@@ -30,7 +30,7 @@ rules_from(From, Rules) :-
fw_rule(H, Attr),
(
fw_rule(H, Attr),
- get_assoc("from", Attr, From)
+ get_assoc(from, Attr, From)
),
Rules).
@@ -62,10 +62,12 @@ to_csv(Host, Attrs, Row) :-
get_opt(family, Attrs, Family),
get_opt(src, Attrs, Src),
get_opt(dst, Attrs, Dst),
- Row = [Host, Family, Src, Dst].
+ get_opt(proto, Attrs, Proto),
+ get_opt(port, Attrs, Port),
+ Row = [Host, Family, Src, Dst, Proto, Port].
ansible_firewall(File, Host) :-
format("ansible_firewall: ~s~n", [File]),
findall(Attrs, fw_rule(Host, Attrs), Rules),
maplist(to_csv(Host), Rules, Rows),
- write_csv(File, frame(['host','family','src','dst'], Rows)).
+ write_csv(File, frame(['host','family','src','dst', 'port'], Rows)).