INNER CODE UNIT · Python

confirm

LINBIT/linstor-server · scripts/linstor-controller-ha-setup.py:248

def confirm(prompt, assume_yes=False):
    if assume_yes:
        print(prompt + " yes (--yes)")
        return
    if not ask_yes(prompt):
        die("aborted by user")


def pkg_manager():
    """The node's package manager, as (name, install-cmd, refresh-cmd)."""
    for name, install, refresh in (
            ("apt-get", ["apt-get", "install", "-y"], ["apt-get", "update", "-q"]),
            ("dnf", ["dnf", "install", "-y"], None),
            ("yum", ["yum", "install", "-y"], None),
            ("zypper", ["zypper", "--non-interactive", "install"], None)):
        if shutil.which(name):
            return name, install, refresh
    return None, None, None

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…