diff --git a/doc/hooks.rst b/doc/hooks.rst index aa934f550b870156ddc4c5655b1a58929fbd8722..0de63e322369259792254fc9a871f234631be63f 100644 --- a/doc/hooks.rst +++ b/doc/hooks.rst @@ -98,7 +98,7 @@ The scripts will be run as follows: - stdout and stderr are directed to files -- PATH is reset to ``/sbin:/bin:/usr/sbin:/usr/bin`` +- PATH is reset to :pyeval:`constants.HOOKS_PATH` - the environment is cleared, and only ganeti-specific variables will be left diff --git a/lib/constants.py b/lib/constants.py index a7b09a34bee2286ef889acd2c2006c75a974ddb2..e04e9b3b4252805607b4a2df707056c898752602 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -332,6 +332,7 @@ HOOKS_PHASE_POST = "post" HOOKS_NAME_CFGUPDATE = "config-update" HOOKS_NAME_WATCHER = "watcher" HOOKS_VERSION = 2 +HOOKS_PATH = "/sbin:/bin:/usr/sbin:/usr/bin" # hooks subject type (what object type does the LU deal with) HTYPE_CLUSTER = "CLUSTER" diff --git a/lib/mcpu.py b/lib/mcpu.py index 229ecf483b8435c128a236b38d4095134c2bc9c6..c41012b53b88b5eb7ba4f288273eca2bd8f041ef 100644 --- a/lib/mcpu.py +++ b/lib/mcpu.py @@ -561,7 +561,7 @@ class HooksMaster(object): """ env = { - "PATH": "/sbin:/bin:/usr/sbin:/usr/bin", + "PATH": constants.HOOKS_PATH, "GANETI_HOOKS_VERSION": constants.HOOKS_VERSION, "GANETI_OP_CODE": self.opcode, "GANETI_DATA_DIR": constants.DATA_DIR,