Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add multiple repository setup via attributes #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## head

## 0.2.0 (08/19/2014)

added multiple repositories setup via attributes hash

## 0.1.1 (08/11/2014)

* remove unused reference to `intu_metadata` namespace
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ Platform:

`node['yum_s3_iam']['repo_bucket']` - Default value: 'http://our-bucket-name.s3.amazonaws.com'

## Multiple repositories setup
node['repo_default'] = false # Will not setup the default repository
node['repositories'] = {
"repo_name1": {
"repo_description": "...",
"repo_bucket": ".."
},
"repo_name2": {
"repo_description": "...",
"repo_bucket": ".."
}
}

# Recipes
## default
Installs `yum-s3-iam` package and configures a yum repo with S3/IAM support.
Expand Down
2 changes: 2 additions & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
default['yum_s3_iam']['repo_name'] = 'our repo'
default['yum_s3_iam']['repo_description'] = 'our package repo'
default['yum_s3_iam']['repo_bucket'] = 'http://our-bucket-name.s3.amazonaws.com/'
default['yum_s3_iam']['repo_default'] = true
default['yum_s3_iam']['repositories'] = {}
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
license "Apache 2.0"
description "Installs/Configures the yum-s3-iam plugin"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.1.1"
version "0.2.0"

%w{ centos rhel }.each do |os|
supports os
Expand Down
30 changes: 22 additions & 8 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,26 @@
version node['yum_s3_iam']['version']
end

template File.join('/', 'etc', 'yum.repos.d', "#{node['yum_s3_iam']['repo_name']}.repo") do
owner 'root'
group 'root'
mode '0644'
source 's3-iam.repo.erb'
variables :repo_name => node['yum_s3_iam']['repo_name'],
:repo_description => node['yum_s3_iam']['repo_description'],
:repo_bucket => node['yum_s3_iam']['repo_bucket']
if node['yum_s3_iam']['repo_default']
template File.join('/', 'etc', 'yum.repos.d', "#{node['yum_s3_iam']['repo_name']}.repo") do
owner 'root'
group 'root'
mode '0644'
source 's3-iam.repo.erb'
variables :repo_name => node['yum_s3_iam']['repo_name'],
:repo_description => node['yum_s3_iam']['repo_description'],
:repo_bucket => node['yum_s3_iam']['repo_bucket']
end
end

node['yum_s3_iam']['repositories'].each do |repo_name,config|
template File.join('/', 'etc', 'yum.repos.d', "#{repo_name}.repo") do
owner 'root'
group 'root'
mode '0644'
source 's3-iam.repo.erb'
variables :repo_name => repo_name,
:repo_description => config['repo_description'],
:repo_bucket => config['repo_bucket']
end
end