Resolves: rhbz#1618911

- Fixed error with missing rubygem location during pcsd start
This commit is contained in:
Ivan Devat 2018-08-25 11:14:44 +02:00
parent 6341d90428
commit af67efa0f5
3 changed files with 117 additions and 1 deletions

View File

@ -0,0 +1,83 @@
From 25b22ebeb007534ef86815f4e303e773c060c722 Mon Sep 17 00:00:00 2001
From: Ivan Devat <idevat@redhat.com>
Date: Fri, 24 Aug 2018 20:01:04 +0200
Subject: [PATCH 1/2] add support for instalation without bundled gems
---
pcs/daemon/env.py | 2 ++
pcs/daemon/ruby_pcsd.py | 8 +++++---
pcs/daemon/run.py | 2 +-
pcs/settings_default.py | 2 ++
4 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/pcs/daemon/env.py b/pcs/daemon/env.py
index 6433a31..b311d88 100644
--- a/pcs/daemon/env.py
+++ b/pcs/daemon/env.py
@@ -166,6 +166,8 @@ class EnvLoader:
return self.__has_true_in_environ(PCSD_DEBUG)
def gem_home(self):
+ if settings.pcsd_gem_path is None:
+ return None
return self.__in_pcsd_path(
settings.pcsd_gem_path,
"Ruby gem location"
diff --git a/pcs/daemon/ruby_pcsd.py b/pcs/daemon/ruby_pcsd.py
index 43aa9fb..a3910ba 100644
--- a/pcs/daemon/ruby_pcsd.py
+++ b/pcs/daemon/ruby_pcsd.py
@@ -61,8 +61,8 @@ def process_response_logs(rb_log_list):
class Wrapper:
# pylint: disable=too-many-instance-attributes
def __init__(
- self, gem_home, pcsd_cmdline_entry, debug=False, ruby_executable="ruby",
- https_proxy=None, no_proxy=None
+ self, pcsd_cmdline_entry, gem_home=None, debug=False,
+ ruby_executable="ruby", https_proxy=None, no_proxy=None
):
self.__gem_home = gem_home
self.__pcsd_cmdline_entry = pcsd_cmdline_entry
@@ -98,9 +98,11 @@ class Wrapper:
async def send_to_ruby(self, request_json):
env = {
- "GEM_HOME": self.__gem_home,
"PCSD_DEBUG": "true" if self.__debug else "false"
}
+ if self.__gem_home is not None:
+ env["GEM_HOME"] = self.__gem_home
+
if self.__no_proxy is not None:
env["NO_PROXY"] = self.__no_proxy
if self.__https_proxy is not None:
diff --git a/pcs/daemon/run.py b/pcs/daemon/run.py
index d1c91c7..004972f 100644
--- a/pcs/daemon/run.py
+++ b/pcs/daemon/run.py
@@ -86,8 +86,8 @@ def main():
sync_config_lock = Lock()
ruby_pcsd_wrapper = ruby_pcsd.Wrapper(
- gem_home=env.GEM_HOME,
pcsd_cmdline_entry=env.PCSD_CMDLINE_ENTRY,
+ gem_home=env.GEM_HOME,
debug=env.PCSD_DEBUG,
ruby_executable=settings.ruby_executable,
https_proxy=env.HTTPS_PROXY,
diff --git a/pcs/settings_default.py b/pcs/settings_default.py
index d9cb0e4..45e3c09 100644
--- a/pcs/settings_default.py
+++ b/pcs/settings_default.py
@@ -74,6 +74,8 @@ default_ssl_options = ",".join([
"OP_NO_TLSv1",
"OP_NO_TLSv1_1",
])
+# Set pcsd_gem_path to None if there are no bundled ruby gems and the path does
+# not exists.
pcsd_gem_path = "vendor/bundle/ruby"
ruby_executable = "/usr/bin/ruby"
--
1.8.3.1

View File

@ -0,0 +1,25 @@
From fac7ecf0baf41e97426327ac49b02e6067969cbe Mon Sep 17 00:00:00 2001
From: Ivan Devat <idevat@redhat.com>
Date: Sat, 25 Aug 2018 09:27:12 +0200
Subject: [PATCH 2/2] do not use bundled ruby gems
---
pcs/settings_default.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pcs/settings_default.py b/pcs/settings_default.py
index 45e3c09..e321981 100644
--- a/pcs/settings_default.py
+++ b/pcs/settings_default.py
@@ -76,7 +76,7 @@ default_ssl_options = ",".join([
])
# Set pcsd_gem_path to None if there are no bundled ruby gems and the path does
# not exists.
-pcsd_gem_path = "vendor/bundle/ruby"
+pcsd_gem_path = None
ruby_executable = "/usr/bin/ruby"
gui_session_lifetime_seconds=60 * 60
--
1.8.3.1

View File

@ -1,6 +1,6 @@
Name: pcs
Version: 0.10.0.alpha.2
Release: 1%{?dist}
Release: 2%{?dist}
# https://fedoraproject.org/wiki/Licensing:Main?rd=Licensing#Good_Licenses
# GPLv2: pcs
# ASL 2.0: tornado
@ -31,6 +31,8 @@ Source42: https://github.com/tornadoweb/tornado/archive/v%{tornado_version}.tar.
Patch0: adapt-working-with-ruby-gems-to-fedora.patch
Patch1: disable-gui.patch
Patch2: add-support-for-instalation-without-bundled-gems.patch
Patch3: do-not-use-bundled-ruby-gems.patch
# git for patches
BuildRequires: git
@ -174,6 +176,8 @@ UpdateTimestamps() {
%patch0 -p1
UpdateTimestamps -p1 %{PATCH0}
UpdateTimestamps -p1 %{PATCH1}
UpdateTimestamps -p1 %{PATCH2}
UpdateTimestamps -p1 %{PATCH3}
mkdir -p pcsd/.bundle
cp -f %SOURCE1 pcsd/.bundle/config
@ -612,6 +616,10 @@ run_all_tests
%license pyagentx_LICENSE.txt
%changelog
* Sat Aug 25 2018 Ivan Devát <idevat@redhat.com> - 0.10.0.alpha.2-2
- Fixed error with missing rubygem location during pcsd start
- Resolves: rhbz#1618911
* Thu Aug 02 2018 Ivan Devát <idevat@redhat.com> - 0.10.0.alpha.2-1
- Rebased to latest upstream sources (see CHANGELOG.md)