Blob Blame History Raw
From 7323d4fb2454d65bb26839fd6fb4809d19258d34 Mon Sep 17 00:00:00 2001
From: Tomas Jelinek <tojeline@redhat.com>
Date: Tue, 25 Aug 2015 14:51:19 +0200
Subject: [PATCH] fix pcs/pcsd path detection

---
 pcs/utils.py      | 2 +-
 pcsd/bootstrap.rb | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/pcs/utils.py b/pcs/utils.py
index cd33a27..761723b 100644
--- a/pcs/utils.py
+++ b/pcs/utils.py
@@ -736,7 +736,7 @@ def run_pcsdcli(command, data=None):
     env_var = dict()
     if "--debug" in pcs_options:
         env_var["PCSD_DEBUG"] = "true"
-    pcs_dir = os.path.dirname(sys.argv[0])
+    pcs_dir = os.path.realpath(os.path.dirname(sys.argv[0]))
     if pcs_dir == "/usr/sbin":
         pcsd_dir_path = settings.pcsd_exec_location
     else:
diff --git a/pcsd/bootstrap.rb b/pcsd/bootstrap.rb
index 07a7d27..64c3b98 100644
--- a/pcsd/bootstrap.rb
+++ b/pcsd/bootstrap.rb
@@ -1,4 +1,5 @@
 require 'logger'
+require 'pathname'
 
 require 'settings.rb'
 
@@ -32,7 +33,8 @@ def is_systemctl()
 end
 
 def get_pcs_path(pcsd_path)
-  if PCSD_EXEC_LOCATION == pcsd_path or PCSD_EXEC_LOCATION == (pcsd_path + '/')
+  real_path = Pathname.new(pcsd_path).realpath.to_s
+  if PCSD_EXEC_LOCATION == real_path or PCSD_EXEC_LOCATION == (real_path + '/')
     return '/usr/sbin/pcs'
   else
     return '../pcs/pcs'
-- 
1.9.1