Initial Chef repository

This commit is contained in:
Greg Karékinian
2015-07-21 19:45:23 +02:00
parent 7e5401fc71
commit ee4079fa85
1151 changed files with 185163 additions and 0 deletions

19
cookbooks/packagecloud/.gitignore vendored Normal file
View File

@@ -0,0 +1,19 @@
*~
*#
.#*
\#*#
.*.sw[a-z]
*.un~
pkg/
# Berkshelf
.vagrant
/cookbooks
Berksfile.lock
# Bundler
Gemfile.lock
bin/*
.bundle/*
.kitchen

View File

@@ -0,0 +1,79 @@
---
driver_plugin: vagrant
driver_config:
require_chef_omnibus: true
platforms:
- name: ubuntu-10.04
driver_config:
box: opscode-ubuntu-10.04
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-10.04_provisionerless.box
run_list:
- recipe[packagecloud_test::lucid_deps]
- recipe[packagecloud_test::deb]
- recipe[packagecloud_test::rubygems_private]
- name: ubuntu-12.04
driver_config:
box: opscode-ubuntu-12.04
box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box
run_list:
- recipe[packagecloud_test::precise_deps]
- recipe[packagecloud_test::deb]
- recipe[packagecloud_test::rubygems_private]
- name: ubuntu-14.04
driver_config:
box: opscode-ubuntu-14.04
box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box
run_list:
- recipe[packagecloud_test::trusty_deps]
- recipe[packagecloud_test::deb]
- recipe[packagecloud_test::rubygems]
- name: centos-without-epel-5.10
driver_config:
box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.10_chef-provisionerless.box
run_list:
- recipe[packagecloud_test::rpm]
- recipe[packagecloud_test::rubygems]
- name: centos-with-epel-5.10
driver_config:
box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.10_chef-provisionerless.box
run_list:
- recipe[packagecloud_test::epel5]
- recipe[packagecloud_test::rpm]
- recipe[packagecloud_test::rubygems_private]
- name: centos-6.5
run_list:
- recipe[packagecloud_test::rpm]
- recipe[packagecloud_test::rubygems]
- name: centos-7.0
run_list:
- recipe[packagecloud_test::rpm]
- recipe[packagecloud_test::rubygems_private]
- name: amazon-2014.09
driver_plugin: ec2
driver_config:
image_id: ami-b5a7ea85
username: ec2-user
aws_access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
aws_secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
aws_ssh_key_id: <%= ENV['AWS_KEYPAIR_NAME'] %>
ssh_key: <%= ENV['AWS_SSH_KEY_PATH'] %>
availability_zone: us-west-2a
region: us-west-2
flavor_id: t2.micro
security_group_ids: sg-598e583c
run_list:
- recipe[packagecloud_test::rpm]
- recipe[packagecloud_test::rubygems]
suites:
- name: default
run_list:
attributes: {}

View File

@@ -0,0 +1,28 @@
AllCops:
Include:
- Berksfile
- Gemfile
- Rakefile
- Thorfile
- Guardfile
Exclude:
- vendor/**
ClassLength:
Enabled: false
Documentation:
Enabled: false
Encoding:
Enabled: false
HashSyntax:
Enabled: false
LineLength:
Enabled: false
MethodLength:
Enabled: false
SignalException:
Enabled: false
TrailingComma:
Enabled: false
WordArray:
Enabled: false

View File

@@ -0,0 +1,7 @@
language: ruby
rvm:
- 1.9.3
- 2.0.0
bundler_args: --without integration
script:
- bundle exec rake travis

View File

@@ -0,0 +1,65 @@
From e705e0beb6cd93447dec04aea8bdda004fbb8ab7 Mon Sep 17 00:00:00 2001
From: capotej <jcapote@gmail.com>
Date: Tue, 28 Oct 2014 12:47:17 -0700
Subject: [PATCH] chef on amazon 2014
---
.kitchen.yml | 23 ++++++++++++++++++++---
Gemfile | 1 +
2 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/.kitchen.yml b/.kitchen.yml
index a389d99..fbebe56 100644
--- a/.kitchen.yml
+++ b/.kitchen.yml
@@ -25,7 +25,7 @@ platforms:
- name: ubuntu-14.04
driver_config:
box: opscode-ubuntu-14.04
- box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-14.04_provisionerless.box
+ box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box
run_list:
- recipe[packagecloud_test::trusty_deps]
- recipe[packagecloud_test::deb]
@@ -56,7 +56,24 @@ platforms:
- recipe[packagecloud_test::rpm]
- recipe[packagecloud_test::rubygems_private]
+- name: amazon-2014.09
+ driver_plugin: ec2
+ driver_config:
+ image_id: ami-b5a7ea85
+ username: ec2-user
+ aws_access_key_id: <%= ENV['AWS_ACCESS_KEY_ID'] %>
+ aws_secret_access_key: <%= ENV['AWS_SECRET_ACCESS_KEY'] %>
+ aws_ssh_key_id: <%= ENV['AWS_KEYPAIR_NAME'] %>
+ ssh_key: <%= ENV['AWS_SSH_KEY_PATH'] %>
+ availability_zone: us-west-2a
+ region: us-west-2
+ flavor_id: t2.micro
+ security_group_ids: sg-598e583c
+ run_list:
+ - recipe[packagecloud_test::rpm]
+ - recipe[packagecloud_test::rubygems]
+
suites:
- name: default
- run_list:
- attributes: {}
+run_list:
+attributes: {}
diff --git a/Gemfile b/Gemfile
index 9ce1223..9b9ee17 100644
--- a/Gemfile
+++ b/Gemfile
@@ -2,6 +2,7 @@ source 'https://rubygems.org'
gem 'rake'
gem 'berkshelf', '~> 3.1.4'
+gem 'kitchen-ec2'
group :test do
gem 'foodcritic', '~> 4.0.0'
--
1.9.2

View File

@@ -0,0 +1,5 @@
source 'https://api.berkshelf.com'
metadata
cookbook 'packagecloud_test', :path => 'test/fixtures/cookbooks/packagecloud_test'

View File

@@ -0,0 +1,12 @@
packagecloud
===============
This is the Changelog for the packagecloud cookbook
v0.0.1 (2014-06-05)
-------------------
Initial release.
v0.0.1 (2014-06-05)
-------------------
Initial release!

View File

@@ -0,0 +1,15 @@
source 'https://rubygems.org'
gem 'rake'
gem 'berkshelf', '~> 3.1.4'
gem 'kitchen-ec2'
group :test do
gem 'foodcritic', '~> 4.0.0'
gem 'rubocop', '~> 0.24.1'
end
group :integration do
gem 'test-kitchen', '~> 1.2.1'
gem 'kitchen-vagrant', '~> 0.15.0'
end

View File

@@ -0,0 +1,13 @@
Copyright (C) 2014 Computology, LLC.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,64 @@
# packagecloud cookbook
This cookbook provides an LWRP for installing https://packagecloud.io repositories.
## Usage
Be sure to depend on `packagecloud` in `metadata.rb` so that the packagecloud
resource will be loaded.
For public repos:
```ruby
packagecloud_repo "computology/packagecloud-cookbook-test-public" do
type "deb"
end
```
For private repos, you need to supply a `master_token`:
```ruby
packagecloud_repo "computology/packagecloud-cookbook-test-private" do
type "deb"
master_token "762748f7ae0bfdb086dd539575bdc8cffdca78c6a9af0db9"
end
```
For packagecloud:enterprise users, add `base_url` to your resource:
```
packagecloud_repo "computology/packagecloud-cookbook-test-private" do
base_url "https://packages.example.com"
type "deb"
master_token "762748f7ae0bfdb086dd539575bdc8cffdca78c6a9af0db9"
end
```
Valid options for `type` include `deb`, `rpm`, and `gem`.
## Interactions with other cookbooks
On CentOS 5, the official chef yum cookbook overwrites the file
`/etc/yum.conf` setting some default values. When it does this, the `cachedir`
value is changed from the CentOS5 default to the default value in the
cookbook. The result of this change is that any packagecloud repository
installed *before* a repository installed with the yum cookbook will appear as
though it's gpg keys were not imported.
There are a few potential workarounds for this:
- Pass the "-y" flag to package resource using the `options` attribute. This
should cause yum to import the GPG key automatically if it was not imported
already.
- Move your packagecloud repos so that they are installed last, after any/all
repos installed via the yum cookbook.
- Set the cachedir option in the chef yum cookbook to the system default value
of `/var/cache/yum` using the `yum_globalconfig` resource.
CentOS 6 and 7 are not affected as the default `cachedir` value provided by
the yum chef cookbook is set to the system default, unless you use the
`yum_globalconfig` resource to set a custom cachedir. If you do set a custom
`cachedir`, you should make sure to setup packagecloud repos after that
resource is set so that the GPG keys end up in the right place.
## Credits
Computology, LLC.

View File

@@ -0,0 +1,47 @@
#!/usr/bin/env rake
# Style tests. Rubocop and Foodcritic
namespace :style do
begin
require 'rubocop/rake_task'
desc 'Run Ruby style checks'
RuboCop::RakeTask.new(:ruby)
rescue LoadError
puts '>>>>> Rubocop gem not loaded, omitting tasks' unless ENV['CI']
end
begin
require 'foodcritic'
desc 'Run Chef style checks'
FoodCritic::Rake::LintTask.new(:chef) do |t|
t.options = {
fail_tags: ['any'],
tags: ['~FC003']
}
end
rescue LoadError
puts '>>>>> foodcritic gem not loaded, omitting tasks' unless ENV['CI']
end
end
desc 'Run all style checks'
task style: ['style:chef', 'style:ruby']
# Integration tests. Kitchen.ci
namespace :integration do
begin
require 'kitchen/rake_tasks'
desc 'Run kitchen integration tests'
Kitchen::RakeTasks.new
rescue LoadError
puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
end
end
desc 'Run all tests on Travis'
task travis: ['style']
# Default
task default: ['style', 'integration:kitchen:all']

View File

@@ -0,0 +1,5 @@
The following people have contributed to packagecloud chef cookbook (If you're not listed here and you should be, please let us know!):
THANKS
------
Guilhem Lettron (@guilhem)

View File

@@ -0,0 +1,5 @@
# encoding: utf-8
require 'bundler'
require 'bundler/setup'
require 'berkshelf/thor'

85
cookbooks/packagecloud/Vagrantfile vendored Normal file
View File

@@ -0,0 +1,85 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.require_version ">= 1.5.0"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
config.vm.hostname = "packagecloud-berkshelf"
# Set the version of chef to install using the vagrant-omnibus plugin
config.omnibus.chef_version = :latest
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "opscode_ubuntu-12.04_provisionerless"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box"
# Assign this VM to a host-only network IP, allowing you to access it
# via the IP. Host-only networks can talk to the host machine as well as
# any other machines on the same network, but cannot be accessed (through this
# network interface) by any external networks.
config.vm.network :private_network, type: "dhcp"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider :virtualbox do |vb|
# # Don't boot with headless mode
# vb.gui = true
#
# # Use VBoxManage to customize the VM. For example to change memory:
# vb.customize ["modifyvm", :id, "--memory", "1024"]
# end
#
# View the documentation for the provider you're using for more
# information on available options.
# The path to the Berksfile to use with Vagrant Berkshelf
# config.berkshelf.berksfile_path = "./Berksfile"
# Enabling the Berkshelf plugin. To enable this globally, add this configuration
# option to your ~/.vagrant.d/Vagrantfile file
config.berkshelf.enabled = true
# An array of symbols representing groups of cookbook described in the Vagrantfile
# to exclusively install and copy to Vagrant's shelf.
# config.berkshelf.only = []
# An array of symbols representing groups of cookbook described in the Vagrantfile
# to skip installing and copying to Vagrant's shelf.
# config.berkshelf.except = []
config.vm.provision :chef_solo do |chef|
chef.json = {
mysql: {
server_root_password: 'rootpass',
server_debian_password: 'debpass',
server_repl_password: 'replpass'
}
}
chef.run_list = [
"recipe[packagecloud::default]"
]
end
end

View File

@@ -0,0 +1,7 @@
default['packagecloud']['base_repo_path'] = "/install/repositories/"
default['packagecloud']['gpg_key_path'] = "/gpg.key"
default['packagecloud']['default_type'] = value_for_platform_family(
'debian' => 'deb',
['rhel', 'fedora'] => 'rpm'
)

View File

@@ -0,0 +1,98 @@
# Put files/directories that should be ignored in this file when uploading
# or sharing to the community site.
# Lines that start with '# ' are comments.
# OS generated files #
######################
.DS_Store
Icon?
nohup.out
ehthumbs.db
Thumbs.db
# SASS #
########
.sass-cache
# EDITORS #
###########
\#*
.#*
*~
*.sw[a-z]
*.bak
REVISION
TAGS*
tmtags
*_flymake.*
*_flymake
*.tmproj
.project
.settings
mkmf.log
## COMPILED ##
##############
a.out
*.o
*.pyc
*.so
*.com
*.class
*.dll
*.exe
*/rdoc/
# Testing #
###########
.watchr
.rspec
spec/*
spec/fixtures/*
test/*
features/*
Guardfile
Procfile
# SCM #
#######
.git
*/.git
.gitignore
.gitmodules
.gitconfig
.gitattributes
.svn
*/.bzr/*
*/.hg/*
*/.svn/*
# Berkshelf #
#############
cookbooks/*
tmp
# Cookbooks #
#############
CONTRIBUTING
CHANGELOG*
# Strainer #
############
Colanderfile
Strainerfile
.colander
.strainer
# Vagrant #
###########
.vagrant
Vagrantfile
# Travis #
##########
.travis.yml
# tmux #
##########
.tmux

View File

@@ -0,0 +1,43 @@
require 'net/https'
module PackageCloud
module Helper
def get(uri, params)
uri.query = URI.encode_www_form(params)
req = Net::HTTP::Get.new(uri.request_uri)
req.basic_auth uri.user, uri.password if uri.user
http = Net::HTTP.new(uri.hostname, uri.port)
http.use_ssl = true
resp = http.start { |h| h.request(req) }
case resp
when Net::HTTPSuccess
resp
else
raise resp.inspect
end
end
def post(uri, params)
req = Net::HTTP::Post.new(uri.request_uri)
req.form_data = params
req.basic_auth uri.user, uri.password if uri.user
http = Net::HTTP.new(uri.hostname, uri.port)
http.use_ssl = true
resp = http.start { |h| h.request(req) }
case resp
when Net::HTTPSuccess
resp
else
raise resp.inspect
end
end
end
end

View File

@@ -0,0 +1,7 @@
if defined?(ChefSpec)
def create_packagecloud_repo(resource_name)
ChefSpec::Matchers::ResourceMatcher.new(:packagecloud_repo, :add, resource_name)
end
end

View File

@@ -0,0 +1,41 @@
{
"name": "packagecloud",
"description": "Installs/Configures packagecloud.io repositories.",
"long_description": "Installs/Configures packagecloud.io repositories.",
"maintainer": "Joe Damato",
"maintainer_email": "joe@packagecloud.io",
"license": "Apache 2.0",
"platforms": {
},
"dependencies": {
},
"recommendations": {
},
"suggestions": {
},
"conflicting": {
},
"providing": {
},
"replacing": {
},
"attributes": {
},
"groupings": {
},
"recipes": {
},
"version": "0.0.18",
"source_url": "",
"issues_url": ""
}

View File

@@ -0,0 +1,7 @@
name 'packagecloud'
maintainer 'Joe Damato'
maintainer_email 'joe@packagecloud.io'
license 'Apache 2.0'
description 'Installs/Configures packagecloud.io repositories.'
long_description 'Installs/Configures packagecloud.io repositories.'
version '0.0.18'

View File

@@ -0,0 +1,207 @@
include ::PackageCloud::Helper
require 'uri'
use_inline_resources if defined?(use_inline_resources)
action :add do
case new_resource.type
when 'deb'
install_deb
when 'rpm'
install_rpm
when 'gem'
install_gem
else
raise "#{new_resource.type} is an unknown package type."
end
end
def install_deb
base_url = new_resource.base_url
repo_url = construct_uri_with_options({base_url: base_url, repo: new_resource.repository, endpoint: node['platform']})
Chef::Log.debug("#{new_resource.name} deb repo url = #{repo_url}")
package 'apt-transport-https'
template "/etc/apt/sources.list.d/#{filename}.list" do
source 'apt.erb'
cookbook 'packagecloud'
mode '0644'
variables :base_url => read_token(repo_url).to_s,
:distribution => node['lsb']['codename'],
:component => 'main'
notifies :run, "execute[apt-key-add-#{filename}]", :immediately
notifies :run, "execute[apt-get-update-#{filename}]", :immediately
end
gpg_key_url = ::File.join(base_url, node['packagecloud']['gpg_key_path'])
execute "apt-key-add-#{filename}" do
command "wget -qO - #{gpg_key_url} | apt-key add -"
action :nothing
end
execute "apt-get-update-#{filename}" do
command "apt-get update -o Dir::Etc::sourcelist=\"sources.list.d/#{filename}.list\"" \
" -o Dir::Etc::sourceparts=\"-\"" \
" -o APT::Get::List-Cleanup=\"0\""
action :nothing
end
end
def install_rpm
given_base_url = new_resource.base_url
base_repo_url = ::File.join(given_base_url, node['packagecloud']['base_repo_path'])
base_url_endpoint = construct_uri_with_options({base_url: base_repo_url, repo: new_resource.repository, endpoint: 'rpm_base_url'})
gpg_filename = URI.parse(base_repo_url).host.gsub!('.', '_')
if new_resource.master_token
base_url_endpoint.user = new_resource.master_token
base_url_endpoint.password = ''
end
base_url = URI(get(base_url_endpoint, install_endpoint_params).body.chomp)
Chef::Log.debug("#{new_resource.name} rpm base url = #{base_url}")
package 'pygpgme' do
ignore_failure true
end
log 'pygpgme_warning' do
message 'The pygpgme package could not be installed. This means GPG verification is not possible for any RPM installed on your system. ' \
'To fix this, add a repository with pygpgme. Usualy, the EPEL repository for your system will have this. ' \
'More information: https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F and https://github.com/opscode-cookbooks/yum-epel'
level :warn
not_if 'rpm -qa | grep -qw pygpgme'
end
ruby_block 'disable repo_gpgcheck if no pygpgme' do
block do
template = run_context.resource_collection.find(:template => "/etc/yum.repos.d/#{filename}.repo")
template.variables[:repo_gpgcheck] = 0
end
not_if 'rpm -qa | grep -qw pygpgme'
end
remote_file "/etc/pki/rpm-gpg/RPM-GPG-KEY-#{gpg_filename}" do
source ::File.join(given_base_url, node['packagecloud']['gpg_key_path'])
mode '0644'
end
template "/etc/yum.repos.d/#{filename}.repo" do
source 'yum.erb'
cookbook 'packagecloud'
mode '0644'
variables :base_url => read_token(base_url).to_s,
:gpg_filename => gpg_filename,
:name => filename,
:repo_gpgcheck => 1,
:description => filename,
:priority => new_resource.priority,
:metadata_expire => new_resource.metadata_expire
notifies :run, "execute[yum-makecache-#{filename}]", :immediately
notifies :create, "ruby_block[yum-cache-reload-#{filename}]", :immediately
end
# get the metadata for this repo only
execute "yum-makecache-#{filename}" do
command "yum -q makecache -y --disablerepo=* --enablerepo=#{filename}"
action :nothing
end
# reload internal Chef yum cache
ruby_block "yum-cache-reload-#{filename}" do
block { Chef::Provider::Package::Yum::YumCache.instance.reload }
action :nothing
end
end
def install_gem
base_url = new_resource.base_url
repo_url = construct_uri_with_options({base_url: base_url, repo: new_resource.repository})
repo_url = read_token(repo_url, true).to_s
execute "install packagecloud #{new_resource.name} repo as gem source" do
command "gem source --add #{repo_url}"
not_if "gem source --list | grep #{repo_url}"
end
end
def read_token(repo_url, gems=false)
return repo_url unless new_resource.master_token
base_url = new_resource.base_url
base_repo_url = ::File.join(base_url, node['packagecloud']['base_repo_path'])
uri = construct_uri_with_options({base_url: base_repo_url, repo: new_resource.repository, endpoint: 'tokens.text'})
uri.user = new_resource.master_token
uri.password = ''
resp = post(uri, install_endpoint_params)
Chef::Log.debug("#{new_resource.name} TOKEN = #{resp.body.chomp}")
if is_rhel5? && !gems
repo_url
else
repo_url.user = resp.body.chomp
repo_url.password = ''
repo_url
end
end
def install_endpoint_params
dist = value_for_platform_family(
'debian' => node['lsb']['codename'],
['rhel', 'fedora'] => node['platform_version'],
)
if node['fqdn'].nil?
Chef::Log.fatal("This node's fqdn is set to nil, so a read token cannot be issued!" \
"Please change your fqdn settings.")
end
{ :os => node['platform'],
:dist => dist,
:name => node['fqdn'] }
end
def filename
new_resource.name.gsub(/[^0-9A-z.\-]/, '_')
end
def is_rhel5?
platform_family?('rhel') && node['platform_version'].to_i == 5
end
def construct_uri_with_options(options)
required_options = [:base_url, :repo]
required_options.each do |opt|
if !options[opt]
raise ArgumentError,
"A required option :#{opt} was not specified"
end
end
options[:base_url] = append_trailing_slash(options[:base_url])
options[:repo] = append_trailing_slash(options[:repo])
URI.join(options.delete(:base_url), options.inject([]) {|mem, opt| mem << opt[1]}.join)
end
def append_trailing_slash(str)
str.end_with?("/") ? str : str << "/"
end

View File

@@ -0,0 +1,10 @@
actions :add
default_action :add
attribute :repository, :kind_of => String, :name_attribute => true
attribute :master_token, :kind_of => String
attribute :type, :kind_of => String, :equal_to => ['deb', 'rpm', 'gem'], :default => node['packagecloud']['default_type']
attribute :base_url, :kind_of => String, :default => "https://packagecloud.io"
attribute :gpg_key_url, :kind_of => String, :default => node['packagecloud']['gpg_key_url']
attribute :priority, :kind_of => [Fixnum, TrueClass, FalseClass], :default => false
attribute :metadata_expire, :kind_of => String, :regex => [/^\d+[d|h|m]?$/], :default => nil

View File

@@ -0,0 +1,2 @@
deb <%= @base_url %> <%= @distribution %> <%= @component %>
deb-src <%= @base_url %> <%= @distribution %> <%= @component %>

View File

@@ -0,0 +1,15 @@
[<%= @name %>]
name=<%= @description %>
baseurl=<%= @base_url %>
repo_gpgcheck=<%= @repo_gpgcheck %>
<% if @priority -%>
priority=<%=@priority %>
<% end -%>
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-<%= @gpg_filename %>
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
<% if @metadata_expire %>
metadata_expire=<%= @metadata_expire %>
<% end %>