diff options
| author | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-02-22 12:02:35 +0000 |
|---|---|---|
| committer | luke <luke@980ebf18-57e1-0310-9a29-db15c13687c0> | 2007-02-22 12:02:35 +0000 |
| commit | d145aae53ddf43de1a5140ce9226e1b2f383376f (patch) | |
| tree | fa8afbaccc5061743ea73784d0f273970af14add /lib | |
| parent | 774415b1561dcbbbb8e98c1ad48d3378e90ea791 (diff) | |
| download | puppet-d145aae53ddf43de1a5140ce9226e1b2f383376f.tar.gz puppet-d145aae53ddf43de1a5140ce9226e1b2f383376f.tar.xz puppet-d145aae53ddf43de1a5140ce9226e1b2f383376f.zip | |
Fixing #505, #508, and #513.
git-svn-id: https://reductivelabs.com/svn/puppet/trunk@2219 980ebf18-57e1-0310-9a29-db15c13687c0
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/type/pfile.rb | 38 | ||||
| -rwxr-xr-x | lib/puppet/type/pfile/ensure.rb | 13 |
2 files changed, 34 insertions, 17 deletions
diff --git a/lib/puppet/type/pfile.rb b/lib/puppet/type/pfile.rb index ad21c5c55..116c8880d 100644 --- a/lib/puppet/type/pfile.rb +++ b/lib/puppet/type/pfile.rb @@ -36,10 +36,12 @@ module Puppet a ``filebucket``, which stores files by their MD5 sums and allows easy retrieval without littering directories with backups. You can specify a local filebucket or a network-accessible - server-based filebucket. Alternatively, if you specify any - value that begins with a ``.`` (e.g., ``.puppet-bak``), then - Puppet will use copy the file in the same directory with that - value as the extension of the backup. + server-based filebucket by setting ``backup => bucket-name``. + Alternatively, if you specify any value that begins with a ``.`` + (e.g., ``.puppet-bak``), then Puppet will use copy the file in + the same directory with that value as the extension of the + backup. Setting ``backup => false`` disables all backups of the + file in question. Puppet automatically creates a local filebucket named ``puppet`` and defaults to backing up there. To use a server-based filebucket, @@ -114,13 +116,19 @@ module Puppet management." newvalues(:true, :false, :inf, /^[0-9]+$/) + + # Replace the validation so that we allow numbers in + # addition to string representations of them. + validate { |arg| } munge do |value| newval = super(value) case newval when :true, :inf: true when :false: false + when Integer, Fixnum, Bignum: value + when /^\d+$/: Integer(value) else - newval + raise ArgumentError, "Invalid recurse value %s" % value.inspect end end end @@ -1045,6 +1053,9 @@ module Puppet end end + # make sure all of the modes are actually correct + property_fix + # And then update our checksum, so the next run doesn't find it. # FIXME This is extra work, because it's going to read the whole # file back in again. @@ -1069,6 +1080,23 @@ module Puppet # yield # end end + + private + # There are some cases where all of the work does not get done on + # file creation/modification, so we have to do some extra checking. + def property_fix + self.each do |thing| + next unless thing.is_a? Puppet::Property + next unless [:mode, :owner, :group].include?(thing.name) + + # Make sure we get a new stat objct + self.stat(true) + thing.retrieve + unless thing.insync? + thing.sync + end + end + end end # Puppet.type(:pfile) # the filesource class can't include the path, because the path diff --git a/lib/puppet/type/pfile/ensure.rb b/lib/puppet/type/pfile/ensure.rb index 908c07df1..076dfbdcf 100755 --- a/lib/puppet/type/pfile/ensure.rb +++ b/lib/puppet/type/pfile/ensure.rb @@ -76,6 +76,7 @@ module Puppet Dir.mkdir(@parent[:path]) end end + @parent.send(:property_fix) @parent.setchecksum return :directory_created end @@ -156,18 +157,6 @@ module Puppet event = super - # There are some cases where all of the work does not get done on - # file creation, so we have to do some extra checking. - @parent.each do |thing| - next unless thing.is_a? Puppet::Property - next if thing == self - - thing.retrieve - unless thing.insync? - thing.sync - end - end - return event end end |
