Skip to content

Commit

Permalink
Fixes #79 - use gsub to strip trailing character(s)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtimberman authored and miketheman committed Mar 19, 2014
1 parent 0905135 commit cbfdacd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@

# Set to true to always install datadog-agent-base (usually only installed on
# systems with a version of Python lower than 2.6) instead of datadog-agent
#
# The .gsub is done because some platforms may append characters that aren't valid for a Gem::Version comparison.
begin
default['datadog']['install_base'] = Gem::Version.new(node['languages']['python']['version']) < Gem::Version.new('2.6.0')
default['datadog']['install_base'] = Gem::Version.new(node['languages']['python']['version'].gsub(/(\d\.\d\.\d).+/, "\\1")) < Gem::Version.new('2.6.0')
rescue NoMethodError # nodes['languages']['python'] == nil
Chef::Log.warn 'no version of python found'
end
Expand Down

0 comments on commit cbfdacd

Please sign in to comment.