Skip to content

Commit

Permalink
Merge pull request #19631 from carbonin/reduce_number_of_cockpit_seli…
Browse files Browse the repository at this point in the history
…nux_changes

Reduce number of cockpit selinux changes
  • Loading branch information
jrafanie authored Dec 11, 2019
2 parents dffc990 + cbeb464 commit 771f620
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 281 deletions.
4 changes: 3 additions & 1 deletion app/models/miq_cockpit_ws_worker/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ def cockpit_ws_run
"XDG_CONFIG_DIRS" => cockpit_ws.config_dir,
"DRB_URI" => @drb_uri
}
stdin, stdout, stderr, wait_thr = Open3.popen3(env, *cockpit_ws.command(BINDING_ADDRESS))
Bundler.with_clean_env do
stdin, stdout, stderr, wait_thr = Open3.popen3(env, *cockpit_ws.command(BINDING_ADDRESS), :unsetenv_others => true)
end
stdin.close

_log.info("#{log_prefix} cockpit-ws process started - pid=#{@pid}")
Expand Down
3 changes: 2 additions & 1 deletion lib/miq_cockpit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ def save_config
fname = File.join(@cockpit_conf_dir, "cockpit.conf")
update_config
File.write(fname, @config)
AwesomeSpawn.run!("restorecon -R -v #{@cockpit_conf_dir}")
end

def web_ui_url
Expand All @@ -115,7 +116,7 @@ def web_ui_url
def update_config
title = @opts[:title] || "ManageIQ Cockpit"

login_command = Rails.root.join("tools", "cockpit", "cockpit-auth-miq")
login_command = File.join("/usr", "bin", "cockpit-auth-miq")

@config = <<-END_OF_CONFIG
[Webservice]
Expand Down
8 changes: 3 additions & 5 deletions spec/lib/miq_cockpit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
@miq_server = EvmSpecHelper.local_miq_server
@miq_server.ipaddress = "10.0.0.1"
@miq_server.has_active_userinterface = true

allow(AwesomeSpawn).to receive(:run!)
end

describe '#url' do
Expand Down Expand Up @@ -104,15 +106,11 @@
end

describe 'update_config' do
before do
@login_command = Rails.root.join("tools", "cockpit", "cockpit-auth-miq")
end

context "when using empty opts" do
it "it uses defaults" do
ins = MiqCockpit::WS.new(nil)
config = ins.update_config
expect(config).to include("\n[SSH-Login]\ncommand = #{@login_command}\n")
expect(config).to include("\n[SSH-Login]\ncommand = /usr/bin/cockpit-auth-miq\n")
expect(config).to include("\n[Basic]\nAction = none\n")
expect(config).to include("\n[Negotiate]\nAction = none\n")
expect(config).to include("\nLoginTitle = ManageIQ Cockpit\n")
Expand Down
274 changes: 0 additions & 274 deletions tools/cockpit/cockpit-auth-miq

This file was deleted.

0 comments on commit 771f620

Please sign in to comment.