Please review pull request #182: (Maint) Don't run puppet agent in the background during test run opened by (joshcooper)

Description:

Previously, the setup/pe/01_PE-InstallPuppet.rb and
02_PE-InstallWindows.rb tests would install the PE agent, and cause
the agent to run in the background every runinterval seconds.

Meanwhile, setup/pe/05_Agent_test.rb would try to run puppet agent
--test
to verify that the agent could connect to the master, retrieve
its SSL certificate, etc.

This causes a second puppet process to start up and contend for the
puppet lock file. Most of the time the first puppet process releases
the lock file and sleeps for 30 minutes, before the 05_Agent_test runs.
But sometimes the first process still has the file locked, e.g.
because it's pluginsync'ing from the master. If so, 05_Agent_test fails
with notice: Run of Puppet configuration client already in progress;
skipping

Since none of the PE acceptance tests rely on having a puppet agent
running in the background, this commit stops all agents before
proceeding. The logic for how to stop the agent was copied from
setup/pe_co/05_Agent_test.rb.

  • Opened: Mon Mar 26 20:08:15 UTC 2012
  • Based on: puppetlabs:master (8b1ebc54f95c213fd48552bbffe829c89b01e4cd)
  • Requested merge: joshcooper:maint/master/stop-pe-agent-while-running (406ceb4ef753836dcce1977901b2b3ef35d75bb2)

Diff follows:

diff --git a/setup/pe/05_Agent_test.rb b/setup/pe/05_Agent_test.rb
index 06f2e74..a201a5b 100755
--- a/setup/pe/05_Agent_test.rb
+++ b/setup/pe/05_Agent_test.rb
@@ -1,6 +1,21 @@
 test_name "Agent --test post install"
-step 'Running puppet agent --test on each agent'
 
+agents.each do |agent|
+  step "Stopping puppet agent on #{agent}"
+
+  if agent['platform'].include?('solaris')
+    on(agent, '/usr/sbin/svcadm disable -s svc:/network/puppetagent:default')
+  elsif agent['platform'].include?('debian') or agent['platform'].include?('ubuntu')
+    on(agent, '/etc/init.d/pe-puppet-agent stop')
+  elsif agent['platform'].include?('windows')
+    on(agent, 'net stop puppet', :acceptable_exit_codes => [0,2])
+  else
+    on(agent, '/etc/init.d/pe-puppet stop')
+  end
+end
+
+step 'Sleeping'
 sleep 20
 
+step 'Running puppet agent --test on each agent'
 on agents, puppet_agent('--test'), :acceptable_exit_codes => [0,2]

    

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-dev@googlegroups.com.
To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to