summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
authorChristian Hofstaedtler <hofstaedtler@inqnet.at>2009-05-11 21:55:51 +0000
committerJames Turnbull <james@lovedthanlost.net>2009-05-20 18:37:10 +1000
commita406d585ce861757d6c14e0696a3847b46e4319d (patch)
treef114e50e9be5e9bf09ef35bf74bf754dae675d00 /lib/puppet
parentc189b46e3f179ca60dfeb8e65080d19fe653e926 (diff)
downloadpuppet-a406d585ce861757d6c14e0696a3847b46e4319d.tar.gz
puppet-a406d585ce861757d6c14e0696a3847b46e4319d.tar.xz
puppet-a406d585ce861757d6c14e0696a3847b46e4319d.zip
Fix for #2234: test fails with old Rack version
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/feature/base.rb2
-rw-r--r--lib/puppet/feature/rack.rb24
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
+