Skip to content

Commit

Permalink
Updating for yum ~> 3.0. Fixing up style for rubocop. Updating test-k…
Browse files Browse the repository at this point in the history
…itchen harness
  • Loading branch information
Sean OMeara committed Dec 19, 2013
1 parent f42cdc2 commit 496735a
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 89 deletions.
79 changes: 61 additions & 18 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,67 @@
---
driver_plugin: vagrant
driver_plugin: digitalocean
driver_config:
require_chef_omnibus: true
customize:
memory: 512
digitalocean_client_id: <%= ENV['DIGITAL_OCEAN_CLIENT_ID'] %>
digitalocean_api_key: <%= ENV['DIGITAL_OCEAN_API_KEY'] %>
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_PRIVATE_KEY_PATH'] %>
rackspace_username: <%= ENV['RACKSPACE_USERNAME'] %>
rackspace_api_key: <%= ENV['RACKSPACE_API_KEY'] %>
require_chef_omnibus: latest

platforms:
- name: ubuntu-12.10
run_list:
- recipe[apt::default]
- name: ubuntu-12.04
run_list:
- recipe[apt::default]
- name: ubuntu-10.04
run_list:
- recipe[apt::default]
- name: debian-7.1.0
run_list:
- recipe[apt::default]
- name: centos-6.4
- name: centos-5.9
- name: centos-5.8
driver_plugin: digitalocean
driver_config:
image_id: 1601
flavor_id: 63
region_id: 1
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>

- name: centos-6.4
driver_plugin: digitalocean
driver_config:
image_id: 562354
flavor_id: 63
region_id: 1
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>

- name: amazon-2013.09
driver_plugin: ec2
driver_config:
image_id: ami-3be4bc52
username: ec2-user

- name: fedora-19
driver_plugin: digitalocean
driver_config:
image_id: 696598
flavor_id: 63
region_id: 1
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>

- name: ubuntu-1004
driver_plugin: digitalocean
driver_config:
image_id: 14097
flavor_id: 63
region_id: 1
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
run_list:
- recipe[apt]

- name: ubuntu-1204
driver_plugin: digitalocean
driver_config:
image_id: 1505447
flavor_id: 63
region_id: 1
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
run_list:
- recipe[apt]

suites:
- name: default
Expand Down Expand Up @@ -56,4 +99,4 @@ suites:
- nginx::ngx_devel_module
- nginx::ngx_lua_module
- nginx::openssl_source
- nginx::upload_progress_module
- nginx::upload_progress_module
17 changes: 7 additions & 10 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
AllCops:
Excludes:
- vendor/**

AlignParameters:
Enabled: false
Encoding:
Enabled: false
HashSyntax:

AlignParameters:
Enabled: false

LineLength:
Enabled: false
MethodLength:
Max: 30
Max: 200

HashSyntax:
EnforcedStyle: hash_rockets
8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
source 'https://rubygems.org'

gem 'berkshelf', '~> 2.0'
gem 'chefspec', '~> 2.0'
gem 'chefspec', '~> 3.0'
gem 'foodcritic', '~> 3.0'
gem 'rubocop', '~> 0.12'
gem 'rubocop'

group :integration do
gem 'test-kitchen', '~> 1.0.0.beta'
gem 'test-kitchen', '~> 1.0'
gem 'kitchen-vagrant', '~> 0.11'
gem 'kitchen-digitalocean'
gem 'kitchen-ec2'
end
3 changes: 2 additions & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
depends 'build-essential', '~> 1.4'
depends 'ohai', '~> 1.1'
depends 'runit', '~> 1.2'
depends 'yum', '< 3.0'
depends 'yum', '~> 3.0'
depends 'yum-epel'

supports 'amazon'
supports 'centos'
Expand Down
6 changes: 2 additions & 4 deletions recipes/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

if platform_family?('rhel')
if node['nginx']['repo_source'] == 'epel'
include_recipe 'yum::epel'
include_recipe 'yum-epel'
elsif node['nginx']['repo_source'] == 'nginx'
include_recipe 'nginx::repo'
elsif node['nginx']['repo_source'].nil?
Expand All @@ -33,9 +33,7 @@
fail ArgumentError, "Unknown value '#{node['nginx']['repo_source']}' was passed to the nginx cookbook."
end
elsif platform_family?('debian')
if node['nginx']['repo_source'] == 'nginx'
include_recipe 'nginx::repo'
end
include_recipe 'nginx::repo' if node['nginx']['repo_source'] == 'nginx'
end

package node['nginx']['package_name'] do
Expand Down
15 changes: 5 additions & 10 deletions recipes/repo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,14 @@

case node['platform_family']
when 'rhel', 'fedora'
include_recipe 'yum::default'

yum_key 'nginx' do
url 'http://nginx.org/keys/nginx_signing.key'
key 'RPM-GPG-KEY-Nginx'
action :add
end


yum_repository 'nginx' do
description 'Nginx.org Repository'
url node['nginx']['upstream_repository']
key 'RPM-GPG-KEY-Nginx'
baseurl node['nginx']['upstream_repository']
gpgkey 'http://nginx.org/keys/nginx_signing.key'
action :create
end

when 'debian'
include_recipe 'apt::default'

Expand Down
7 changes: 1 addition & 6 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
require 'berkshelf'
require 'chefspec'
require_relative 'support/matchers/nginx_site'

Berkshelf.ui.mute do
Berkshelf::Berksfile.from_file('Berksfile').install(path: 'vendor/cookbooks')
end
require 'chefspec/berkshelf'
8 changes: 4 additions & 4 deletions spec/unit/recipes/default_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'spec_helper'

describe 'nginx::default' do
let(:chef_run) { ChefSpec::ChefRunner.new(:platform => 'debian', :version => '7.0').converge(described_recipe) }
let(:chef_run) { ChefSpec::Runner.new(:platform => 'debian', :version => '7.0').converge(described_recipe) }

it 'loads the ohai plugin' do
expect(chef_run).to include_recipe('nginx::ohai_plugin')
Expand All @@ -15,12 +15,12 @@

context 'configured to install by package' do
context 'in a redhat-based platform' do
let(:chef_run) { ChefSpec::ChefRunner.new(:platform => 'redhat', :version => '6.3').converge(described_recipe) }
let(:chef_run) { ChefSpec::Runner.new(:platform => 'redhat', :version => '6.3').converge(described_recipe) }

it 'includes the yum::epel recipe if the source is epel' do
it 'includes the yum-epel recipe if the source is epel' do
chef_run.node.set['nginx']['repo_source'] = 'epel'
chef_run.converge(described_recipe)
expect(chef_run).to include_recipe('yum::epel')
expect(chef_run).to include_recipe('yum-epel')
end

it 'includes the nginx::repo recipe if the source is not epel' do
Expand Down
3 changes: 3 additions & 0 deletions test/integration/default/bats/check_service.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@test "check memcache service" {
ps -ef | grep nginx
}
14 changes: 0 additions & 14 deletions test/integration/default/serverspec/default_spec.rb

This file was deleted.

3 changes: 3 additions & 0 deletions test/integration/source/bats/check_service.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@test "check memcache service" {
ps -ef | grep nginx
}
19 changes: 0 additions & 19 deletions test/integration/source/serverspec/source_spec.rb

This file was deleted.

0 comments on commit 496735a

Please sign in to comment.