diff --git a/python/pacemaker/Makefile.am b/python/pacemaker/Makefile.am index 4e8820097f..241733f43d 100644 --- a/python/pacemaker/Makefile.am +++ b/python/pacemaker/Makefile.am @@ -1,12 +1,13 @@ # # Copyright 2023 the Pacemaker project contributors # # The version control history for this file may have further details. # # This source code is licensed under the GNU General Public License version 2 # or later (GPLv2+) WITHOUT ANY WARRANTY. # MAINTAINERCLEANFILES = Makefile.in -pkgpython_PYTHON = __init__.py +pkgpython_PYTHON = __init__.py \ + exitstatus.py diff --git a/python/pacemaker/__init__.py b/python/pacemaker/__init__.py index dfd9db7fea..9c8caf3381 100644 --- a/python/pacemaker/__init__.py +++ b/python/pacemaker/__init__.py @@ -1,6 +1,8 @@ """ API reference documentation for the `pacemaker` package. """ __copyright__ = "Copyright 2023 the Pacemaker project contributors" __license__ = "LGPLv2.1+" + +from pacemaker.exitstatus import ExitStatus diff --git a/python/pacemaker/exitstatus.py b/python/pacemaker/exitstatus.py new file mode 100644 index 0000000000..e41d37ccf6 --- /dev/null +++ b/python/pacemaker/exitstatus.py @@ -0,0 +1,59 @@ +""" A module providing constants relating to why a process or function exited """ + +__all__ = ["ExitStatus"] +__copyright__ = "Copyright 2023 the Pacemaker project contributors" +__license__ = "LGPLv2.1+" + +from enum import IntEnum, unique + +# These values must be kept in sync with include/crm/common/results.h +@unique +class ExitStatus(IntEnum): + """ Why did a function or process exit? These constants describe both success + and failure conditions. + """ + + OK = 0 + ERROR = 1 + INVALID_PARAM = 2 + UNIMPLEMENT_FEATURE = 3 + INSUFFICIENT_PRIV = 4 + NOT_INSTALLED = 5 + NOT_CONFIGURED = 6 + NOT_RUNNING = 7 + PROMOTED = 8 + FAILED_PROMOTED = 9 + USAGE = 64 + DATAERR = 65 + NOINPUT = 66 + NOUSER = 67 + NOHOST = 68 + UNAVAILABLE = 69 + SOFTWARE = 70 + OSERR = 71 + OSFILE = 72 + CANTCREAT = 73 + IOERR = 74 + TEMPFAIL = 75 + PROTOCOL = 76 + NOPERM = 77 + CONFIG = 78 + FATAL = 100 + PANIC = 101 + DISCONNECT = 102 + OLD = 103 + DIGEST = 104 + NOSUCH = 105 + QUORUM = 106 + UNSAFE = 107 + EXISTS = 108 + MULTIPLE = 109 + EXPIRED = 110 + NOT_YET_IN_EFFECT = 111 + INDETERMINATE = 112 + UNSATISFIED = 113 + TIMEOUT = 124 + DEGRADED = 190 + DEGRADED_PROMOTED = 191 + NONE = 193 + MAX = 255