diff options
-rw-r--r-- | lib/puppet/type/file.rb | 2 | ||||
-rwxr-xr-x | spec/unit/type/file.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb index ce1df1c35..543b0710e 100644 --- a/lib/puppet/type/file.rb +++ b/lib/puppet/type/file.rb @@ -563,7 +563,7 @@ module Puppet full_path = File.join(self[:path], path) # the right-side hash wins in the merge. - options = to_hash.merge(:path => full_path, :implicit => true) + options = to_hash.merge(:path => full_path, :implicit => true).reject { |param, value| value.nil? } [:parent, :recurse, :target].each do |param| options.delete(param) if options.include?(param) end diff --git a/spec/unit/type/file.rb b/spec/unit/type/file.rb index 327c49d9c..f0ebb49e2 100755 --- a/spec/unit/type/file.rb +++ b/spec/unit/type/file.rb @@ -513,6 +513,12 @@ describe Puppet::Type.type(:file) do Puppet::Type.type(:file).expects(:create).with { |options| ! options.include?(:target) } @file.newchild("my/path") end + + it "should not copy any nil values from the parent" do + @file.expects(:to_hash).returns :ensure => nil + Puppet::Type.type(:file).expects(:create).with { |options| ! options.include?(:ensure) } + @file.newchild("my/path") + end end end end |