Esempio n. 1
0
def get_valid_timeout_seconds(timeout_candidate):
    """
    Transform pacemaker style timeout to number of seconds, raise LibraryError
        on invalid timeout
    timeout_candidate timeout string or None
    """
    if timeout_candidate is None:
        return None
    wait_timeout = timeout_to_seconds(timeout_candidate)
    if wait_timeout is None:
        raise LibraryError(reports.invalid_timeout(timeout_candidate))
    return wait_timeout
Esempio n. 2
0
def get_valid_timeout_seconds(timeout_candidate):
    """
    Transform pacemaker style timeout to number of seconds, raise LibraryError
        on invalid timeout
    timeout_candidate timeout string or None
    """
    if timeout_candidate is None:
        return None
    wait_timeout = timeout_to_seconds(timeout_candidate)
    if wait_timeout is None:
        raise LibraryError(reports.invalid_timeout(timeout_candidate))
    return wait_timeout