Skip to content

Commit

Permalink
Explicitly disable systemd support in podified env
Browse files Browse the repository at this point in the history
If we are on a podified environment we should explicitly disable systemd
support.
  • Loading branch information
agrare committed Jun 15, 2020
1 parent 8815eec commit 7df6192
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/miq_environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
13 changes: 13 additions & 0 deletions spec/lib/miq_environment_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7df6192

Please sign in to comment.