diff options
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/type/file.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/puppet/type/file.rb b/lib/puppet/type/file.rb index 0fc2c9626..f62af871e 100644 --- a/lib/puppet/type/file.rb +++ b/lib/puppet/type/file.rb @@ -722,8 +722,14 @@ module Puppet remove_existing(:file) use_temporary_file = (content.length != 0) - path = self[:path] - path += ".puppettmp" if use_temporary_file + if use_temporary_file + path = "#{self[:path]}.puppettmp_#{rand(10000)}" + while File.exists?(path) or File.symlink?(path) + path = "#{self[:path]}.puppettmp_#{rand(10000)}" + end + else + path = self[:path] + end mode = self.should(:mode) # might be nil umask = mode ? 000 : 022 |