aboutsummaryrefslogtreecommitdiffstats
path: root/jprov/provision.py
blob: f3352e9e6f446e536caccfe7115ee30ca3ed2653 (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.cmd)
    result = run(cmd, env=jail.env, log_file=log_file)
    return result.returncode