Blame SOURCES/bz1253491-01-fix-pcs-pcsd-path-detection.patch

71541a
From 7323d4fb2454d65bb26839fd6fb4809d19258d34 Mon Sep 17 00:00:00 2001
71541a
From: Tomas Jelinek <tojeline@redhat.com>
71541a
Date: Tue, 25 Aug 2015 14:51:19 +0200
71541a
Subject: [PATCH] fix pcs/pcsd path detection
71541a
71541a
---
71541a
 pcs/utils.py      | 2 +-
71541a
 pcsd/bootstrap.rb | 4 +++-
71541a
 2 files changed, 4 insertions(+), 2 deletions(-)
71541a
71541a
diff --git a/pcs/utils.py b/pcs/utils.py
71541a
index cd33a27..761723b 100644
71541a
--- a/pcs/utils.py
71541a
+++ b/pcs/utils.py
71541a
@@ -736,7 +736,7 @@ def run_pcsdcli(command, data=None):
71541a
     env_var = dict()
71541a
     if "--debug" in pcs_options:
71541a
         env_var["PCSD_DEBUG"] = "true"
71541a
-    pcs_dir = os.path.dirname(sys.argv[0])
71541a
+    pcs_dir = os.path.realpath(os.path.dirname(sys.argv[0]))
71541a
     if pcs_dir == "/usr/sbin":
71541a
         pcsd_dir_path = settings.pcsd_exec_location
71541a
     else:
71541a
diff --git a/pcsd/bootstrap.rb b/pcsd/bootstrap.rb
71541a
index 07a7d27..64c3b98 100644
71541a
--- a/pcsd/bootstrap.rb
71541a
+++ b/pcsd/bootstrap.rb
71541a
@@ -1,4 +1,5 @@
71541a
 require 'logger'
71541a
+require 'pathname'
71541a
 
71541a
 require 'settings.rb'
71541a
 
71541a
@@ -32,7 +33,8 @@ def is_systemctl()
71541a
 end
71541a
 
71541a
 def get_pcs_path(pcsd_path)
71541a
-  if PCSD_EXEC_LOCATION == pcsd_path or PCSD_EXEC_LOCATION == (pcsd_path + '/')
71541a
+  real_path = Pathname.new(pcsd_path).realpath.to_s
71541a
+  if PCSD_EXEC_LOCATION == real_path or PCSD_EXEC_LOCATION == (real_path + '/')
71541a
     return '/usr/sbin/pcs'
71541a
   else
71541a
     return '../pcs/pcs'
71541a
-- 
71541a
1.9.1
71541a