summaryrefslogtreecommitdiffstats
path: root/python/pacemaker/_cts/input.py
blob: 7e734f6ffb56470cdd8733edb6b6f98952e908da (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-2023 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"]