From 37d2850ade3c4e8e94f3abdbc01afc159ed7dbd0 Mon Sep 17 00:00:00 2001 From: luke Date: Tue, 2 May 2006 15:29:57 +0000 Subject: Switching to just using "preserve" for file copying in file#handlebackups git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1164 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/type/pfile.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/puppet') diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index 44d888ce2..ef55eef0e 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -274,12 +274,10 @@ module Puppet # FIXME Shouldn't this just use a Puppet object with # 'source' specified? bfile = file + backup - FileUtils.cp(file, bfile) - unless File.stat(file).mode == File.stat(bfile).mode - mode = File.stat(file).mode & 007777 - File.chmod(mode, bfile) - end + # Ruby 1.8.1 requires the 'preserve' addition, but + # later versions do not appear to require it. + FileUtils.cp(file, bfile, :preserve => true) return true rescue => detail # since they said they want a backup, let's error out -- cgit