Skip to content
Snippets Groups Projects

move exotic functionality out of shutdown_and_wait, into hooks

Merged anarcat requested to merge mandos into master
Files
2
+ 30
0
"""mandos module
This module encapsulate commands and things done to the mandos server
Ideally, it would allow us to bootstrap hosts on the mandos server as
well, but this might also be done in Puppet.
See https://gitlab.torproject.org/tpo/tpa/team/-/issues/40096g
"""
import logging
from fabric import Connection, task
from . import host
@task
def enable(con: Connection, mandos_host: str = "mandos-01.torproject.org") -> bool:
"""enable the given host on the given mandos server
TODO: automatically guess the mandos host from LDAP or something"""
mandos_con = host.find_context(mandos_host, config=con.config)
ret = mandos_con.run("mandos-ctl --enable " + con.host, warn=True, hide=True)
# disown is not passed to run, so ret can't be None
assert ret is not None
if ret.ok:
logging.info("enabled host %s on Mandos server %s", con.host, mandos_con.host)
return ret.ok
Loading