File crm_path_bnc712605.patch of Package pacemaker

# HG changeset patch
# User Dejan Muhamedagic <dejan@hello-penguin.com>
# Date 1313589488 -7200
# Node ID 0abb257259ed722abaa32a237c3c284c08ec0737
# Parent  3681d3471fdecde109ea7c25ab2ceb31e1e8646f
Low: Shell: add crm execute directory to the PATH if not already present (bnc#712605)

Important if crm is run as non-root user. We use sys.argv[0],
but perhaps it'd be better to use autoconf @sbindir@ (or however
it's named) and set it in vars.sbindir.

diff --git a/shell/modules/main.py b/shell/modules/main.py
--- a/shell/modules/main.py
+++ b/shell/modules/main.py
@@ -16,6 +16,7 @@
 #
 
 import sys
+import os
 import shlex
 import getopt
 
@@ -205,7 +206,10 @@ vars = Vars.getInstance()
 levels = Levels.getInstance()
 
 # prefer the user set PATH
-os.putenv("PATH", "%s:%s" % (os.getenv("PATH"),vars.crm_daemon_dir))
+mybinpath = os.path.dirname(sys.argv[0])
+for p in mybinpath, vars.crm_daemon_dir:
+    if p not in os.environ["PATH"].split(':'):
+        os.environ['PATH'] = "%s:%s" % (os.environ['PATH'], p)
 
 def set_interactive():
     '''Set the interactive option only if we're on a tty.'''
openSUSE Build Service is sponsored by