aboutsummaryrefslogtreecommitdiffstats
path: root/jprov/provision.py
blob: f6c76788b1ed30d32e25079cdad304a38c9a0993 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"""Provisioning command execution."""

from __future__ import annotations

import shlex

from .config import JailConfig
from .runner import run


def run_provision(jail: JailConfig, *, log_file: str | None = None) -> int:
    """Run the provisioning command inside the jail."""
    cmd = ["jexec", jail.name] + shlex.split(jail.cmds["provision"])
    result = run(cmd, env=jail.env, log_file=log_file)
    return result.returncode