Is root¶
Lets write this only once (DRY principle)
Returns messages thru callbacks. So do not print or log anything
Module private variables
- logging_strict.util.util_root.__all__: tuple[str, str] = ("IsRoot", "check_python_not_old")¶
Module object exports
- logging_strict.util.util_root.g_module: str = "logging_strict.util.util_root"¶
This module’s dotted path
- logging_strict.util.util_root._LOGGER: logging.Logger¶
Module level logger
- logging_strict.util.util_root.g_is_root: bool¶
Trueif app run as a service with root privledges.Falseif run normally and sanely
Module objects
- class logging_strict.util.util_root.IsRoot¶
Checks whether or not root DRY principle; don’t repeat yourself; which became tiresome
Class variables
- Variables:
__slots__ – Turns off dynamic instance variables
- Vartype:
ClassVar[tuple[()]]
- classmethod check_not_root(callback=None, is_app_exit=False, is_raise_exc=False)¶
What to do if app executed as normal user
- Parameters:
- Raises:
PermissionError– Requires root to run
- classmethod check_root(callback=None, is_app_exit=False, is_raise_exc=False)¶
What to do if app executed as root
- Parameters:
- Raises:
PermissionError– Requires root to run
- classmethod path_home_root()¶
Replacement for get_logname
Intended to be run only by root, but not necessarily
- Returns:
root home folder
- Return type:
- logging_strict.util.util_root.check_python_not_old(callback=None, is_app_exit=False, is_raise_exc=False)¶
Warn raising error if python interpretor version is an unsupported version
- Parameters:
- Raises:
PermissionError– Requires root to run