summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-03 01:49:17 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-09-03 01:49:17 +0000
commit42812f8512493d319b71bcc749e1760443ee8ecc (patch)
treef304f6eacfec2383f9378073ed5f365fb9fc8754 /lib
parentfd864286ab88ae674de45fbbb0717f2b7c2182c4 (diff)
downloadpuppet-42812f8512493d319b71bcc749e1760443ee8ecc.tar.gz
puppet-42812f8512493d319b71bcc749e1760443ee8ecc.tar.xz
puppet-42812f8512493d319b71bcc749e1760443ee8ecc.zip
Applying the patch from #253 plus tests.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1533 980ebf18-57e1-0310-9a29-db15c13687c0
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.