Move the contents of the PATH environment variable for hooks to
constants, and use its value in the code and in the hooks documentation.
Signed-off-by: Andrea Spadaccini <spadaccio@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
(cherry picked from commit
fe5ca2bbc103d25d159bc23b00c3acdfb024c0d2)
Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
- 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
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"
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,