summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/puppet/type/pfile.rb7
-rwxr-xr-xlib/puppet/type/pfile/source.rb9
2 files changed, 15 insertions, 1 deletions
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb
index a6892c88e..3dd201baa 100644
--- a/lib/puppet/type/pfile.rb
+++ b/lib/puppet/type/pfile.rb
@@ -113,6 +113,13 @@ module Puppet
end
end
+ newparam(:replace) do
+ desc "Whether or not to replace a file that is
+ sourced but exists. This is useful for using file sources
+ purely for initialization."
+ defaultto true
+ end
+
newparam(:ignore) do
desc "A parameter which omits action on files matching
specified patterns during recursion. Uses Ruby's builtin globbing
diff --git a/lib/puppet/type/pfile/source.rb b/lib/puppet/type/pfile/source.rb
index c0bfab310..1d00f7a3d 100755
--- a/lib/puppet/type/pfile/source.rb
+++ b/lib/puppet/type/pfile/source.rb
@@ -132,7 +132,14 @@ module Puppet
self.info "File does not have checksum"
@is = :absent
end
-
+ # if replace => false then fake the checksum so that the file
+ # is not overwritten.
+ unless @is == :absent
+ unless @parent[:replace]
+ info "Not replacing existing file"
+ @is = @stats[:checksum]
+ end
+ end
@should = [@stats[:checksum]]
# If we're a directory, then do not copy anything, and instead just
# create the directory using the 'create' state.