diff options
author | Christian Hofstaedtler <hofstaedtler@inqnet.at> | 2009-05-11 21:55:51 +0000 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-05-20 18:37:10 +1000 |
commit | a406d585ce861757d6c14e0696a3847b46e4319d (patch) | |
tree | f114e50e9be5e9bf09ef35bf74bf754dae675d00 /lib | |
parent | c189b46e3f179ca60dfeb8e65080d19fe653e926 (diff) | |
download | puppet-a406d585ce861757d6c14e0696a3847b46e4319d.tar.gz puppet-a406d585ce861757d6c14e0696a3847b46e4319d.tar.xz puppet-a406d585ce861757d6c14e0696a3847b46e4319d.zip |
Fix for #2234: test fails with old Rack version
Diffstat (limited to 'lib')
-rw-r--r-- | lib/puppet/feature/base.rb | 2 | ||||
-rw-r--r-- | lib/puppet/feature/rack.rb | 24 |
2 files changed, 24 insertions, 2 deletions
diff --git a/lib/puppet/feature/base.rb b/lib/puppet/feature/base.rb index 7c0f241c1..747468f74 100644 --- a/lib/puppet/feature/base.rb +++ b/lib/puppet/feature/base.rb @@ -29,5 +29,3 @@ Puppet.features.add(:augeas, :libs => ["augeas"]) # We have RRD available Puppet.features.add(:rrd, :libs => ["RRDtool"]) -# We have rack available, an HTTP Application Stack -Puppet.features.add(:rack, :libs => ["rack"]) diff --git a/lib/puppet/feature/rack.rb b/lib/puppet/feature/rack.rb new file mode 100644 index 000000000..081b9e9fb --- /dev/null +++ b/lib/puppet/feature/rack.rb @@ -0,0 +1,24 @@ +require 'puppet/util/feature' + +# See if we have rack available, an HTTP Application Stack +# Explicitly depend on rack library version >= 1.0.0 +Puppet.features.add(:rack) do + begin + require 'rack' + rescue LoadError => detail + require 'rubygems' + require 'rack' + end + + if ! (defined?(::Rack) and defined?(::Rack.release)) + false + else + major_version = ::Rack.release().split('.')[0].to_i + if major_version >= 1 + true + else + false + end + end +end + |