Created
December 5, 2014 16:07
-
-
Save spheromak/f6dbfea43a520023f0a0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this is so fucking ugly | |
case platform_family | |
when "debian" | |
package_options = '--force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew"' | |
include_recipe "apt" | |
apt_repository "sensu" do | |
uri node.sensu.apt_repo_url | |
key "#{node.sensu.apt_repo_url}/pubkey.gpg" | |
distribution "sensu" | |
components node.sensu.use_unstable_repo ? ["unstable"] : ["main"] | |
action :add | |
end | |
apt_preference "sensu" do | |
pin "version #{node.sensu.version}" | |
pin_priority "700" | |
end | |
else | |
rhel_version_equivalent = case platform_family | |
when "rhel" | |
platform?("amazon") || platform_version.to_i == 7 ? 6 : platform_version | |
when "fedora" | |
case platform_version | |
when 6..11 then 5 | |
when 12..18 then 6 | |
else | |
raise "Cannot map fedora version #{platform_version} to a RHEL version. aborting" | |
end | |
else | |
raise "Unsupported Linux platform family #{platform_family}" | |
end | |
repo = yum_repository "sensu" do | |
description "sensu monitoring" | |
repo = node.sensu.use_unstable_repo ? "yum-unstable" : "yum" | |
url "#{node.sensu.yum_repo_url}/#{repo}/el/#{rhel_version_equivalent}/$basearch/" | |
action :add | |
end | |
repo.gpgcheck(false) if repo.respond_to?(:gpgcheck) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment