From 25b22ebeb007534ef86815f4e303e773c060c722 Mon Sep 17 00:00:00 2001 From: Ivan Devat 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