Skip to content

Instantly share code, notes, and snippets.

@trilitheus
Last active August 29, 2015 14:02
Show Gist options
  • Save trilitheus/900c7f4b933500ded24d to your computer and use it in GitHub Desktop.
Save trilitheus/900c7f4b933500ded24d to your computer and use it in GitHub Desktop.
platform case
case node['platform']
when 'oracle'
case node['platform_version'].to_i
when '5'
pkg_src = 'http://myrepo/mypkg.OEL5.x86_64.rpm'
when '6'
pkg_src = 'http://myrepo/mypkg.OEL6.x86_64.rpm'
end
when 'redhat', 'centos'
case node['platform_version'].to_i
when '5'
pkg_src = 'http://myrepo/mypkg.RHEL5.x86_64.rpm'
when '6'
pkg_src = 'http://myrepo/mypkg.RHEL6.x86_64.rpm'
end
end
package 'mypkg' do
source pkg_src
end
@trilitheus
Copy link
Author

This fails as converting node['platform_version'] to an integer but then the case statement test against a string. Remove the single quotes around 5 and 6 for this to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment