#!/usr/bin/perl -n BEGIN { print <<'EOF'; <% from invirt.config import structs as cfg %> EOF } s/^user root/user munin/m; s/^group root/group munin/m; s/^node.startup = manual/node.startup = automatic/m; # mako just generally doesn't deal well with lines that start with # hashes, so we'll strip them # # And empty lines too, just for cleanliness s/^#.*$//m; print unless /^$/; END { print <<'EOF'; % for host in cfg.get('monitoring', []): allow ^${host.ip.replace('.', '\.')}$ allow ^::ffff:${host.ip.replace('.', '\.')}$ % endfor EOF }