From 7df6192dd7840e8cd9836d1c56942a74f27975cc Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Mon, 15 Jun 2020 16:18:14 -0400 Subject: [PATCH] Explicitly disable systemd support in podified env If we are on a podified environment we should explicitly disable systemd support. --- lib/miq_environment.rb | 2 +- spec/lib/miq_environment_spec.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/miq_environment.rb b/lib/miq_environment.rb index 97813acb6a1c..d3edbd6ab955 100644 --- a/lib/miq_environment.rb +++ b/lib/miq_environment.rb @@ -16,7 +16,7 @@ def self.supports_apache? def self.supports_systemd? return @supports_systemd unless @supports_systemd.nil? - @supports_systemd = is_appliance? && supports_command?('systemctl') + @supports_systemd = is_appliance? && !is_container? && supports_command?('systemctl') end def self.supports_nohup_and_backgrounding? diff --git a/spec/lib/miq_environment_spec.rb b/spec/lib/miq_environment_spec.rb index 6befc13c861e..1c24415c1103 100644 --- a/spec/lib/miq_environment_spec.rb +++ b/spec/lib/miq_environment_spec.rb @@ -115,6 +115,19 @@ def appliance_conditions assert_same_result_every_time(:is_production_build?, true) end end + + context ".supports_systemd?" do + it "returns false when containerized" do + container_conditions + assert_same_result_every_time(:supports_systemd?, false) + end + + it "returns true when appliance conditions are met" do + appliance_conditions + expect(MiqEnvironment::Command).to receive(:supports_command?).with("systemctl").and_return(true) + assert_same_result_every_time(:supports_systemd?, true) + end + end end end end