From 65f6656b58f35faa6566b27a0595c656a0e36765 Mon Sep 17 00:00:00 2001 From: luke Date: Sun, 30 Apr 2006 19:04:24 +0000 Subject: Added some code that could be used later to make sure the user and mode are also copied on backups. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1151 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/type/pfile.rb | 4 ++-- test/types/file.rb | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index c383dfc93..8d4cf86bf 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -271,8 +271,8 @@ module Puppet end end begin - # Shouldn't this just use a Puppet object with 'source' - # specified? + # FIXME Shouldn't this just use a Puppet object with + # 'source' specified? bfile = file + backup FileUtils.cp(file, bfile) diff --git a/test/types/file.rb b/test/types/file.rb index 2eeb2b2a5..18dedd02d 100644 --- a/test/types/file.rb +++ b/test/types/file.rb @@ -1091,6 +1091,15 @@ class TestFile < Test::Unit::TestCase ) } +# user = group = nil +# if Process.uid == 0 +# user = nonrootuser +# group = nonrootgroup +# obj[:owner] = user.name +# obj[:group] = group.name +# File.chown(user.uid, group.gid, file) +# end + assert_apply(obj) backupfile = file + obj[:backup] @@ -1101,6 +1110,11 @@ class TestFile < Test::Unit::TestCase assert_equal(0411, filemode(backupfile), "File mode is wrong for backupfile") +# if Process.uid == 0 +# assert_equal(user.uid, File.stat(backupfile).uid) +# assert_equal(group.gid, File.stat(backupfile).gid) +# end + bucket = "bucket" bpath = tempfile() Dir.mkdir(bpath) -- cgit