INNER CODE UNIT · Python

repo_root

timothystewart6/k3s-ansible · .github/scripts/test-kube-vip-deploy-condition.py:31

def repo_root():
    return subprocess.check_output(
        ["git", "rev-parse", "--show-toplevel"], text=True
    ).strip()


def fail(message):
    raise SystemExit("kube-vip deploy condition test failed: " + message)


def extract_when(path, task_name):
    """Return the `when:` expression string for the named task."""
    with open(path, encoding="utf-8") as handle:
        doc = yaml.safe_load(handle)
    for task in doc:
        if task.get("name") == task_name:
            when = task.get("when")
            return (when or "").strip()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…