INNER CODE UNIT · Python
pre_push_configuration
bunkerity/bunkerweb · src/scheduler/main.py:795
def pre_push_configuration(env: Dict[str, Any], first_start: bool) -> Tuple[bool, bool]:
"""Generate and push the configuration the once-jobs are about to validate against.
Returns (took_it, rendered). The second half matters to the caller: a render that happened here
must not happen again in the same iteration. Plugins need their API endpoints loaded on the
instances and jobs validate against the running configuration; certbot-new is the expensive
case, since a service added now has no server{} on the instance yet, so an ACME probe falls to
the default server, and the job is "once", so nothing retries it until the next change. On the
first start the instance may still be booting, hence the wait, which also repopulates
SCHEDULER.apis after the startup sends emptied it; later it is already known.
"""
assert SCHEDULER is not None
if not (wait_for_reachable_instance() if first_start else SCHEDULER.apis):
return False, False
LOGGER.info("Generating and sending the configuration before running jobs ...")
if not generate_configs():