feat: add util.mako_renderer() function

This commit is contained in:
Lance Edgar 2024-11-20 10:29:31 -06:00
parent 4879887cb3
commit c41d364e03
6 changed files with 63 additions and 2 deletions

View file

@ -52,12 +52,15 @@ merely a personal convention. You can define tasks however you need::
"""
from fabric import task
from wuttamess import apt, sync
from wuttamess import apt, sync, util
# nb. this is used below, for file sync
root = sync.make_root('files')
# nb. this is for global mako template context etc.
env = {'machine_is_live': False}
@task
def bootstrap_all(c):
@ -74,11 +77,13 @@ merely a personal convention. You can define tasks however you need::
"""
Bootstrap the base system
"""
renderers = {'mako': util.mako_renderer(c, env)}
apt.dist_upgrade(c)
# postfix
apt.install(c, 'postfix')
if sync.check_isync(c, root, 'etc/postfix'):
if sync.check_isync(c, root, 'etc/postfix', renderers=renderers):
c.run('systemctl restart postfix')