diff options
-rw-r--r-- | lib/puppet/type/pfile.rb | 19 | ||||
-rwxr-xr-x | test/ral/types/file.rb | 9 |
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index e9500e07f..966896a04 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -1094,6 +1094,25 @@ module Puppet end private + + # Override the parent method, because we don't want to generate changes + # when the file is missing and there is no 'ensure' state. + def propertychanges + unless self.stat + found = false + ([:ensure] + CREATORS).each do |prop| + if @parameters.include?(prop) + found = true + break + end + end + unless found + return [] + end + end + super + end + # There are some cases where all of the work does not get done on # file creation/modification, so we have to do some extra checking. def property_fix diff --git a/test/ral/types/file.rb b/test/ral/types/file.rb index 9f7861787..e48b246d1 100755 --- a/test/ral/types/file.rb +++ b/test/ral/types/file.rb @@ -1775,6 +1775,15 @@ class TestFile < Test::Unit::TestCase assert(fobj, "did not create file object") assert(fobj.should(:ensure) != :directory, "ensure was passed to child") end + + # #567 + def test_missing_files_are_in_sync + file = tempfile + obj = Puppet::Type.newfile(:path => file, :mode => 0755) + + changes = obj.evaluate + assert(changes.empty?, "Missing file with no ensure resulted in changes") + end end # $Id$ |