Skip to content

Commit

Permalink
(BKR-1085) Sign certs *before* stopping agent service
Browse files Browse the repository at this point in the history
Previously, the simple_monolithic install method was installing agents,
stopping the agent service and then attempting to sign certificates.
This was failing sporadically because the agent service needs to run
enough to submit a certificate request before being stopped. This was
being handled properly in the generic install method, but the order of
operations was swapped in the monolithic install method.
  • Loading branch information
nicklewis committed Mar 27, 2017
1 parent 0784adc commit 3b5208e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
8 changes: 4 additions & 4 deletions lib/beaker-pe/install/pe_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -471,15 +471,15 @@ def simple_monolithic_install(master, agents, opts={})
end
end

step "Stop puppet agents to avoid interfering with tests" do
stop_agent_on(all_hosts, :run_in_parallel => true)
end

step "Sign agent certificates" do
# This will sign all cert requests
sign_certificate_for(agents)
end

step "Stop puppet agents to avoid interfering with tests" do
stop_agent_on(all_hosts, :run_in_parallel => true)
end

step "Run puppet to setup mcollective and pxp-agent" do
on all_hosts, puppet_agent('-t'), :acceptable_exit_codes => [0,2], :run_in_parallel => true

Expand Down
12 changes: 3 additions & 9 deletions spec/beaker-pe/install/pe_utils_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1293,16 +1293,10 @@ def slice_installer_options(host)
subject.simple_monolithic_install(monolithic, [el_agent, el_agent, deb_agent, deb_agent])
end

it 'signs all certificates at once' do
it 'signs certificates then stops agents to avoid interference with tests' do
agents = [el_agent, el_agent, deb_agent, deb_agent]
expect(subject).to receive(:sign_certificate_for).with(agents)

subject.simple_monolithic_install(monolithic, agents)
end

it 'stops the agents in parallel to avoid interference with tests' do
agents = [el_agent, el_agent, deb_agent, deb_agent]
expect(subject).to receive(:stop_agent_on).with([monolithic, *agents], :run_in_parallel => true)
expect(subject).to receive(:sign_certificate_for).with(agents).ordered
expect(subject).to receive(:stop_agent_on).with([monolithic, *agents], :run_in_parallel => true).ordered

subject.simple_monolithic_install(monolithic, agents)
end
Expand Down

0 comments on commit 3b5208e

Please sign in to comment.