diff --git a/doc/hooks.rst b/doc/hooks.rst index d9f09f2b4de03812d53bf788f0983a784b60c822..3cf8bc70bd05412cb9f533dd88b98e3d452ca1f1 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 4fa186e9f62be332f0136f1e656e0163686f6fee..90b992269cd9e7bec9d93329d4ff6fad0e14590b 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -328,6 +328,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 89046c60cdf64e575cce43b592969530b790e0ea..ba07b83ac2a3513708f758819f875c25db5eef94 100644 --- a/lib/mcpu.py +++ b/lib/mcpu.py @@ -519,7 +519,7 @@ class HooksMaster(object): cfg = self.lu.cfg env = { - "PATH": "/sbin:/bin:/usr/sbin:/usr/bin", + "PATH": constants.HOOKS_PATH, "GANETI_HOOKS_VERSION": constants.HOOKS_VERSION, "GANETI_OP_CODE": self.op.OP_ID, "GANETI_DATA_DIR": constants.DATA_DIR,