Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Porting to use cookbook yum ~> 3.0. Fixing up style and tests

  • Loading branch information...
commit 8dd378bffb8c191870b605b3171eaf4109df1b2c 1 parent 741ab14
@someara someara authored
View
74 .kitchen.yml
@@ -1,44 +1,74 @@
---
driver_plugin: vagrant
+driver_plugin: digitalocean
driver_config:
- require_chef_omnibus: true
+ 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.04
+- name: centos-5.8
+ driver_plugin: digitalocean
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[apt]
+ image_id: 1601
+ flavor_id: 63
+ region_id: 1
+ ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
-- name: ubuntu-10.04
+- name: centos-6.4
+ driver_plugin: digitalocean
driver_config:
- box: opscode-ubuntu-10.04
- box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-10.04_provisionerless.box
- run_list:
- - recipe[apt]
+ image_id: 562354
+ flavor_id: 63
+ region_id: 1
+ ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
-- name: centos-6.4
+- name: amazon-2013.09
+ driver_plugin: ec2
driver_config:
- box: opscode-centos-6.4
- box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box
+ 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[yum::epel]
+ - recipe[apt]
-- name: centos-5.9
+- name: ubuntu-1204
+ driver_plugin: digitalocean
driver_config:
- box: opscode-centos-5.9
- box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_centos-5.9_provisionerless.box
+ image_id: 284203
+ flavor_id: 63
+ region_id: 1
+ ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
run_list:
- - recipe[yum::epel]
+ - recipe[apt]
suites:
- name: default
run_list:
- recipe[couchdb]
- attributes: {}
- name: source
run_list:
- recipe[build-essential]
- - recipe[couchdb::source]
- attributes: {}
+ - recipe[couchdb::source]
+ attributes: {}
View
8 .rubocop.yml
@@ -0,0 +1,8 @@
+Encoding:
+ Enabled: false
+
+LineLength:
+ Max: 200
+
+HashSyntax:
+ EnforcedStyle: hash_rockets
View
13 .travis.yml
@@ -0,0 +1,13 @@
+language: ruby
+bundler_args: --without development integration
+rvm:
+ - 1.9.3
+ - 2.0.0
+before_install:
+ - "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
+before_script:
+ - bundle exec berks install
+script:
+ - bundle exec foodcritic -f any . --tags ~FC005
+ - bundle exec rubocop
+ - bundle exec rspec --color --format progress
View
12 Berksfile
@@ -2,11 +2,7 @@ site :opscode
metadata
-group :integration do
- cookbook "build-essential"
- cookbook "apt"
- cookbook "yum"
-
- # Future, when/if minitest support for this cookbook is added
- #cookbook "minitest-handler"
-end
+cookbook 'apt'
+cookbook 'build-essential'
+cookbook 'yum', '~> 3.0'
+cookbook 'yum-epel'
View
13 Gemfile
@@ -0,0 +1,13 @@
+source 'https://rubygems.org'
+
+gem 'berkshelf', '~> 2.0'
+gem 'chefspec', '~> 3.0'
+gem 'foodcritic', '~> 3.0'
+gem 'rubocop'
+
+group :integration do
+ gem 'test-kitchen', '~> 1.0'
+ gem 'kitchen-vagrant', '~> 0.11'
+ gem 'kitchen-digitalocean'
+ gem 'kitchen-ec2'
+end
View
16 attributes/default.rb
@@ -5,20 +5,20 @@
#
# Copyright 2010, Opscode, Inc
#
-# Licensed under the Apache License, Version 2.0 (the "License");
+# 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,
+# 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.
-default['couch_db']['src_checksum'] = "b54e643f3ca5f046cfd2f329a001efeaae8a3094365fa6c1cb5dcf68c1b25ccd"
-default['couch_db']['src_version'] = "1.2.1"
+default['couch_db']['src_checksum'] = 'b54e643f3ca5f046cfd2f329a001efeaae8a3094365fa6c1cb5dcf68c1b25ccd'
+default['couch_db']['src_version'] = '1.2.1'
default['couch_db']['src_mirror'] = "http://archive.apache.org/dist/couchdb/#{node['couch_db']['src_version']}/apache-couchdb-#{node['couch_db']['src_version']}.tar.gz"
default['couch_db']['install_erlang'] = true
@@ -29,8 +29,8 @@
# Configuration file is now removed in favor of dynamic
# generation.
-default['couch_db']['config']['couchdb']['max_document_size'] = 4294967296 # In bytes (4 GB)
-default['couch_db']['config']['couchdb']['max_attachment_chunk_size'] = 4294967296 # In bytes (4 GB)
+default['couch_db']['config']['couchdb']['max_document_size'] = 4_294_967_296 # In bytes (4 GB)
+default['couch_db']['config']['couchdb']['max_attachment_chunk_size'] = 4_294_967_296 # In bytes (4 GB)
default['couch_db']['config']['couchdb']['os_process_timeout'] = 5000 # In ms (5 seconds)
default['couch_db']['config']['couchdb']['max_dbs_open'] = 100
default['couch_db']['config']['couchdb']['delayed_commits'] = true
@@ -38,6 +38,6 @@
default['couch_db']['config']['couchdb']['batch_save_interval'] = 1000 # In ms (1 second)
default['couch_db']['config']['httpd']['port'] = 5984
-default['couch_db']['config']['httpd']['bind_address'] = "127.0.0.1"
+default['couch_db']['config']['httpd']['bind_address'] = '127.0.0.1'
-default['couch_db']['config']['log']['level'] = "info"
+default['couch_db']['config']['log']['level'] = 'info'
View
29 metadata.rb
@@ -1,8 +1,8 @@
-name "couchdb"
-maintainer "Opscode, Inc."
-maintainer_email "cookbooks@opscode.com"
-license "Apache 2.0"
-description "Installs CouchDB package and starts service"
+name 'couchdb'
+maintainer 'Opscode, Inc.'
+maintainer_email 'cookbooks@opscode.com'
+license 'Apache 2.0'
+description 'Installs CouchDB package and starts service'
long_description <<-EOH
Installs the CouchDB package if it is available from an package repository on
the node. If the package repository is not available, CouchDB needs to be
@@ -10,16 +10,17 @@
directly from source. CouchDB is available on Red Hat-based systems through
the EPEL Yum Repository.
EOH
-version "2.4.9"
-depends "erlang"
-depends "yum", '< 3.0'
-recipe "couchdb", "Installs and configures CouchDB package"
-recipe "couchdb::source", "Installs and configures CouchDB from source"
+version '2.4.9'
+depends 'erlang'
+depends 'yum', '~> 3.0'
+depends 'yum-epel'
+recipe 'couchdb', 'Installs and configures CouchDB package'
+recipe 'couchdb::source', 'Installs and configures CouchDB from source'
-supports "ubuntu", ">= 8.10" # for package in APT
-supports "debian", ">= 5.0" # for package in APT
-supports "openbsd"
-supports "freebsd"
+supports 'ubuntu', '>= 8.10' # for package in APT
+supports 'debian', '>= 5.0' # for package in APT
+supports 'openbsd'
+supports 'freebsd'
%w{ redhat centos fedora scientific oracle amazon }.each do |os|
supports os # requires EPEL Yum Repository
View
67 recipes/default.rb
@@ -17,64 +17,61 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if node['couch_db']['install_erlang']
- include_recipe "erlang"
-end
+include_recipe 'erlang' if node['couch_db']['install_erlang']
case node['platform_family']
-when "rhel"
- group "couchdb" do
+when 'rhel'
+ group 'couchdb' do
system true
end
- user "couchdb" do
- comment "Couchdb Database Server"
- gid "couchdb"
- shell "/bin/bash"
- home "/var/lib/couchdb"
+ user 'couchdb' do
+ comment 'Couchdb Database Server'
+ gid 'couchdb'
+ shell '/bin/bash'
+ home '/var/lib/couchdb'
system true
end
- include_recipe "yum::epel"
+ include_recipe 'yum-epel'
end
-
-package "couchdb" do
+package 'couchdb' do
package_name value_for_platform(
- "openbsd" => { "default" => "apache-couchdb" },
- "gentoo" => { "default" => "dev-db/couchdb" },
- "default" => "couchdb"
- )
+ 'openbsd' => { 'default' => 'apache-couchdb' },
+ 'gentoo' => { 'default' => 'dev-db/couchdb' },
+ 'default' => 'couchdb'
+ )
end
-template "/etc/couchdb/local.ini" do
- source "local.ini.erb"
- owner "couchdb"
- group "couchdb"
+template '/etc/couchdb/local.ini' do
+ source 'local.ini.erb'
+ owner 'couchdb'
+ group 'couchdb'
mode 0664
variables(
:config => node['couch_db']['config']
)
- notifies :restart, "service[couchdb]"
+ notifies :restart, 'service[couchdb]'
end
-directory "/var/lib/couchdb" do
- owner "couchdb"
- group "couchdb"
+directory '/var/lib/couchdb' do
+ owner 'couchdb'
+ group 'couchdb'
recursive true
path value_for_platform(
- "openbsd" => { "default" => "/var/couchdb" },
- "freebsd" => { "default" => "/var/couchdb" },
- "gentoo" => { "default" => "/var/couchdb" },
- "default" => "/var/lib/couchdb"
+ 'openbsd' => { 'default' => '/var/couchdb' },
+ 'freebsd' => { 'default' => '/var/couchdb' },
+ 'gentoo' => { 'default' => '/var/couchdb' },
+ 'default' => '/var/lib/couchdb'
)
end
-service "couchdb" do
- if platform_family?("rhel","fedora")
- start_command "/sbin/service couchdb start &> /dev/null"
- stop_command "/sbin/service couchdb stop &> /dev/null"
+service 'couchdb' do
+ if platform_family?('rhel', 'fedora')
+ start_command '/sbin/service couchdb start &> /dev/null'
+ stop_command '/sbin/service couchdb stop &> /dev/null'
end
- supports [ :restart, :status ]
- action [ :enable, :start ]
+ supports [:restart, :status]
+ action [:enable, :start]
end
View
80 recipes/source.rb
@@ -1,4 +1,4 @@
-#
+w#
# Author:: Joshua Timberman <joshua@opscode.com>
# Cookbook Name:: couchdb
# Recipe:: source
@@ -17,46 +17,42 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-if node['platform'] == "ubuntu" && node['platform_version'].to_f == 8.04
+if node['platform'] == 'ubuntu' && node['platform_version'].to_f == 8.04
log "Ubuntu 8.04 does not supply sufficient development libraries via APT to install CouchDB #{node['couch_db']['src_version']} from source."
return
end
-couchdb_tar_gz = File.join(Chef::Config[:file_cache_path], "/", "apache-couchdb-#{node['couch_db']['src_version']}.tar.gz")
-compile_flags = String.new
-dev_pkgs = Array.new
+couchdb_tar_gz = File.join(Chef::Config[:file_cache_path], '/', "apache-couchdb-#{node['couch_db']['src_version']}.tar.gz")
+compile_flags = ''
+dev_pkgs = []
case node['platform_family']
-when "debian"
+when 'debian'
- dev_pkgs << "libicu-dev"
- dev_pkgs << "libcurl4-openssl-dev"
+ dev_pkgs << 'libicu-dev'
+ dev_pkgs << 'libcurl4-openssl-dev'
dev_pkgs << value_for_platform(
- "debian" => { "default" => "libmozjs-dev" },
- "ubuntu" => {
- "10.04" => "xulrunner-dev",
- "default" => "libmozjs-dev"
+ 'debian' => { 'default' => 'libmozjs-dev' },
+ 'ubuntu' => {
+ '10.04' => 'xulrunner-dev',
+ 'default' => 'libmozjs-dev'
}
)
-when "rhel", "fedora"
- include_recipe "yum::epel"
+when 'rhel', 'fedora'
+ include_recipe 'yum-epel'
- dev_pkgs += [
- "which",
- "make", "gcc",
- "libicu-devel", "openssl-devel", "curl-devel", "libtool",
- "js-devel",
- ]
+ dev_pkgs += %w{
+ which make gcc js-devel libtool
+ libicu-devel openssl-devel curl-devel
+ }
# awkwardly tell ./configure where to find Erlang's headers
- bitness = node['kernel']['machine'] =~ /64/ ? "lib64" : "lib"
+ bitness = node['kernel']['machine'] =~ /64/ ? 'lib64' : 'lib'
compile_flags = "--with-erlang=/usr/#{bitness}/erlang/usr/include"
end
-if node['couch_db']['install_erlang']
- include_recipe "erlang"
-end
+include_recipe 'erlang' if node['couch_db']['install_erlang']
dev_pkgs.each do |pkg|
package pkg
@@ -76,40 +72,40 @@
not_if "test -f /usr/local/bin/couchdb && /usr/local/bin/couchdb -V | grep 'Apache CouchDB #{node['couch_db']['src_version']}'"
end
-user "couchdb" do
- home "/usr/local/var/lib/couchdb"
- comment "CouchDB Administrator"
+user 'couchdb' do
+ home '/usr/local/var/lib/couchdb'
+ comment 'CouchDB Administrator'
supports :manage_home => false
system true
end
%w{ var/lib/couchdb var/log/couchdb var/run/couchdb etc/couchdb }.each do |dir|
directory "/usr/local/#{dir}" do
- owner "couchdb"
- group "couchdb"
- mode "0770"
+ owner 'couchdb'
+ group 'couchdb'
+ mode '0770'
end
end
-template "/usr/local/etc/couchdb/local.ini" do
- source "local.ini.erb"
- owner "couchdb"
- group "couchdb"
+template '/usr/local/etc/couchdb/local.ini' do
+ source 'local.ini.erb'
+ owner 'couchdb'
+ group 'couchdb'
mode 0660
variables(
:config => node['couch_db']['config']
)
- notifies :restart, "service[couchdb]"
+ notifies :restart, 'service[couchdb]'
end
-cookbook_file "/etc/init.d/couchdb" do
- source "couchdb.init"
- owner "root"
- group "root"
- mode "0755"
+cookbook_file '/etc/init.d/couchdb' do
+ source 'couchdb.init'
+ owner 'root'
+ group 'root'
+ mode '0755'
end
-service "couchdb" do
- supports [ :restart, :status ]
+service 'couchdb' do
+ supports [:restart, :status]
action [:enable, :start]
end
Please sign in to comment.
Something went wrong with that request. Please try again.