diff options
author | Luke Kanies <luke@madstop.com> | 2008-07-02 18:36:05 -0500 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-07-02 18:36:05 -0500 |
commit | 3795654323dfdfe468f5dddfdc16787b883752db (patch) | |
tree | 6d0a36efa4059823a18c0a664053e7e615b4be62 /lib | |
parent | 8e4312ed249d83ece754b80e993fa0d86bd36d46 (diff) | |
parent | e03c1be35c5f04ba0e3d301579e8493c00d2ecf9 (diff) | |
download | puppet-3795654323dfdfe468f5dddfdc16787b883752db.tar.gz puppet-3795654323dfdfe468f5dddfdc16787b883752db.tar.xz puppet-3795654323dfdfe468f5dddfdc16787b883752db.zip |
Merge branch '0.24.x'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/sslcertificates/support.rb | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/puppet/sslcertificates/support.rb b/lib/puppet/sslcertificates/support.rb index 1d692c994..95f15f0a8 100644 --- a/lib/puppet/sslcertificates/support.rb +++ b/lib/puppet/sslcertificates/support.rb @@ -28,7 +28,8 @@ module Puppet::SSLCertificates::Support # Define the reading method. define_method(reader) do - return nil unless FileTest.exists?(Puppet[param]) + return nil unless FileTest.exists?(Puppet[param]) or rename_files_with_uppercase(Puppet[param]) + begin instance_variable_set(var, klass.new(File.read(Puppet[param]))) rescue => detail @@ -121,5 +122,24 @@ module Puppet::SSLCertificates::Support end return retrieved end -end + # A hack method to deal with files that exist with a different case. + # Just renames it; doesn't read it in or anything. + def rename_files_with_uppercase(file) + dir = File.dirname(file) + short = File.basename(file) + raise ArgumentError, "Tried to fix SSL files to a file containing uppercase" unless short.downcase == short + real_file = Dir.entries(dir).reject { |f| f =~ /^\./ }.find do |other| + other.downcase == short + end + + return nil unless real_file + + full_file = File.join(dir, real_file) + + Puppet.notice "Fixing case in %s; renaming to %s" % [full_file, file] + File.rename(full_file, file) + + return true + end +end |