From 196294a73e32f5f1cd511a8c23006d23839c7e57 Mon Sep 17 00:00:00 2001 From: Dan Bode Date: Wed, 16 Mar 2011 15:32:23 -0500 Subject: (4576) - if ENC declares invalid class, it is logged at warning. used to be at info, so you had to run the master on verbose to see it an ENC was trying to declare a class that could not be loaded. --- lib/puppet/parser/compiler.rb | 2 +- spec/unit/parser/compiler_spec.rb | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/puppet/parser/compiler.rb b/lib/puppet/parser/compiler.rb index fdabd05c9..6e8e3d26b 100644 --- a/lib/puppet/parser/compiler.rb +++ b/lib/puppet/parser/compiler.rb @@ -162,7 +162,7 @@ class Puppet::Parser::Compiler resource.evaluate unless lazy_evaluate found << name else - Puppet.info "Could not find class #{name} for #{node.name}" + Puppet.warning "Could not find class #{name} for #{node.name}" @catalog.tag(name) end end diff --git a/spec/unit/parser/compiler_spec.rb b/spec/unit/parser/compiler_spec.rb index 687f2ecb9..261cfdec1 100755 --- a/spec/unit/parser/compiler_spec.rb +++ b/spec/unit/parser/compiler_spec.rb @@ -581,12 +581,11 @@ describe Puppet::Parser::Compiler do @scope.expects(:find_hostclass).with("notfound").returns(nil) @compiler.evaluate_classes(%w{notfound}, @scope) end - # I wish it would fail it "should log when it can't find class" do klasses = {'foo'=>nil} @node.classes = klasses @compiler.topscope.stubs(:find_hostclass).with('foo').returns(nil) - Puppet.expects(:info).with('Could not find class foo for testnode') + Puppet.expects(:warning).with('Could not find class foo for testnode') @compiler.compile end end -- cgit From f8941b80bb8ba6042dddce02d132abe252756162 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Thu, 24 Mar 2011 11:38:42 -0700 Subject: (#4769) Fix negative timeout support for newer rubies In new versions of Ruby, negative timeouts are unsupported. So munge negatives to zero in the parameter. Reviewed-By: Jacob Helwig --- lib/puppet/type/exec.rb | 14 ++++++-------- spec/unit/type/exec_spec.rb | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/lib/puppet/type/exec.rb b/lib/puppet/type/exec.rb index 4458bf081..be0ece023 100755 --- a/lib/puppet/type/exec.rb +++ b/lib/puppet/type/exec.rb @@ -229,19 +229,17 @@ module Puppet newparam(:timeout) do desc "The maximum time the command should take. If the command takes longer than the timeout, the command is considered to have failed - and will be stopped. Use any negative number to disable the timeout. + and will be stopped. Use 0 to disable the timeout. The time is specified in seconds." munge do |value| value = value.shift if value.is_a?(Array) - if value.is_a?(String) - unless value =~ /^[-\d.]+$/ - raise ArgumentError, "The timeout must be a number." - end - Float(value) - else - value + begin + value = Float(value) + rescue ArgumentError => e + raise ArgumentError, "The timeout must be a number." end + [value, 0.0].max end defaultto 300 diff --git a/spec/unit/type/exec_spec.rb b/spec/unit/type/exec_spec.rb index 07ad1df4c..e155506b0 100755 --- a/spec/unit/type/exec_spec.rb +++ b/spec/unit/type/exec_spec.rb @@ -336,7 +336,7 @@ describe Puppet::Type.type(:exec) do end describe "when setting timeout" do - [-3.5, -1, 0, 0.1, 1, 10, 4294967295].each do |valid| + [0, 0.1, 1, 10, 4294967295].each do |valid| it "should accept '#{valid}' as valid" do @exec[:timeout] = valid @exec[:timeout].should == valid @@ -348,7 +348,7 @@ describe Puppet::Type.type(:exec) do end end - ['1/2', '1_000_000', '+12', '', 'foo'].each do |invalid| + ['1/2', '', 'foo', '5foo'].each do |invalid| it "should reject '#{invalid}' as invalid" do expect { @exec[:timeout] = invalid }. should raise_error Puppet::Error, /The timeout must be a number/ @@ -366,6 +366,18 @@ describe Puppet::Type.type(:exec) do sleep_exec = Puppet::Type.type(:exec).new(:name => 'sleep 1', :path => ['/bin'], :timeout => '0.2') lambda { sleep_exec.refresh }.should raise_error Puppet::Error, "Command exceeded timeout" end + + it "should convert timeout to a float" do + resource = Puppet::Type.type(:exec).new :command => "/bin/false", :timeout => "12" + resource[:timeout].should be_a(Float) + resource[:timeout].should == 12.0 + end + + it "should munge negative timeouts to 0.0" do + resource = Puppet::Type.type(:exec).new :command => "/bin/false", :timeout => "-12.0" + resource.parameter(:timeout).value.should be_a(Float) + resource.parameter(:timeout).value.should == 0.0 + end end describe "when setting tries" do -- cgit From 357514ceec94df18abf98e5b906b50cb0dcf4cbd Mon Sep 17 00:00:00 2001 From: James Turnbull Date: Sat, 22 Jan 2011 04:32:10 +1100 Subject: (#5221) Fix fileset path absoluteness checking with trailing slash Reviewed-By: Nick Lewis Reviewed-By: Pieter van de Bruggen --- lib/puppet/file_serving/fileset.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/puppet/file_serving/fileset.rb b/lib/puppet/file_serving/fileset.rb index fdbcf93a3..c020f036d 100644 --- a/lib/puppet/file_serving/fileset.rb +++ b/lib/puppet/file_serving/fileset.rb @@ -59,6 +59,7 @@ class Puppet::FileServing::Fileset end def initialize(path, options = {}) + path = path.chomp(File::SEPARATOR) raise ArgumentError.new("Fileset paths must be fully qualified") unless File.expand_path(path) == path @path = path -- cgit From 7761acb5acd998d172b04adb8368a6a672fcde25 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Thu, 24 Mar 2011 14:04:04 -0700 Subject: (#5221) Add test for fix to fileset with trailing separator Reviewed-By: Pieter van de Bruggen --- spec/unit/file_serving/fileset_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/unit/file_serving/fileset_spec.rb b/spec/unit/file_serving/fileset_spec.rb index ecc77812c..149c68c4a 100755 --- a/spec/unit/file_serving/fileset_spec.rb +++ b/spec/unit/file_serving/fileset_spec.rb @@ -13,6 +13,14 @@ describe Puppet::FileServing::Fileset, " when initializing" do proc { Puppet::FileServing::Fileset.new("some/file") }.should raise_error(ArgumentError) end + it "should not fail if the path is fully qualified, with a trailing separator" do + path = "/some/path/with/trailing/separator" + path_with_separator = "#{path}#{File::SEPARATOR}" + File.stubs(:lstat).with(path).returns stub('stat') + fileset = Puppet::FileServing::Fileset.new(path_with_separator) + fileset.path.should == path + end + it "should fail if its path does not exist" do File.expects(:lstat).with("/some/file").returns nil proc { Puppet::FileServing::Fileset.new("/some/file") }.should raise_error(ArgumentError) -- cgit From 76b3ee6822f52b100c45cd8921f13739f12ddf38 Mon Sep 17 00:00:00 2001 From: Jacob Helwig Date: Thu, 24 Mar 2011 15:33:35 -0700 Subject: Update CHANGELOG for 2.6.7 --- CHANGELOG | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 2885596e3..755dd82a8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ -2.6.7rc1 -======== +2.6.7 +===== +17f673d Updated CHANGELOG for 2.6.7rc1 852fb97 (#5073) Download plugins even if you're filtering on tags 4f34dbf Fix #5610: Prevent unnecessary RAL lookups 9781032 Revert "Merge branch 'ticket/2.6.x/5605' of git://github.com/stschulte/puppet into 2.6.next" -- cgit