summaryrefslogtreecommitdiffstats
path: root/python/pacemaker/_cts/input.py
blob: 739d3718f3ac0c35d2a9650da2ae172f2a901f62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
"""User input related utilities for CTS."""

__all__ = ["should_continue"]
__copyright__ = "Copyright 2000-2024 the Pacemaker project contributors"
__license__ = "GNU General Public License version 2 or later (GPLv2+) WITHOUT ANY WARRANTY"


def should_continue(env):
    """On failure, prompt the user to see if we should continue."""
    if env["continue"]:
        return True

    try:
        answer = input("Continue? [yN]")
    except EOFError:
        answer = "n"

    return answer in ["y", "Y"]