[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. puppet-0.24.5-rc3-1456-g2f0b1e5
James Turnbull
james at lovedthanlost.net
Tue Oct 27 17:05:47 UTC 2009
The following commit has been merged in the upstream branch:
commit fd322daa42f751bfc6200b95e6151540b3eb541e
Author: James Turnbull <james at lovedthanlost.net>
Date: Tue Sep 22 13:24:31 2009 +1000
Fixes #1538 - Fixes the yumrepo backtrace in noop mode.
Yumrepo type will now chmod on all files when a change happens. If the content is not changed then no chmod will occur.
diff --git a/lib/puppet/type/yumrepo.rb b/lib/puppet/type/yumrepo.rb
index 5d6a727..39b9cd3 100644
--- a/lib/puppet/type/yumrepo.rb
+++ b/lib/puppet/type/yumrepo.rb
@@ -178,9 +178,16 @@ module Puppet
# Store all modifications back to disk
def self.store
- file = inifile.store
- unless file.nil?
- File.chmod(0644, file)
+ inifile.store
+ unless Puppet[:noop]
+ target_mode = 0644 # FIXME: should be configurable
+ inifile.each_file do |file|
+ current_mode = File.stat(file).mode & 0777
+ unless current_mode == target_mode
+ Puppet::info "changing mode of #{file} from %03o to %03o" % [current_mode, target_mode]
+ File.chmod(target_mode, file)
+ end
+ end
end
end
diff --git a/lib/puppet/util/inifile.rb b/lib/puppet/util/inifile.rb
index 3c82f7d..eb943fe 100644
--- a/lib/puppet/util/inifile.rb
+++ b/lib/puppet/util/inifile.rb
@@ -180,6 +180,14 @@ module Puppet::Util::IniConfig
end
end
+ # Execute BLOCK, passing each file constituting this inifile
+ # as an argument
+ def each_file(&block)
+ @files.keys.each do |file|
+ yield(file)
+ end
+ end
+
# Return the Section with the given name or nil
def [](name)
name = name.to_s
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list