Created
May 20, 2015 21:39
-
-
Save jkeiser/f3a55b29a5732f5db1a2 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
| # cookbooks/analytics_dev/resources/packagecloud_repository.rb | |
| provides :packagecloud_repository | |
| attribute :user | |
| attribute :repo | |
| actions :setup | |
| # cookbooks/analytics_dev/providers/packagecloud_repository.rb | |
| provides :packagecloud_repository | |
| use_inline_resources | |
| include Chef::DSL::IncludeRecipe | |
| action :setup do | |
| case node['platform_family'] | |
| when 'debian' | |
| package "apt-transport-https" | |
| # TODO(jmink) This only supports ubuntu/debian at the moment | |
| apt_repository "#{new_resource.user}-#{new_resource.repo}" do | |
| uri "https://packagecloud.io/#{new_resource.user}/#{new_resource.repo}/ubuntu/" | |
| key 'https://packagecloud.io/gpg.key' | |
| distribution 'precise' # TODO(jmink) put into an attribute | |
| deb_src true | |
| trusted true | |
| components %w( main ) | |
| end | |
| # Performs an apt-get update | |
| include_recipe 'apt::default' | |
| when 'rhel' | |
| major_version = node['platform_version'].split('.').first | |
| yum_repository "#{new_resource.user}-#{new_resource.repo}" do | |
| description new_resource.name | |
| baseurl "https://packagecloud.io/#{new_resource.user}/#{new_resource.repo}/el/#{major_version}/$basearch" | |
| sslverify false | |
| gpgcheck false | |
| action :create | |
| end | |
| end | |
| end |
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
| packagecloud_repository 'Chef Stable Repository' do | |
| user 'chef' | |
| repo 'stable' | |
| end | |
| packagecloud_repository 'Chef Nightly Repository' do | |
| user 'chef' | |
| repo 'nightly' | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment