summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-13 17:26:32 +0000
committerluke <luke@980ebf18-57e1-0310-9a29-db15c13687c0>2006-06-13 17:26:32 +0000
commitc380bfe234769165ba5c2e2d197dd1a1bdfa3e2b (patch)
tree585f99222d834c6a2e070527ffddb0e82061a1ae /lib/puppet
parent90762c55bc48d2af2ebba13898fe6134f087ed18 (diff)
downloadpuppet-c380bfe234769165ba5c2e2d197dd1a1bdfa3e2b.tar.gz
puppet-c380bfe234769165ba5c2e2d197dd1a1bdfa3e2b.tar.xz
puppet-c380bfe234769165ba5c2e2d197dd1a1bdfa3e2b.zip
Fixing the main bug reported on the list today relating to file sourcing truncating linked-to files.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1258 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/type/pfile.rb14
-rwxr-xr-xlib/puppet/type/pfile/source.rb4
2 files changed, 14 insertions, 4 deletions
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb
index 388e05388..7ff7576ab 100644
--- a/lib/puppet/type/pfile.rb
+++ b/lib/puppet/type/pfile.rb
@@ -103,12 +103,12 @@ module Puppet
newvalues(:true, :false, :inf, /^[0-9]+$/)
munge do |value|
- value = super
- case value
+ newval = super(value)
+ case newval
when :true, :inf: true
when :false: false
else
- value
+ newval
end
end
end
@@ -863,9 +863,15 @@ module Puppet
def write(usetmp = true)
mode = self.should(:mode)
- if FileTest.exists?(self[:path])
+ #if FileTest.exists?(self[:path])
+ if s = stat(false)
# this makes sure we have a copy for posterity
@backed = self.handlebackup
+
+ if s.ftype == "link" and self[:links] != :follow
+ # Remove existing links, since we're writing out a file
+ File.unlink(self[:path])
+ end
end
# The temporary file
diff --git a/lib/puppet/type/pfile/source.rb b/lib/puppet/type/pfile/source.rb
index 0e63485a9..53e5d18b3 100755
--- a/lib/puppet/type/pfile/source.rb
+++ b/lib/puppet/type/pfile/source.rb
@@ -183,6 +183,10 @@ module Puppet
# here doesn't really matter, because the @should values will be
# overridden when we 'retrieve'.
munge do |source|
+ if source.is_a? Symbol
+ return source
+ end
+
# Remove any trailing slashes
source.sub!(/\/$/, '')
unless @parent.uri2obj(source)