Please review pull request #446: (#12386) Disable puppet kick application on windows opened by (joshcooper)

Description:

Previously, running puppet kick on Windows would go into an infinite
loop, because the win32-process version of Process.wait returns nil
instead of Errno::ECHILD, if there are no child processes. This was
causing puppet kick to go into an infinite loop.

This commit disables the puppet kick application on Windows, in the
same way that we handle running puppet master on Windows. I also
audited the code base to ensure Process.wait is not being used
elsewhere, and it's not.

  • Opened: Thu Feb 02 20:23:03 UTC 2012
  • Based on: puppetlabs:2.7.x (132a2efed31bdca56623589e505f4b641d31dbc5)
  • Requested merge: joshcooper:ticket/2.7.x/12386-disable-kick-on-windows (5225d39435cfe14119474540a5d5d6a7d057be9e)

Diff follows:

diff --git a/acceptance/tests/ticket_3172_puppet_kick_with_hostnames_on_the_command_line.rb b/acceptance/tests/ticket_3172_puppet_kick_with_hostnames_on_the_command_line.rb
index 24dd725..0605dd3 100644
--- a/acceptance/tests/ticket_3172_puppet_kick_with_hostnames_on_the_command_line.rb
+++ b/acceptance/tests/ticket_3172_puppet_kick_with_hostnames_on_the_command_line.rb
@@ -3,7 +3,13 @@
 
 target = 'working.example.org'
 agents.each do |host|
-  on(host, puppet_kick(target), :acceptable_exit_codes => [3]) {
-    assert_match(/Triggering #{target}/, stdout, "didn't trigger #{target} on #{host}" )
-  }
+  if host['platform'].include?('windows')
+    on(host, puppet_kick(target), :acceptable_exit_codes => [1]) {
+      assert_match(/Puppet kick is not supported/, stderr)
+    }
+  else
+    on(host, puppet_kick(target), :acceptable_exit_codes => [3]) {
+      assert_match(/Triggering #{target}/, stdout, "didn't trigger #{target} on #{host}" )
+    }
+  end
 end
diff --git a/lib/puppet/application/kick.rb b/lib/puppet/application/kick.rb
index 72f0608..bf6178e 100644
--- a/lib/puppet/application/kick.rb
+++ b/lib/puppet/application/kick.rb
@@ -287,6 +287,8 @@ def preinit
   end
 
   def setup
+    raise Puppet::Error.new("Puppet kick is not supported on Microsoft Windows") if Puppet.features.microsoft_windows?
+
     if options[:debug]
       Puppet::Util::Log.level = :debug
     else
diff --git a/spec/unit/application/kick_spec.rb b/spec/unit/application/kick_spec.rb
index b24e784..361aafb 100755
--- a/spec/unit/application/kick_spec.rb
+++ b/spec/unit/application/kick_spec.rb
@@ -126,6 +126,12 @@
       @kick.options.stubs(:[]).with(any_parameters)
     end
 
+    it "should abort stating that kick is not supported on Windows" do
+      Puppet.features.stubs(:microsoft_windows?).returns(true)
+
+      expect { @kick.setup }.to raise_error(Puppet::Error, /Puppet kick is not supported on Microsoft Windows/)
+    end
+
     it "should set log level to debug if --debug was passed" do
       @kick.options.stubs(:[]).with(:debug).returns(true)
       @kick.setup

    

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

Reply via email to