Update cookbooks and add wordpress cookbook
This commit is contained in:
parent
9ba973e3ac
commit
820b0ab3f8
5
Batali
5
Batali
@ -1,3 +1,5 @@
|
||||
# vim: set filetype=ruby
|
||||
|
||||
Batali.define do
|
||||
source 'https://supermarket.chef.io'
|
||||
|
||||
@ -9,6 +11,7 @@ Batali.define do
|
||||
cookbook 'application_nodejs',
|
||||
git: 'https://github.com/67p/application_nodejs.git',
|
||||
ref: 'master'
|
||||
cookbook 'application', '4.1.6'
|
||||
cookbook 'users'
|
||||
cookbook 'chef-solo-search'
|
||||
cookbook 'sudo'
|
||||
@ -26,6 +29,6 @@ Batali.define do
|
||||
cookbook 'omnibus_updater', '~> 1.0.4'
|
||||
cookbook 'timezone-ii'
|
||||
cookbook 'nodejs', '~> 2.4.4'
|
||||
cookbook 'wordpress'
|
||||
end
|
||||
|
||||
# vim: set filetype=ruby
|
||||
|
370
batali.manifest
370
batali.manifest
@ -25,7 +25,8 @@
|
||||
"source": {
|
||||
"url": "https://github.com/67P/mediawiki-cookbook.git",
|
||||
"ref": "35e33e3d563987fa7c156def2d26654ecc4cb9a1",
|
||||
"type": "Batali::Source::Git"
|
||||
"type": "Batali::Source::Git",
|
||||
"subdirectory": null
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -53,7 +54,7 @@
|
||||
],
|
||||
[
|
||||
"mysql",
|
||||
">= 0.0.0"
|
||||
">= 6.0.0"
|
||||
],
|
||||
[
|
||||
"yum-epel",
|
||||
@ -68,11 +69,11 @@
|
||||
">= 0.0.0"
|
||||
]
|
||||
],
|
||||
"version": "1.5.0",
|
||||
"version": "1.7.2",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/php/versions/1.5.0/download",
|
||||
"version": "1.5.0"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/php/versions/1.7.2/download",
|
||||
"version": "1.7.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -99,11 +100,11 @@
|
||||
">= 0.0.0"
|
||||
]
|
||||
],
|
||||
"version": "1.2.13",
|
||||
"version": "2.0.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/xml/versions/1.2.13/download",
|
||||
"version": "1.2.13"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/xml/versions/2.0.0/download",
|
||||
"version": "2.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -111,11 +112,11 @@
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"version": "3.1.0",
|
||||
"version": "3.3.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/chef-sugar/versions/3.1.0/download",
|
||||
"version": "3.1.0"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/chef-sugar/versions/3.3.0/download",
|
||||
"version": "3.3.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -130,11 +131,11 @@
|
||||
">= 0.0.0"
|
||||
]
|
||||
],
|
||||
"version": "6.0.22",
|
||||
"version": "6.1.2",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/mysql/versions/6.0.22/download",
|
||||
"version": "6.0.22"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/mysql/versions/6.1.2/download",
|
||||
"version": "6.1.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -142,14 +143,14 @@
|
||||
"dependencies": [
|
||||
[
|
||||
"yum",
|
||||
">= 3.0"
|
||||
">= 3.2"
|
||||
]
|
||||
],
|
||||
"version": "0.1.17",
|
||||
"version": "0.1.21",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/yum-mysql-community/versions/0.1.17/download",
|
||||
"version": "0.1.17"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/yum-mysql-community/versions/0.1.21/download",
|
||||
"version": "0.1.21"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -157,11 +158,11 @@
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"version": "3.6.1",
|
||||
"version": "3.10.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/yum/versions/3.6.1/download",
|
||||
"version": "3.6.1"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/yum/versions/3.10.0/download",
|
||||
"version": "3.10.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -172,11 +173,11 @@
|
||||
">= 1.0.1"
|
||||
]
|
||||
],
|
||||
"version": "2.2.7",
|
||||
"version": "2.2.8",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/smf/versions/2.2.7/download",
|
||||
"version": "2.2.7"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/smf/versions/2.2.8/download",
|
||||
"version": "2.2.8"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -196,14 +197,14 @@
|
||||
"dependencies": [
|
||||
[
|
||||
"yum",
|
||||
"~> 3.0"
|
||||
"~> 3.2"
|
||||
]
|
||||
],
|
||||
"version": "0.6.0",
|
||||
"version": "0.6.5",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/yum-epel/versions/0.6.0/download",
|
||||
"version": "0.6.0"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/yum-epel/versions/0.6.5/download",
|
||||
"version": "0.6.5"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -214,11 +215,11 @@
|
||||
">= 0.0.0"
|
||||
]
|
||||
],
|
||||
"version": "1.36.6",
|
||||
"version": "1.38.4",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/windows/versions/1.36.6/download",
|
||||
"version": "1.36.6"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/windows/versions/1.38.4/download",
|
||||
"version": "1.38.4"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -226,11 +227,11 @@
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"version": "1.1.9",
|
||||
"version": "1.3.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/chef_handler/versions/1.1.9/download",
|
||||
"version": "1.1.9"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/chef_handler/versions/1.3.0/download",
|
||||
"version": "1.3.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -241,11 +242,11 @@
|
||||
">= 1.34.6"
|
||||
]
|
||||
],
|
||||
"version": "4.1.1",
|
||||
"version": "4.1.6",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/iis/versions/4.1.1/download",
|
||||
"version": "4.1.1"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/iis/versions/4.1.6/download",
|
||||
"version": "4.1.6"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -256,11 +257,11 @@
|
||||
">= 1.0.0"
|
||||
]
|
||||
],
|
||||
"version": "4.0.6",
|
||||
"version": "4.0.9",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/database/versions/4.0.6/download",
|
||||
"version": "4.0.6"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/database/versions/4.0.9/download",
|
||||
"version": "4.0.9"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -276,14 +277,14 @@
|
||||
],
|
||||
[
|
||||
"openssl",
|
||||
"~> 4.0.0"
|
||||
"~> 4.0"
|
||||
]
|
||||
],
|
||||
"version": "3.4.20",
|
||||
"version": "4.0.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/postgresql/versions/3.4.20/download",
|
||||
"version": "3.4.20"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/postgresql/versions/4.0.0/download",
|
||||
"version": "4.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -291,11 +292,11 @@
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"version": "2.7.0",
|
||||
"version": "2.9.2",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/apt/versions/2.7.0/download",
|
||||
"version": "2.7.0"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/apt/versions/2.9.2/download",
|
||||
"version": "2.9.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -303,14 +304,14 @@
|
||||
"dependencies": [
|
||||
[
|
||||
"chef-sugar",
|
||||
">= 0.0.0"
|
||||
">= 3.1.1"
|
||||
]
|
||||
],
|
||||
"version": "4.0.0",
|
||||
"version": "4.4.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/openssl/versions/4.0.0/download",
|
||||
"version": "4.0.0"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/openssl/versions/4.4.0/download",
|
||||
"version": "4.4.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -318,11 +319,11 @@
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"version": "3.6.2",
|
||||
"version": "3.7.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/postfix/versions/3.6.2/download",
|
||||
"version": "3.6.2"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/postfix/versions/3.7.0/download",
|
||||
"version": "3.7.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -356,7 +357,8 @@
|
||||
"source": {
|
||||
"url": "https://github.com/67p/application_nodejs.git",
|
||||
"ref": "54f280eb627866f24901c79c86678e6218d976f0",
|
||||
"type": "Batali::Source::Git"
|
||||
"type": "Batali::Source::Git",
|
||||
"subdirectory": null
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -393,35 +395,39 @@
|
||||
{
|
||||
"name": "ark",
|
||||
"dependencies": [
|
||||
[
|
||||
"build-essential",
|
||||
">= 0.0.0"
|
||||
],
|
||||
[
|
||||
"windows",
|
||||
">= 0.0.0"
|
||||
],
|
||||
[
|
||||
"7-zip",
|
||||
"seven_zip",
|
||||
">= 0.0.0"
|
||||
]
|
||||
],
|
||||
"version": "0.9.0",
|
||||
"version": "1.0.1",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/ark/versions/0.9.0/download",
|
||||
"version": "0.9.0"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/ark/versions/1.0.1/download",
|
||||
"version": "1.0.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "7-zip",
|
||||
"name": "seven_zip",
|
||||
"dependencies": [
|
||||
[
|
||||
"windows",
|
||||
">= 1.2.2"
|
||||
]
|
||||
],
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.4",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/7-zip/versions/1.0.2/download",
|
||||
"version": "1.0.2"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/seven_zip/versions/1.0.4/download",
|
||||
"version": "1.0.4"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -432,11 +438,38 @@
|
||||
">= 2.1.2"
|
||||
]
|
||||
],
|
||||
"version": "1.12.0",
|
||||
"version": "2.0.5",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/homebrew/versions/1.12.0/download",
|
||||
"version": "1.12.0"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/homebrew/versions/2.0.5/download",
|
||||
"version": "2.0.5"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "poise",
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"version": "2.6.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/poise/versions/2.6.0/download",
|
||||
"version": "2.6.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "poise-service",
|
||||
"dependencies": [
|
||||
[
|
||||
"poise",
|
||||
"~> 2.0"
|
||||
]
|
||||
],
|
||||
"version": "1.1.1",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/poise-service/versions/1.1.1/download",
|
||||
"version": "1.1.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -456,11 +489,11 @@
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"version": "1.8.2",
|
||||
"version": "2.0.3",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/users/versions/1.8.2/download",
|
||||
"version": "1.8.2"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/users/versions/2.0.3/download",
|
||||
"version": "2.0.3"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -480,11 +513,11 @@
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"version": "2.7.1",
|
||||
"version": "2.9.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/sudo/versions/2.7.1/download",
|
||||
"version": "2.7.1"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/sudo/versions/2.9.0/download",
|
||||
"version": "2.9.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -526,7 +559,8 @@
|
||||
"source": {
|
||||
"url": "https://github.com/phlipper/chef-redis.git",
|
||||
"ref": "7476279fc9c8727f082b8d77b5e1922dc2ef437b",
|
||||
"type": "Batali::Source::Git"
|
||||
"type": "Batali::Source::Git",
|
||||
"subdirectory": null
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -534,41 +568,29 @@
|
||||
"dependencies": [
|
||||
[
|
||||
"firewall",
|
||||
">= 0.9.0"
|
||||
">= 2.0"
|
||||
]
|
||||
],
|
||||
"version": "0.7.4",
|
||||
"version": "1.0.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/ufw/versions/0.7.4/download",
|
||||
"version": "0.7.4"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/ufw/versions/1.0.0/download",
|
||||
"version": "1.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "firewall",
|
||||
"dependencies": [
|
||||
[
|
||||
"poise",
|
||||
"~> 2.0"
|
||||
"chef-sugar",
|
||||
">= 0.0.0"
|
||||
]
|
||||
],
|
||||
"version": "1.2.0",
|
||||
"version": "2.4.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/firewall/versions/1.2.0/download",
|
||||
"version": "1.2.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "poise",
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"version": "2.0.1",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/poise/versions/2.0.1/download",
|
||||
"version": "2.0.1"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/firewall/versions/2.4.0/download",
|
||||
"version": "2.4.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -591,11 +613,11 @@
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"version": "1.0.8",
|
||||
"version": "1.0.9",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/partial_search/versions/1.0.8/download",
|
||||
"version": "1.0.8"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/partial_search/versions/1.0.9/download",
|
||||
"version": "1.0.9"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -638,14 +660,14 @@
|
||||
"dependencies": [
|
||||
[
|
||||
"rsyslog",
|
||||
">= 0.0.0"
|
||||
"~> 2.0"
|
||||
]
|
||||
],
|
||||
"version": "2.3.1",
|
||||
"version": "2.4.1",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/bluepill/versions/2.3.1/download",
|
||||
"version": "2.3.1"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/bluepill/versions/2.4.1/download",
|
||||
"version": "2.4.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -653,11 +675,11 @@
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"version": "2.0.0",
|
||||
"version": "2.2.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/rsyslog/versions/2.0.0/download",
|
||||
"version": "2.0.0"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/rsyslog/versions/2.2.0/download",
|
||||
"version": "2.2.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -665,11 +687,11 @@
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"version": "2.0.1",
|
||||
"version": "2.1.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/ohai/versions/2.0.1/download",
|
||||
"version": "2.0.1"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/ohai/versions/2.1.0/download",
|
||||
"version": "2.1.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -680,11 +702,11 @@
|
||||
">= 0.0.0"
|
||||
]
|
||||
],
|
||||
"version": "1.6.0",
|
||||
"version": "1.7.6",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/runit/versions/1.6.0/download",
|
||||
"version": "1.6.0"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/runit/versions/1.7.6/download",
|
||||
"version": "1.7.6"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -692,11 +714,11 @@
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"version": "0.0.18",
|
||||
"version": "0.2.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/packagecloud/versions/0.0.18/download",
|
||||
"version": "0.0.18"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/packagecloud/versions/0.2.0/download",
|
||||
"version": "0.2.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -708,18 +730,18 @@
|
||||
],
|
||||
[
|
||||
"mysql",
|
||||
">= 0.0.0"
|
||||
"~> 6.0"
|
||||
],
|
||||
[
|
||||
"mariadb",
|
||||
">= 0.0.0"
|
||||
]
|
||||
],
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/mysql2_chef_gem/versions/1.0.1/download",
|
||||
"version": "1.0.1"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/mysql2_chef_gem/versions/1.0.2/download",
|
||||
"version": "1.0.2"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -738,11 +760,11 @@
|
||||
">= 0.0.0"
|
||||
]
|
||||
],
|
||||
"version": "0.3.0",
|
||||
"version": "0.3.1",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/mariadb/versions/0.3.0/download",
|
||||
"version": "0.3.0"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/mariadb/versions/0.3.1/download",
|
||||
"version": "0.3.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -750,11 +772,11 @@
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.6",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/omnibus_updater/versions/1.0.4/download",
|
||||
"version": "1.0.4"
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/omnibus_updater/versions/1.0.6/download",
|
||||
"version": "1.0.6"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -768,6 +790,108 @@
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/timezone-ii/versions/0.2.0/download",
|
||||
"version": "0.2.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "wordpress",
|
||||
"dependencies": [
|
||||
[
|
||||
"php",
|
||||
">= 0.0.0"
|
||||
],
|
||||
[
|
||||
"openssl",
|
||||
">= 0.0.0"
|
||||
],
|
||||
[
|
||||
"apache2",
|
||||
">= 2.0.0"
|
||||
],
|
||||
[
|
||||
"database",
|
||||
">= 1.6.0"
|
||||
],
|
||||
[
|
||||
"mysql",
|
||||
">= 6.0"
|
||||
],
|
||||
[
|
||||
"mysql2_chef_gem",
|
||||
"~> 1.0.1"
|
||||
],
|
||||
[
|
||||
"build-essential",
|
||||
">= 0.0.0"
|
||||
],
|
||||
[
|
||||
"iis",
|
||||
">= 1.6.2"
|
||||
],
|
||||
[
|
||||
"tar",
|
||||
">= 0.3.1"
|
||||
],
|
||||
[
|
||||
"nginx",
|
||||
"~> 2.7.4"
|
||||
],
|
||||
[
|
||||
"php-fpm",
|
||||
"~> 0.6.10"
|
||||
],
|
||||
[
|
||||
"selinux",
|
||||
"~> 0.7"
|
||||
]
|
||||
],
|
||||
"version": "3.0.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/wordpress/versions/3.0.0/download",
|
||||
"version": "3.0.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "tar",
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"version": "0.7.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/tar/versions/0.7.0/download",
|
||||
"version": "0.7.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "php-fpm",
|
||||
"dependencies": [
|
||||
[
|
||||
"apt",
|
||||
">= 0.0.0"
|
||||
],
|
||||
[
|
||||
"yum",
|
||||
">= 3.0.0"
|
||||
]
|
||||
],
|
||||
"version": "0.6.10",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/php-fpm/versions/0.6.10/download",
|
||||
"version": "0.6.10"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "selinux",
|
||||
"dependencies": [
|
||||
|
||||
],
|
||||
"version": "0.9.0",
|
||||
"source": {
|
||||
"type": "Batali::Source::Site",
|
||||
"url": "https://supermarket.chef.io:443/api/v1/cookbooks/selinux/versions/0.9.0/download",
|
||||
"version": "0.9.0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
{
|
||||
"name": "7-zip",
|
||||
"version": "1.0.2",
|
||||
"description": "Installs/Configures the 7-zip file archiver",
|
||||
"long_description": "7-zip Cookbook\n==============\n[7-Zip](http://www.7-zip.org/) is a file archiver with a high compression ratio. This cookbook installs the full 7-zip suite of tools (GUI and CLI).\n\n\nRequirements\n------------\n### Platform\n- Windows XP\n- Windows Vista\n- Windows Server 2003 R2\n- Windows 7\n- Windows Server 2008 (R1, R2)\n- Windows 8\n- Windows Server 2012\n\n### Cookbooks\n- windows\n\n\nAttributes\n----------\n- `node['7-zip']['home']` - location to install 7-zip files to. default is `%SYSTEMDRIVE%\\7-zip`\n\n\nUsage\n-----\n### default\nDownloads and installs 7-zip to the location specified by `node['7-zip']['home']`. Also ensures `node['7-zip']['home']` is in the system path.\n\n\nLicense & Authors\n-----------------\n- Author:: Seth Chisamore (<schisamo@opscode.com>)\n\n```text\nCopyright:: 2011, Opscode, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n",
|
||||
"maintainer": "Opscode, Inc.",
|
||||
"maintainer_email": "cookbooks@opscode.com",
|
||||
"license": "Apache 2.0",
|
||||
"platforms": {
|
||||
"windows": ">= 0.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"windows": ">= 1.2.2"
|
||||
},
|
||||
"recommendations": {
|
||||
},
|
||||
"suggestions": {
|
||||
},
|
||||
"conflicting": {
|
||||
},
|
||||
"providing": {
|
||||
},
|
||||
"replacing": {
|
||||
},
|
||||
"attributes": {
|
||||
},
|
||||
"groupings": {
|
||||
},
|
||||
"recipes": {
|
||||
}
|
||||
}
|
15
cookbooks/apt/.gitignore
vendored
15
cookbooks/apt/.gitignore
vendored
@ -1,15 +0,0 @@
|
||||
.vagrant
|
||||
Berksfile.lock
|
||||
Gemfile.lock
|
||||
*~
|
||||
*#
|
||||
.#*
|
||||
\#*#
|
||||
.*.sw[a-z]
|
||||
*.un~
|
||||
.bundle
|
||||
.cache
|
||||
.kitchen
|
||||
bin
|
||||
.kitchen.local.yml
|
||||
.coverage
|
@ -1,47 +0,0 @@
|
||||
---
|
||||
driver_config:
|
||||
digitalocean_client_id: <%= ENV['DIGITAL_OCEAN_CLIENT_ID'] %>
|
||||
digitalocean_api_key: <%= ENV['DIGITAL_OCEAN_API_KEY'] %>
|
||||
|
||||
provisioner:
|
||||
name: chef_zero
|
||||
require_chef_omnibus: latest
|
||||
|
||||
platforms:
|
||||
- name: ubuntu-1004
|
||||
driver_plugin: digitalocean
|
||||
driver_config:
|
||||
image_id: 5566812
|
||||
flavor_id: 63
|
||||
region_id: 4
|
||||
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
|
||||
ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %>
|
||||
run_list:
|
||||
- recipe[apt]
|
||||
|
||||
- name: ubuntu-1204
|
||||
driver_plugin: digitalocean
|
||||
driver_config:
|
||||
image_id: 5588928
|
||||
flavor_id: 63
|
||||
region_id: 4
|
||||
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
|
||||
ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %>
|
||||
run_list:
|
||||
- recipe[apt]
|
||||
|
||||
- name: ubuntu-1404
|
||||
driver_plugin: digitalocean
|
||||
driver_config:
|
||||
image_id: 5141286
|
||||
flavor_id: 63
|
||||
region_id: 4
|
||||
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
|
||||
ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %>
|
||||
run_list:
|
||||
- recipe[apt]
|
||||
|
||||
suites:
|
||||
- name: default
|
||||
run_list:
|
||||
- recipe[apt]
|
@ -1,62 +0,0 @@
|
||||
driver:
|
||||
name: vagrant
|
||||
|
||||
platforms:
|
||||
- name: debian-7.2.0
|
||||
run_list: apt::default
|
||||
# - name: debian-8.0
|
||||
# run_list: apt::default
|
||||
- name: ubuntu-10.04
|
||||
run_list: apt::default
|
||||
- name: ubuntu-12.04
|
||||
run_list: apt::default
|
||||
- name: ubuntu-13.04
|
||||
run_list: apt::default
|
||||
- name: ubuntu-13.10
|
||||
run_list: apt::default
|
||||
- name: ubuntu-14.04
|
||||
run_list: apt::default
|
||||
# driver:
|
||||
# box: chef/ubuntu-14.04
|
||||
|
||||
suites:
|
||||
- name: default
|
||||
run_list:
|
||||
- recipe[minitest-handler]
|
||||
- recipe[apt_test]
|
||||
|
||||
- name: cacher-client
|
||||
run_list:
|
||||
- recipe[minitest-handler]
|
||||
- recipe[apt_test::cacher-client]
|
||||
|
||||
- name: cacher-ng
|
||||
run_list:
|
||||
- recipe[minitest-handler]
|
||||
- recipe[apt_test::cacher-ng]
|
||||
|
||||
- name: cacher-ng-client
|
||||
run_list:
|
||||
- recipe[minitest-handler]
|
||||
- recipe[apt_test::cacher-ng-client]
|
||||
attributes:
|
||||
apt:
|
||||
cacher_dir: '/tmp/apt-cacher'
|
||||
cacher_port: '9876'
|
||||
cacher_interface: 'eth0'
|
||||
compiletime: true
|
||||
|
||||
- name: lwrps
|
||||
run_list:
|
||||
- recipe[minitest-handler]
|
||||
- recipe[apt_test::lwrps]
|
||||
|
||||
- name: unattended-upgrades
|
||||
run_list:
|
||||
- recipe[minitest-handler]
|
||||
- recipe[apt_test::unattended-upgrades]
|
||||
attributes:
|
||||
apt:
|
||||
unattended_upgrades:
|
||||
enable: true
|
||||
|
@ -1,37 +0,0 @@
|
||||
AllCops:
|
||||
Exclude:
|
||||
- vendor/**
|
||||
- metadata.rb
|
||||
- Guardfile
|
||||
- test/cookbooks/apt_test/metadata.rb
|
||||
- .kitchen/**
|
||||
|
||||
# Disable ABCSize because it doesn't fit well with resources
|
||||
AbcSize:
|
||||
Enabled: false
|
||||
AssignmentInCondition:
|
||||
Enabled: false
|
||||
ClassAndModuleChildren:
|
||||
Enabled: false
|
||||
ClassLength:
|
||||
Enabled: false
|
||||
CyclomaticComplexity:
|
||||
Max: 15
|
||||
Documentation:
|
||||
Enabled: false
|
||||
Encoding:
|
||||
Enabled: false
|
||||
FileName:
|
||||
Enabled: false
|
||||
HashSyntax:
|
||||
Enabled: false
|
||||
LineLength:
|
||||
Enabled: false
|
||||
MethodLength:
|
||||
Enabled: false
|
||||
ParameterLists:
|
||||
Enabled: false
|
||||
# StringLiterals:
|
||||
# EnforcedStyle: double_quotes
|
||||
TrailingComma:
|
||||
Enabled: false
|
@ -1,44 +0,0 @@
|
||||
language: ruby
|
||||
bundler_args: --without kitchen_vagrant
|
||||
rvm:
|
||||
- 2.1.0
|
||||
before_install:
|
||||
- echo -n $DO_KEY_CHUNK_{0..30} >> ~/.ssh/id_do.base64
|
||||
- cat ~/.ssh/id_do.base64 | tr -d ' ' | base64 --decode > ~/.ssh/id_do.pem
|
||||
script:
|
||||
- bundle exec rake travis --trace
|
||||
after_script:
|
||||
- bundle exec kitchen destroy
|
||||
- cat .kitchen/logs/*
|
||||
env:
|
||||
global:
|
||||
- secure: h2vmDV0AjfSWpUCerHIe9uAR9Od0QDoSRPidEiCjrhNCvaEIz+xFQl3M8eYmHBC31GABdEsiDLHQmj6bPtGOuvceKp37qc9V/h2/oPpPvW2HDjMT6mO6Qx1a5Pv4Xb0PhlUfseZCLDURi/0bM5czxGLH+oqluVEzgrM48m/YWaI=
|
||||
- secure: fXvnhXK/ckP6EyFvGdYnh0YFwc1q+kF5HYUn3plOn7gytiERo+QwXqsnGtueiqrUzlCnqTWAj1T8wIuiPPmAUr3Ek/LUq1UwVcLYC9Wa2uGeTSooY6k1tzG1mtm+4njpIXxvOZ37NG2TwHLSG15iuJff6dtBE667/r88FjAGxgA=
|
||||
- secure: NzFG53vCyET7REDbiDBA6AlKwgQtAUnb/2IyCyRwi/Svpf5UWdnqiHD9vepsaLQ+tnJPnCBelP5vM+H7Ln/uWLN39WPz4+36Dry6cWRgTIRG94jCKg3KQJvs6Z+V4bHwRdtvMO5HeAvJUCKRKsIW15odnnPPgPf3OrCHOfQK3Ko=
|
||||
- secure: 3n0wmPKd+SBBP7prduer7jtIBLAvYP3T0/M+PupH6A8cKNL17kafQO9BwDSfcrRilX0UfOEND2Yq3Au6OfBjmKaFyScUdI5DOT+GWiBcYl9fbmtpz9KG6H8iWG8tIyJQ7vfV6pev8BGDQsmsIBu4SPYTUKUegtvkmmVoeV2je+4=
|
||||
- secure: yrAlzIzT5sMpJ6VbjSjGLPlMH8LdPNBymaf/5FRxt1n5qLR2GQt9wxaCzGyjhgHo6iAdf3Dw9//YJ8vctnF61XqDOkpc6sW1d8IVZXHPOwb0mr94yQgYWXS/FLk7CFGuELYvKYMLIAXkq/QMOMyro2YLhTD25NblcxTpk5PuJXc=
|
||||
- secure: 1FMkzei96uga+Fhqb3BK7dIiFj+ItiQhh1vHlotoLecDlDDT0o1YV8jBueLyZiVuFo/n4rKD8zMeCh3g5gfvWGQgZXbxEwMOLixtrW8bnOt/qAGs3qI6H57zXzWU2voUeyWa+ExorBMf1WL1RfIE6S/MlZNJW2OmWKceEaYrsLI=
|
||||
- secure: ulI/7FdP1JVs61bi7CX3UwmG2v7SzHKfjf3P/wWvbCAO8Z/By/gnHmUn6I0EKsUEA4Gx3kXH8DmVtOZdcYLiNTnWGS38AxPnOfLYa0Lv/h7qqze4MFo5FliNB0iKaq0qn+L/eGYQSlr9e5Opf1Qdp2E47UUFd9VMaCSRKvIpqG4=
|
||||
- secure: bcfXOTCxjA5Gv2BZWkjO8ukm5Z+t8AZglfvw7VRSqAe4BkyO62WmjONi2qYduB8nAX31IzKMEMOsA8zy9V96B+iAhdc3K5LTaa9VIocaNKoq0lgbLrqw3gW969p1vEbBzSiIn+3bDs7arX1LQ98e9UVt2hBQodSYicRzUuscbSw=
|
||||
- secure: 2AeqJEMU9QYs40mfX6JppzAMsFJwrtFzYJVwgiN9EGCSqINzEIvnNB2z//nHsMlL6puP0VvapkCYHLDVHi2WHL0fSkkwyyGAfQVR01iM3CSjCl4j9h9Nv6bG78zNItQX64vg9FarTptqrZO/OnaT7dXUfGcAbr8cx9zJRv2fyMw=
|
||||
- secure: Vx4VZUEF5ptw0lwHtLyMKcBRZwcpApsfAMgj/amqzAhFswjJoafHJ4Ryee+mrg46yXkaXed18xRu7pU/tXLGdp6vuvWFaC/1zCNfsdQBv+BAr46Ig4OB5mE/rwGOiNwbhSj9iHpKGPtUTwOHHqCqP/7ktR1TDIAmB5Esp0QBNFI=
|
||||
- secure: 0ygYNLFO7ZBI7SH1PBt2ALmwtJfZ9ltCxOARP8ILkgCwLhczolcoT81/kfKigkP75dwYXU9LHiROm2GxFFH9reQdb5X2G3ik6/Xxn6KC1ewIuf8M7+qZx8p//ByazW7OZcvFrfGhsX/LJ5NfAC56Wii88oCUTYEGdM+MIPk8rzQ=
|
||||
- secure: a0vsypNUkFkdnB2JiI/ZYd+hBfGC2pJt6JovUJr2sglZ0XvU7gyNT3iUmL3I22pM1gh+iAFPtS++OY0OSKRWnEbe7nMDY41soQW9UnfroexBVd+c1sYbJwbLJyTS2I3HxjIikWC2fGhySCX7ryghTQwJddGSh+q9eM0LgbvJ9Tc=
|
||||
- secure: NUocMJTpGO7PWIMih4kjHGTRvb2vc6ep+fclviipkPzlQ5Ciabco1wW0HQJTX16JINgGVnzwFY16HFylyM74bcZoiSfGsN6E5GAmg5ZRxtpVs2wLHmsrMJxiT3VVMPHkBnZJXBNIcuMw6PAtiAcrOCyNY3Zuig1IuOERt12U2BY=
|
||||
- secure: oLMuVgRvxDjYCb/hnA3YMJPDAAxyG2a7aUoGQHijSSBxL8VSW7BjfplUViCpWCsQADZgxLGHgfNUETAzHwheDm1TJT1KHVrYUXPDnLXgO89DvzrkLXlrr6JbaDMGUjG7fEEBNDnz5qycLiaoItX7x4/GPhSPOZ45q/64rW3Jvl4=
|
||||
- secure: OnTKGDs568hSzE5sT9gQhY+nB1xHpnEMoT24UQybPn7Za79tJCkl3WlnqF2sd3+ImsT62xf6PNqRUue8TLVQLCVXCeStrIFPkdp0sps9xtFdNbi6Vb3yrq8QjU4RAQEz5+g8KcmycYMvF3M09lt7jAv8woebXkXdnzHz3IWhwTs=
|
||||
- secure: 341IG8qb2JKqGDXGsx2a8xEVlkjILA6bSkWqZb9uhoEyW4je7PsqZdCfmKoAcau4I6+sBANu++qARJ58ZpWu+DJzuaKXkhSkdzo/MSykPK04I62v2qhRXUrhkpkXYAB4xK4wKFaCQWVHiCeV5jhEAayZxMB1gLwtxnZRRYXEhY0=
|
||||
- secure: tvd71+q0xvglcUj6ugSw7oPlruTuNH/XGVh/k6B991zM27NQInmNeMWQa/WE7f8s2xSfG8f9cOtf11uDbPSHgyZj3T6CphfIl5sbT04zFO/1MfI5rbMRBXHvFpUWCb4gS+XUJ146DccuZInF9NI1e3aXNK6u3uPgxmn6DomVRlY=
|
||||
- secure: BrMErE+J4TneCAGtDe5s8LQjhOJ6fTJSlA/dtmVx+LhzhyUA303wHCziPxrU2PJDL5fGe3r5zX83uoIXwKmU3kb2jRpy7SxF0kdsxqgdbzCnWINRDX5o0TH7AAViUA+nRccWF8wqNWsvkIhv6Pbr1u8B5xScPvBXhEuHJX2iVxo=
|
||||
- secure: W3o/ae9BZDFNKe0UHGGDuYzriEvf/Eon+miqSwSZ/+rBuTeiX++3dyAMG/4XHeuNDgZ6H7qGtxlkqODK9AHZps5tFZ/zmVzXfzqRItIrGmGLKD7UvbIoS/C5fovhxIwMyWnlXdWeNf4o0QWJed6I188IlDumCxrmnWIWlueap6I=
|
||||
- secure: rSCNg1LnxNjk/ux80iLQrcHqagWf80PBQf0kM9Wj5dD1nLWvbRMSSeXhiOdNY0ZD9RMROdjupsbFShdF788wAi7ITfhrMf09ys0D3/8ZDmCd51WAUvuutxMEz/TJKTWKItr2gbuRoXvv/hQ9DEWXyHx1A9DaDjwYGBH9bnYmgfs=
|
||||
- secure: bHD0y307k3vUyA5cYdNc62Tq78r4HX8F4RG8bkgDAP0Z0u8SCfYunk89kw2NCF+qlo+ux84lhh2n/HKAwIdkupQSJaPGO4i241i8pUd1RA0T+CfjvdmMk6KjgbItauAhctgy61BTRJzoLAZQ75JurHLAjc5JNfSxsa1xQGsWIVQ=
|
||||
- secure: A7NVQrmbAZhwIz+lkDcwX1zw+GJjLbwnW4/A0cCGcZObQxTqM7W6+B6UG9efm2vmxER9xtjstiH9wsLtJYerKxv05jwXoKlq/J+BVu2dTI9S6SqLas6Lo09XFfqtmYKgbV6R2CKDt8hT2a5A/Wp1hK4URjifu2gel/3MO6eeiJs=
|
||||
- secure: BQCOwcb4u4spzd20vaUSkJycJ0oaojdyucmUV9pRYADH+jDEcCiL52L+bMxGZ+5vYPITG9wG2Kjv8VroyIuYfADMjZJjzMOMiwpjTWxoH7gA/12D8p7FcP9npllJgNg0TMvZUULVx2w2JQEGyq3Kfp2oKHfbgkBhtiSDH8mjSqc=
|
||||
- secure: ODDYK3EogzOZ4rd/IW3HRAn+Ynpi1ob/lG7udBiiFhOZB8IWzZkNniRBZv60pOVq62YF0EidkNR4MK3Ln+wh3KLkqBWuR86ORgFmGazGxYlUbAfBfwt75FdK2+WAwyLGR3H7eqgTN+Y4U+GyPMUFfMBXbE73sX8Si2ldLy7n5ZE=
|
||||
- secure: Mk6OHiJ5i4T+/3X5mLOhRuqif7M2cyTPbjNxNhW0oDQG4KB8M+18hDklwnQPpiXOL4LmuuSGDWgOZYnlZHFdLTzj5/nmbfh2qbr30Aqj8OgRnO/jjjU/BrcgBM2zrlH/TOKl5HqHp7bLesHkfTNzNy5IeIuRwZN/8qKNV1HZdtk=
|
||||
- secure: GyPuciPuxMTNxr1igDPQAAvZdTE4bGIzVM4YpURvZngvhxQgWtvF09nV1FfNQAz643aq1bjbZ1ThfuOagWwTRUVqTgstxwCau/EGOAnoMXt1wDfvBuxpxLK2WDnO8PHYTDtpcnes5D6+45K5Z4bFAs0gIw/XoF0tZiCKVEo+OR0=
|
||||
- secure: ix+m/F8qUKdjGpBLUW+okt00kmxFOAi7FKi0ndnjQPnHdygMec00tCxcvW4P16QsjpQq7w098Fsjc2V28hMo4RpH0JFPxnnfFttDZfk15UydrYD65EXhpyvh/xmQYd1cCK+YhymhPc0bOz0d7Ava7H7AGfBUkC0DzMdizpbB/pQ=
|
||||
- secure: ZjxBwneeNa1whozgua2Jx3K9EA0EfaFCjsyB5SGmS8cALzLY4EJawH8iiSGapJrCxz58jK1z3ISdu9a7l5ne85fYI+WuHyTC7QVbW5OpRrOJMwTXf2/hRTVuavp9fA5W7B5nhoqgHMR56YXSaEO6juXiSztsYF7kJiGdCO0f6fQ=
|
||||
- secure: zavu1UqfqRVh5hFaGdopn32B1ysW1sK769L+cSQnEQprDXB11uBcTJgBX104sw1zUnB0/QTfuZ3eKkhSpDpFg66I7IpqW/Aw7iWVa2EI/eGnQ5vOJwxWA/Bd08H5tpeXSCnjSOQp/Ac/0vhZy2DmhToKDPJakEtRP+/eaqbFNgc=
|
||||
- secure: omEb6OGAUVSwHvFqUqqw3z16wDv0YrJzQZgHLZuKD8CvC3HvPDQaykqzvFtqrEWAUl5rZf1bSZ/jylximogKzx2+ENn5TjveJQTzQQwVw9FO/Jn8XVM0x7A3K86JpI0azG4LtFAaqpd4mWIAH5ZFeNYB2x6D2jrjXOajLoJ6zmM=
|
@ -1,8 +0,0 @@
|
||||
source 'https://supermarket.chef.io'
|
||||
|
||||
metadata
|
||||
|
||||
group :integration do
|
||||
cookbook 'minitest-handler'
|
||||
cookbook 'apt_test', :path => './test/cookbooks/apt_test'
|
||||
end
|
@ -1,6 +1,37 @@
|
||||
apt Cookbook CHANGELOG
|
||||
======================
|
||||
|
||||
v2.9.2
|
||||
-------------------
|
||||
- #168 Adding guard to package resource.
|
||||
|
||||
v2.9.1
|
||||
-------------------
|
||||
- Adding package apt-transport-https to default.rb
|
||||
|
||||
v2.9.0
|
||||
-------------------
|
||||
- Add `sensitive` flag for apt\_repositories
|
||||
- Enable installation of recommended or suggested packages
|
||||
- Tidy up `apt-get update` logic
|
||||
- Fixing not_if guard on ruby_block[validate-key #{key}]
|
||||
|
||||
v2.8.2 (2015-08-24)
|
||||
-------------------
|
||||
- Fix removal of apt\_preferences
|
||||
|
||||
v2.8.1 (2015-08-18)
|
||||
-------------------
|
||||
- Handle keyservers as URLs and bare hostnames
|
||||
|
||||
v2.8.0 (2015-08-18)
|
||||
-------------------
|
||||
- Access keyservers on port 80
|
||||
- Adds key\_proxy as LWRP attribute for apt\_repository
|
||||
- Fix wildcard glob preferences files
|
||||
- Fix text output verification for non en\_US locales
|
||||
- Quote repo URLs to deal with spaces
|
||||
|
||||
v2.7.0 (2015-03-23)
|
||||
-------------------
|
||||
- Support Debian 8.0
|
||||
@ -22,7 +53,7 @@ v2.5.3 (2014-08-14)
|
||||
|
||||
v2.5.2 (2014-08-14)
|
||||
-------------------
|
||||
- Fully restore fully restore 2.3.10 behaviour
|
||||
- Fully restore 2.3.10 behaviour
|
||||
|
||||
v2.5.1 (2014-08-14)
|
||||
-------------------
|
||||
|
@ -1,37 +0,0 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
group :lint do
|
||||
gem 'foodcritic', '~> 3.0'
|
||||
gem 'rubocop', '~> 0.23'
|
||||
gem 'rainbow', '< 2.0'
|
||||
end
|
||||
|
||||
group :unit do
|
||||
gem 'berkshelf', '~> 3.0.0.beta6'
|
||||
gem 'chefspec', '~> 4.0'
|
||||
end
|
||||
|
||||
group :kitchen_common do
|
||||
gem 'test-kitchen', '~> 1.2'
|
||||
end
|
||||
|
||||
group :kitchen_vagrant do
|
||||
gem 'kitchen-vagrant', '~> 0.11'
|
||||
end
|
||||
|
||||
group :kitchen_cloud do
|
||||
gem 'kitchen-digitalocean'
|
||||
gem 'kitchen-ec2'
|
||||
end
|
||||
|
||||
group :development do
|
||||
gem 'ruby_gntp'
|
||||
gem 'growl'
|
||||
gem 'rb-fsevent'
|
||||
gem 'guard', '~> 2.4'
|
||||
gem 'guard-kitchen'
|
||||
gem 'guard-foodcritic'
|
||||
gem 'guard-rspec'
|
||||
gem 'guard-rubocop'
|
||||
gem 'rake'
|
||||
end
|
@ -1,35 +0,0 @@
|
||||
# A sample Guardfile
|
||||
# More info at https://github.com/guard/guard#readme
|
||||
|
||||
# guard 'kitchen' do
|
||||
# watch(%r{test/.+})
|
||||
# watch(%r{^recipes/(.+)\.rb$})
|
||||
# watch(%r{^attributes/(.+)\.rb$})
|
||||
# watch(%r{^files/(.+)})
|
||||
# watch(%r{^templates/(.+)})
|
||||
# watch(%r{^providers/(.+)\.rb})
|
||||
# watch(%r{^resources/(.+)\.rb})
|
||||
# end
|
||||
|
||||
guard 'foodcritic', cookbook_paths: '.', all_on_start: false do
|
||||
watch(%r{attributes/.+\.rb$})
|
||||
watch(%r{providers/.+\.rb$})
|
||||
watch(%r{recipes/.+\.rb$})
|
||||
watch(%r{resources/.+\.rb$})
|
||||
watch('metadata.rb')
|
||||
end
|
||||
|
||||
guard 'rubocop', all_on_start: false do
|
||||
watch(%r{attributes/.+\.rb$})
|
||||
watch(%r{providers/.+\.rb$})
|
||||
watch(%r{recipes/.+\.rb$})
|
||||
watch(%r{resources/.+\.rb$})
|
||||
watch('metadata.rb')
|
||||
end
|
||||
|
||||
guard :rspec, cmd: 'bundle exec rspec', all_on_start: false, notification: false do
|
||||
watch(%r{^libraries/(.+)\.rb$})
|
||||
watch(%r{^spec/(.+)_spec\.rb$})
|
||||
watch(%r{^(recipes)/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
||||
watch('spec/spec_helper.rb') { 'spec' }
|
||||
end
|
@ -1,11 +1,10 @@
|
||||
apt Cookbook
|
||||
============
|
||||
[](https://gitter.im/chef-cookbooks/apt?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[][travis]
|
||||
[][cookbook]
|
||||
[][travis]
|
||||
|
||||
[cookbook]: https://community.chef.io/cookbooks/apt
|
||||
[travis]: https://travis-ci.org/opscode-cookbooks/apt
|
||||
[travis]: https://travis-ci.org/chef-cookbooks/apt
|
||||
|
||||
This cookbook includes recipes to execute apt-get update to ensure the local APT package cache is up to date. There are recipes for managing the apt-cacher-ng caching proxy and proxy clients. It also includes a LWRP for managing APT repositories in /etc/apt/sources.list.d as well as an LWRP for pinning packages via /etc/apt/preferences.d.
|
||||
|
||||
@ -50,11 +49,9 @@ To do this, you need to override the `cache_bypass` attribute with an array of r
|
||||
|
||||
```json
|
||||
{
|
||||
...,
|
||||
'apt': {
|
||||
...,
|
||||
'cache_bypass': {
|
||||
URL: PROTOCOL
|
||||
"apt": {
|
||||
"cache_bypass": {
|
||||
"URL": "PROTOCOL"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -64,9 +61,9 @@ For example, to prevent caching and directly connect to the repository at `downl
|
||||
|
||||
```json
|
||||
{
|
||||
'apt': {
|
||||
'cache_bypass': {
|
||||
'download.oracle.com': 'http'
|
||||
"apt": {
|
||||
"cache_bypass": {
|
||||
"download.oracle.com": "http"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -94,7 +91,7 @@ Attributes
|
||||
### Caching
|
||||
|
||||
* `['apt']['cacher_ipaddress']` - use a cacher server (or standard proxy server) not available via search
|
||||
* `['apt']['cacher_interface]` - interface to connect to the cacher-ng service, no default.
|
||||
* `['apt']['cacher_interface']` - interface to connect to the cacher-ng service, no default.
|
||||
* `['apt']['cacher_port']` - port for the cacher-ng service (either client or server), default is '3142'
|
||||
* `['apt']['cacher_ssl_support']` - indicates whether the cacher supports upstream SSL servers, default is 'false'
|
||||
* `['apt']['cacher_dir']` - directory used by cacher-ng service, default is '/var/cache/apt-cacher-ng'
|
||||
@ -105,17 +102,22 @@ Attributes
|
||||
### Unattended Upgrades
|
||||
|
||||
* `['apt']['unattended_upgrades']['enable']` - enables unattended upgrades, default is false
|
||||
* `['apt']['unattended_upgrades']['update_package_lists']` — automatically update package list (`apt-get update`) daily, default is true
|
||||
* `['apt']['unattended_upgrades']['allowed_origins']` — array of allowed apt origins from which to pull automatic upgrades, defaults to a guess at the system's main origin and should almost always be overridden
|
||||
* `['apt']['unattended_upgrades']['package_blacklist']` — an array of package which should never be automatically upgraded, defaults to none
|
||||
* `['apt']['unattended_upgrades']['auto_fix_interrupted_dpkg']` — attempts to repair dpkg state with `dpkg --force-confold --configure -a` if it exits uncleanly, defaults to false (contrary to the unattended-upgrades default)
|
||||
* `['apt']['unattended_upgrades']['minimal_steps']` — Split the upgrade into the smallest possible chunks. This makes the upgrade a bit slower but it has the benefit that shutdown while a upgrade is running is possible (with a small delay). Defaults to false.
|
||||
* `['apt']['unattended_upgrades']['install_on_shutdown']` — Install upgrades when the machine is shuting down instead of doing it in the background while the machine is running. This will (obviously) make shutdown slower. Defaults to false.
|
||||
* `['apt']['unattended_upgrades']['mail']` — Send email to this address for problems or packages upgrades. Defaults to no email.
|
||||
* `['apt']['unattended_upgrades']['mail_only_on_error']` — If set, email will only be set on upgrade errors. Otherwise, an email will be sent after each upgrade. Defaults to true.
|
||||
* `['apt']['unattended_upgrades']['update_package_lists']` - automatically update package list (`apt-get update`) daily, default is true
|
||||
* `['apt']['unattended_upgrades']['allowed_origins']` - array of allowed apt origins from which to pull automatic upgrades, defaults to a guess at the system's main origin and should almost always be overridden
|
||||
* `['apt']['unattended_upgrades']['package_blacklist']` - an array of package which should never be automatically upgraded, defaults to none
|
||||
* `['apt']['unattended_upgrades']['auto_fix_interrupted_dpkg']` - attempts to repair dpkg state with `dpkg --force-confold --configure -a` if it exits uncleanly, defaults to false (contrary to the unattended-upgrades default)
|
||||
* `['apt']['unattended_upgrades']['minimal_steps']` - Split the upgrade into the smallest possible chunks. This makes the upgrade a bit slower but it has the benefit that shutdown while a upgrade is running is possible (with a small delay). Defaults to false.
|
||||
* `['apt']['unattended_upgrades']['install_on_shutdown']` - Install upgrades when the machine is shuting down instead of doing it in the background while the machine is running. This will (obviously) make shutdown slower. Defaults to false.
|
||||
* `['apt']['unattended_upgrades']['mail']` - Send email to this address for problems or packages upgrades. Defaults to no email.
|
||||
* `['apt']['unattended_upgrades']['mail_only_on_error']` - If set, email will only be set on upgrade errors. Otherwise, an email will be sent after each upgrade. Defaults to true.
|
||||
* `['apt']['unattended_upgrades']['remove_unused_dependencies']` Do automatic removal of new unused dependencies after the upgrade. Defaults to false.
|
||||
* `['apt']['unattended_upgrades']['automatic_reboot']` — Automatically reboots *without confirmation* if a restart is required after the upgrade. Defaults to false.
|
||||
* `['apt']['unattended_upgrades']['dl_limit']` — Limits the bandwidth used by apt to download packages. Value given as an integer in kb/sec. Defaults to nil (no limit).
|
||||
* `['apt']['unattended_upgrades']['automatic_reboot']` - Automatically reboots *without confirmation* if a restart is required after the upgrade. Defaults to false.
|
||||
* `['apt']['unattended_upgrades']['dl_limit']` - Limits the bandwidth used by apt to download packages. Value given as an integer in kb/sec. Defaults to nil (no limit).
|
||||
|
||||
### Configuration for APT
|
||||
|
||||
* `['apt']['confd']['install_recommends']` - Consider recommended packages as a dependency for installing. (default: true)
|
||||
* `['apt']['confd']['install_suggests']` - Consider suggested packages as a dependency for installing. (default: false)
|
||||
|
||||
Libraries
|
||||
---------
|
||||
@ -154,6 +156,17 @@ apt_repository 'zenoss' do
|
||||
end
|
||||
```
|
||||
|
||||
Enable Ubuntu [multiverse](https://help.ubuntu.com/community/Repositories/Ubuntu) repositories:
|
||||
|
||||
```ruby
|
||||
apt_repository 'security-ubuntu-multiverse' do
|
||||
uri 'http://security.ubuntu.com/ubuntu'
|
||||
distribution 'trusty-security'
|
||||
components ['multiverse']
|
||||
deb_src 'true'
|
||||
end
|
||||
```
|
||||
|
||||
Add the Nginx PPA, autodetect the key and repository url:
|
||||
|
||||
```ruby
|
||||
@ -265,7 +278,7 @@ License & Authors
|
||||
- Author:: Seth Chisamore (schisamo@chef.io)
|
||||
|
||||
```text
|
||||
Copyright 2009-2013, Chef Software, Inc.
|
||||
Copyright:: 2009-2015, Chef Software, Inc
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -1,59 +0,0 @@
|
||||
require 'rspec/core/rake_task'
|
||||
require 'rubocop/rake_task'
|
||||
require 'foodcritic'
|
||||
require 'kitchen'
|
||||
|
||||
# Style tests. Rubocop and Foodcritic
|
||||
namespace :style do
|
||||
desc 'Run Ruby style checks'
|
||||
RuboCop::RakeTask.new(:ruby)
|
||||
|
||||
desc 'Run Chef style checks'
|
||||
FoodCritic::Rake::LintTask.new(:chef) do |t|
|
||||
t.options = {
|
||||
fail_tags: ['any'],
|
||||
tags: ['~FC005']
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
desc 'Run all style checks'
|
||||
task style: ['style:chef', 'style:ruby']
|
||||
|
||||
# Rspec and ChefSpec
|
||||
desc 'Run ChefSpec examples'
|
||||
RSpec::Core::RakeTask.new(:spec)
|
||||
|
||||
# Integration tests. Kitchen.ci
|
||||
namespace :integration do
|
||||
desc 'Run Test Kitchen with Vagrant'
|
||||
task :vagrant do
|
||||
Kitchen.logger = Kitchen.default_file_logger
|
||||
Kitchen::Config.new.instances.each do |instance|
|
||||
instance.test(:always)
|
||||
end
|
||||
end
|
||||
|
||||
desc 'Run Test Kitchen with cloud plugins'
|
||||
task :cloud do
|
||||
run_kitchen = true
|
||||
if ENV['TRAVIS'] == 'true' && ENV['TRAVIS_PULL_REQUEST'] != 'false'
|
||||
run_kitchen = false
|
||||
end
|
||||
|
||||
if run_kitchen
|
||||
Kitchen.logger = Kitchen.default_file_logger
|
||||
@loader = Kitchen::Loader::YAML.new(project_config: './.kitchen.cloud.yml')
|
||||
config = Kitchen::Config.new(loader: @loader)
|
||||
config.instances.each do |instance|
|
||||
instance.test(:always)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc 'Run all tests on Travis'
|
||||
task travis: ['style', 'spec', 'integration:cloud']
|
||||
|
||||
# Default
|
||||
task default: ['style', 'spec', 'integration:vagrant']
|
@ -1,187 +0,0 @@
|
||||
TESTING doc
|
||||
========================
|
||||
|
||||
Bundler
|
||||
-------
|
||||
A ruby environment with Bundler installed is a prerequisite for using
|
||||
the testing harness shipped with this cookbook. At the time of this
|
||||
writing, it works with Ruby 2.0 and Bundler 1.5.3. All programs
|
||||
involved, with the exception of Vagrant, can be installed by cd'ing
|
||||
into the parent directory of this cookbook and running "bundle install"
|
||||
|
||||
Rakefile
|
||||
--------
|
||||
The Rakefile ships with a number of tasks, each of which can be ran
|
||||
individually, or in groups. Typing "rake" by itself will perform style
|
||||
checks with Rubocop and Foodcritic, ChefSpec with rspec, and
|
||||
integration with Test Kitchen using the Vagrant driver by
|
||||
default.Alternatively, integration tests can be ran with Test Kitchen
|
||||
cloud drivers.
|
||||
|
||||
```
|
||||
$ rake -T
|
||||
rake integration:cloud # Run Test Kitchen with cloud plugins
|
||||
rake integration:vagrant # Run Test Kitchen with Vagrant
|
||||
rake spec # Run ChefSpec examples
|
||||
rake style # Run all style checks
|
||||
rake style:chef # Lint Chef cookbooks
|
||||
rake style:ruby # Run Ruby style checks
|
||||
rake travis # Run all tests on Travis
|
||||
```
|
||||
|
||||
Style Testing
|
||||
-------------
|
||||
Ruby style tests can be performed by Rubocop by issuing either
|
||||
```
|
||||
bundle exec rubocop
|
||||
```
|
||||
or
|
||||
```
|
||||
rake style:ruby
|
||||
```
|
||||
|
||||
Chef style tests can be performed with Foodcritic by issuing either
|
||||
```
|
||||
bundle exec foodcritic
|
||||
```
|
||||
or
|
||||
```
|
||||
rake style:chef
|
||||
```
|
||||
|
||||
Spec Testing
|
||||
-------------
|
||||
Unit testing is done by running Rspec examples. Rspec will test any
|
||||
libraries, then test recipes using ChefSpec. This works by compiling a
|
||||
recipe (but not converging it), and allowing the user to make
|
||||
assertions about the resource_collection.
|
||||
|
||||
Integration Testing
|
||||
-------------------
|
||||
Integration testing is performed by Test Kitchen. Test Kitchen will
|
||||
use either the Vagrant driver or various cloud drivers to instantiate
|
||||
machines and apply cookbooks. After a successful converge, tests are
|
||||
uploaded and ran out of band of Chef. Tests should be designed to
|
||||
ensure that a recipe has accomplished its goal.
|
||||
|
||||
Integration Testing using Vagrant
|
||||
---------------------------------
|
||||
Integration tests can be performed on a local workstation using
|
||||
Virtualbox or VMWare. Detailed instructions for setting this up can be
|
||||
found at the [Bento](https://github.com/chef/bento) project web site.
|
||||
|
||||
Integration tests using Vagrant can be performed with either
|
||||
```
|
||||
bundle exec kitchen test
|
||||
```
|
||||
or
|
||||
```
|
||||
rake integration:vagrant
|
||||
```
|
||||
|
||||
Integration Testing using Cloud providers
|
||||
-----------------------------------------
|
||||
Integration tests can be performed on cloud providers using
|
||||
Test Kitchen plugins. This cookbook ships a ```.kitchen.cloud.yml```
|
||||
that references environmental variables present in the shell that
|
||||
```kitchen test``` is ran from. These usually contain authentication
|
||||
tokens for driving IaaS APIs, as well as the paths to ssh private keys
|
||||
needed for Test Kitchen log into them after they've been created.
|
||||
|
||||
Examples of environment variables being set in ```~/.bash_profile```:
|
||||
```
|
||||
# digital_ocean
|
||||
export DIGITAL_OCEAN_CLIENT_ID='your_bits_here'
|
||||
export DIGITAL_OCEAN_API_KEY='your_bits_here'
|
||||
export DIGITAL_OCEAN_SSH_KEY_IDS='your_bits_here'
|
||||
|
||||
# aws
|
||||
export AWS_ACCESS_KEY_ID='your_bits_here'
|
||||
export AWS_SECRET_ACCESS_KEY='your_bits_here'
|
||||
export AWS_KEYPAIR_NAME='your_bits_here'
|
||||
|
||||
# joyent
|
||||
export SDC_CLI_ACCOUNT='your_bits_here'
|
||||
export SDC_CLI_IDENTITY='your_bits_here'
|
||||
export SDC_CLI_KEY_ID='your_bits_here'
|
||||
```
|
||||
|
||||
Integration tests using cloud drivers can be performed with either
|
||||
```
|
||||
export KITCHEN_YAML=.kitchen.cloud.yml
|
||||
bundle exec kitchen test
|
||||
```
|
||||
or
|
||||
```
|
||||
rake integration:cloud
|
||||
```
|
||||
|
||||
Digital Ocean Hint
|
||||
------------------
|
||||
At the time of this writing, you cannot find the numerical values
|
||||
needed for your SSH_KEY_IDS from the GUI. Instead, you will need to
|
||||
access the API from the command line.
|
||||
|
||||
curl -L 'https://api.digitalocean.com/ssh_keys/?client_id=your_bits_here&api_key=your_bits_here'
|
||||
|
||||
Words about .travis.yml
|
||||
-----------------------
|
||||
In order for Travis to perform integration tests on public cloud
|
||||
providers, two major things need to happen. First, the environment
|
||||
variables referenced by ```.kitchen.cloud.yml``` need to be made
|
||||
available. Second, the private half of the ssh keys needed to log into
|
||||
machines need to be dropped off on the machine.
|
||||
|
||||
The first part is straight forward. The travis gem can encrypt
|
||||
environment variables against the public key on the Travis repository
|
||||
and add them to the .travis.yml.
|
||||
|
||||
```
|
||||
gem install travis
|
||||
travis encrypt AWS_ACCESS_KEY_ID='your_bits_here' --add
|
||||
travis encrypt AWS_SECRET_ACCESS_'your_bits_here' --add
|
||||
travis encrypt AWS_KEYPAIR_NAME='your_bits_here' --add
|
||||
travis encrypt EC2_SSH_KEY_PATH='~/.ssh/id_ec2.pem' --add
|
||||
|
||||
travis encrypt DIGITAL_OCEAN_CLIENT_ID='your_bits_here' --add
|
||||
travis encrypt DIGITAL_OCEAN_API_KEY='your_bits_here' --add
|
||||
travis encrypt DIGITAL_OCEAN_SSH_KEY_IDS='your_bits_here' --add
|
||||
travis encrypt DIGITAL_OCEAN_SSH_KEY_PATH='~/.ssh/id_do.pem' --add
|
||||
```
|
||||
|
||||
The second part is a little more complicated. Travis ENV variables are
|
||||
restricted to 90 bytes, and will not fit an entire SSH key. This can
|
||||
be worked around by breaking them up into 90 byte chunks, stashing
|
||||
them into ENV variables, then digging them out in the
|
||||
```before_install``` section of .travis.yml
|
||||
|
||||
Here is an AWK script to do the encoding.
|
||||
```
|
||||
base64 ~/.ssh/travisci_cook_digitalocean.pem | \
|
||||
awk '{
|
||||
j=0;
|
||||
for( i=1; i<length; i=i+90 ) {
|
||||
system("travis encrypt DO_KEY_CHUNK_" j "=" substr($0, i, 90) " --add");
|
||||
j++;
|
||||
}
|
||||
}'
|
||||
|
||||
base64 ~/.ssh/travisci_cook_ec2.pem | \
|
||||
awk '{
|
||||
j=0;
|
||||
for( i=1; i<length; i=i+90 ) {
|
||||
system("travis encrypt EC2_KEY_CHUNK_" j "=" substr($0, i, 90)" --add");
|
||||
j++;
|
||||
}
|
||||
}'
|
||||
```
|
||||
|
||||
Then in .travis.yml:
|
||||
```
|
||||
before_install:
|
||||
- echo -n $DO_KEY_CHUNK_{0..30} >> ~/.ssh/id_do.base64
|
||||
- cat ~/.ssh/id_do.base64 | tr -d ' ' | base64 --decode > ~/.ssh/id_do.pem
|
||||
- echo -n $EC2_KEY_CHUNK_{0..30} >> ~/.ssh/id_ec2.base64
|
||||
- cat ~/.ssh/id_ec2.base64 | tr -d ' ' | base64 --decode > ~/.ssh/id_ec2.pem
|
||||
```
|
||||
|
@ -46,3 +46,6 @@ default['apt']['unattended_upgrades']['remove_unused_dependencies'] = false
|
||||
default['apt']['unattended_upgrades']['automatic_reboot'] = false
|
||||
default['apt']['unattended_upgrades']['automatic_reboot_time'] = 'now'
|
||||
default['apt']['unattended_upgrades']['dl_limit'] = nil
|
||||
|
||||
default['apt']['confd']['install_recommends'] = true
|
||||
default['apt']['confd']['install_suggests'] = false
|
||||
|
@ -27,6 +27,18 @@ module Apt
|
||||
!which('apt-get').nil?
|
||||
end
|
||||
|
||||
# Determines whether we need to run `apt-get update`
|
||||
#
|
||||
# @return [Boolean]
|
||||
def apt_up_to_date?
|
||||
if ::File.exist?('/var/lib/apt/periodic/update-success-stamp') &&
|
||||
::File.mtime('/var/lib/apt/periodic/update-success-stamp') > Time.now - node['apt']['periodic_update_min_delay']
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
# Finds a command in $PATH
|
||||
#
|
||||
# @return [String, nil]
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,38 +0,0 @@
|
||||
name 'apt'
|
||||
maintainer 'Chef Software, Inc.'
|
||||
maintainer_email 'cookbooks@chef.io'
|
||||
license 'Apache 2.0'
|
||||
description 'Configures apt and apt services and LWRPs for managing apt repositories and preferences'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '2.7.0'
|
||||
recipe 'apt', 'Runs apt-get update during compile phase and sets up preseed directories'
|
||||
recipe 'apt::cacher-ng', 'Set up an apt-cacher-ng caching proxy'
|
||||
recipe 'apt::cacher-client', 'Client for the apt::cacher-ng caching proxy'
|
||||
|
||||
%w{ ubuntu debian }.each do |os|
|
||||
supports os
|
||||
end
|
||||
|
||||
attribute 'apt/cacher-client/restrict_environment',
|
||||
:description => 'Whether to restrict the search for the caching server to the same environment as this node',
|
||||
:default => 'false'
|
||||
|
||||
attribute 'apt/cacher_port',
|
||||
:description => 'Default listen port for the caching server',
|
||||
:default => '3142'
|
||||
|
||||
attribute 'apt/cacher_ssl_support',
|
||||
:description => 'The caching server supports upstream SSL servers via CONNECT',
|
||||
:default => 'false'
|
||||
|
||||
attribute 'apt/cacher_interface',
|
||||
:description => 'Default listen interface for the caching server',
|
||||
:default => nil
|
||||
|
||||
attribute 'apt/key_proxy',
|
||||
:description => 'Passed as the proxy passed to GPG for the apt_repository resource',
|
||||
:default => ''
|
||||
|
||||
attribute 'apt/caching_server',
|
||||
:description => 'Set this to true if the node is a caching server',
|
||||
:default => 'false'
|
@ -28,12 +28,16 @@ def build_pref(package_name, pin, pin_priority)
|
||||
"Package: #{package_name}\nPin: #{pin}\nPin-Priority: #{pin_priority}\n"
|
||||
end
|
||||
|
||||
def safe_name(name)
|
||||
name.tr('.', '_').gsub('*', 'wildcard')
|
||||
end
|
||||
|
||||
action :add do
|
||||
preference = build_pref(
|
||||
new_resource.glob || new_resource.package_name,
|
||||
new_resource.pin,
|
||||
new_resource.pin_priority
|
||||
)
|
||||
)
|
||||
|
||||
directory '/etc/apt/preferences.d' do
|
||||
owner 'root'
|
||||
@ -43,6 +47,16 @@ action :add do
|
||||
action :create
|
||||
end
|
||||
|
||||
name = safe_name(new_resource.name)
|
||||
|
||||
file "/etc/apt/preferences.d/#{new_resource.name}.pref" do
|
||||
action :delete
|
||||
if ::File.exist?("/etc/apt/preferences.d/#{new_resource.name}.pref")
|
||||
Chef::Log.warn "Replacing #{new_resource.name}.pref with #{name}.pref in /etc/apt/preferences.d/"
|
||||
end
|
||||
only_if { name != new_resource.name }
|
||||
end
|
||||
|
||||
file "/etc/apt/preferences.d/#{new_resource.name}" do
|
||||
action :delete
|
||||
if ::File.exist?("/etc/apt/preferences.d/#{new_resource.name}")
|
||||
@ -50,7 +64,7 @@ action :add do
|
||||
end
|
||||
end
|
||||
|
||||
file "/etc/apt/preferences.d/#{new_resource.name}.pref" do
|
||||
file "/etc/apt/preferences.d/#{name}.pref" do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode 00644
|
||||
@ -60,9 +74,10 @@ action :add do
|
||||
end
|
||||
|
||||
action :remove do
|
||||
if ::File.exist?("/etc/apt/preferences.d/#{new_resource.name}.pref")
|
||||
Chef::Log.info "Un-pinning #{new_resource.name} from /etc/apt/preferences.d/"
|
||||
file "/etc/apt/preferences.d/#{new_resource.name}.pref" do
|
||||
name = safe_name(new_resource.name)
|
||||
if ::File.exist?("/etc/apt/preferences.d/#{name}.pref")
|
||||
Chef::Log.info "Un-pinning #{name} from /etc/apt/preferences.d/"
|
||||
file "/etc/apt/preferences.d/#{name}.pref" do
|
||||
action :delete
|
||||
end
|
||||
end
|
||||
|
@ -24,25 +24,37 @@ def whyrun_supported?
|
||||
end
|
||||
|
||||
# install apt key from keyserver
|
||||
def install_key_from_keyserver(key, keyserver)
|
||||
def install_key_from_keyserver(key, keyserver, key_proxy)
|
||||
execute "install-key #{key}" do
|
||||
if !node['apt']['key_proxy'].empty?
|
||||
command "apt-key adv --keyserver-options http-proxy=#{node['apt']['key_proxy']} --keyserver hkp://#{keyserver}:80 --recv #{key}"
|
||||
else
|
||||
if keyserver.start_with?('hkp://')
|
||||
command "apt-key adv --keyserver #{keyserver} --recv #{key}"
|
||||
elsif key_proxy.empty?
|
||||
command "apt-key adv --keyserver hkp://#{keyserver}:80 --recv #{key}"
|
||||
else
|
||||
command "apt-key adv --keyserver-options http-proxy=#{key_proxy} --keyserver hkp://#{keyserver}:80 --recv #{key}"
|
||||
end
|
||||
sensitive new_resource.sensitive if respond_to?(:sensitive)
|
||||
action :run
|
||||
not_if do
|
||||
extract_fingerprints_from_cmd('apt-key finger').any? do |fingerprint|
|
||||
key_present = extract_fingerprints_from_cmd('apt-key finger').any? do |fingerprint|
|
||||
fingerprint.end_with?(key.upcase)
|
||||
end
|
||||
|
||||
key_present && key_is_valid('apt-key list', key.upcase)
|
||||
end
|
||||
end
|
||||
|
||||
ruby_block "validate-key #{key}" do
|
||||
block do
|
||||
fail "The key #{key} is no longer valid and cannot be used for an apt repository."
|
||||
end
|
||||
not_if { key_is_valid('apt-key list', key.upcase) }
|
||||
end
|
||||
end
|
||||
|
||||
# run command and extract gpg ids
|
||||
def extract_fingerprints_from_cmd(cmd)
|
||||
so = Mixlib::ShellOut.new(cmd, env: { 'LANG' => 'en_US' })
|
||||
so = Mixlib::ShellOut.new(cmd, env: { 'LANG' => 'en_US', 'LANGUAGE' => 'en_US' })
|
||||
so.run_command
|
||||
so.stdout.split(/\n/).map do |t|
|
||||
if z = t.match(/^ +Key fingerprint = ([0-9A-F ]+)/)
|
||||
@ -51,14 +63,34 @@ def extract_fingerprints_from_cmd(cmd)
|
||||
end.compact
|
||||
end
|
||||
|
||||
# determine whether apt thinks the key is still valid
|
||||
def key_is_valid(cmd, key)
|
||||
valid = true
|
||||
|
||||
so = Mixlib::ShellOut.new(cmd, env: { 'LANG' => 'en_US', 'LANGUAGE' => 'en_US' })
|
||||
so.run_command
|
||||
# rubocop:disable Style/Next
|
||||
so.stdout.split(/\n/).map do |t|
|
||||
if t.match(%r{^\/#{key}.*\[expired: .*\]$})
|
||||
Chef::Log.debug "Found expired key: #{t}"
|
||||
valid = false
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
Chef::Log.debug "key #{key} validity: #{valid}"
|
||||
valid
|
||||
end
|
||||
|
||||
# install apt key from URI
|
||||
def install_key_from_uri(uri)
|
||||
key_name = uri.split(/\//).last
|
||||
key_name = uri.split(%r{\/}).last
|
||||
cached_keyfile = "#{Chef::Config[:file_cache_path]}/#{key_name}"
|
||||
if new_resource.key =~ /http/
|
||||
remote_file cached_keyfile do
|
||||
source new_resource.key
|
||||
mode 00644
|
||||
sensitive new_resource.sensitive if respond_to?(:sensitive)
|
||||
action :create
|
||||
end
|
||||
else
|
||||
@ -66,12 +98,20 @@ def install_key_from_uri(uri)
|
||||
source new_resource.key
|
||||
cookbook new_resource.cookbook
|
||||
mode 00644
|
||||
sensitive new_resource.sensitive if respond_to?(:sensitive)
|
||||
action :create
|
||||
end
|
||||
|
||||
ruby_block "validate-key #{cached_keyfile}" do
|
||||
block do
|
||||
fail "The key #{cached_keyfile} is no longer valid and cannot be used for an apt repository." unless key_is_valid("gpg #{cached_keyfile}", '')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
execute "install-key #{key_name}" do
|
||||
command "apt-key add #{cached_keyfile}"
|
||||
sensitive new_resource.sensitive if respond_to?(:sensitive)
|
||||
action :run
|
||||
not_if do
|
||||
installed_keys = extract_fingerprints_from_cmd('apt-key finger')
|
||||
@ -83,19 +123,19 @@ end
|
||||
|
||||
# build repo file contents
|
||||
def build_repo(uri, distribution, components, trusted, arch, add_deb_src)
|
||||
uri = '"' + uri + '"' unless uri.start_with?("\"", "'")
|
||||
components = components.join(' ') if components.respond_to?(:join)
|
||||
repo_options = []
|
||||
repo_options << "arch=#{arch}" if arch
|
||||
repo_options << 'trusted=yes' if trusted
|
||||
repo_options = '[' + repo_options.join(' ') + ']' unless repo_options.empty?
|
||||
repo_info = "#{uri} #{distribution} #{components}\n"
|
||||
repo_info = "#{repo_options} #{repo_info}" unless repo_options.empty?
|
||||
repo_opts = '[' + repo_options.join(' ') + ']' unless repo_options.empty?
|
||||
repo_info = "#{repo_opts} #{uri} #{distribution} #{components}\n".lstrip
|
||||
repo = "deb #{repo_info}"
|
||||
repo << "deb-src #{repo_info}" if add_deb_src
|
||||
repo
|
||||
end
|
||||
|
||||
def get_ppa_key(ppa_owner, ppa_repo)
|
||||
def get_ppa_key(ppa_owner, ppa_repo, key_proxy)
|
||||
# Launchpad has currently only one stable API which is marked as EOL April 2015.
|
||||
# The new api in devel still uses the same api call for +archive, so I made the version
|
||||
# configurable to provide some sort of workaround if api 1.0 ceases to exist.
|
||||
@ -115,12 +155,12 @@ def get_ppa_key(ppa_owner, ppa_repo)
|
||||
raise error
|
||||
end
|
||||
|
||||
install_key_from_keyserver(key_id, default_keyserver)
|
||||
install_key_from_keyserver(key_id, default_keyserver, key_proxy)
|
||||
end
|
||||
|
||||
# fetch ppa key, return full repo url
|
||||
def get_ppa_url(ppa)
|
||||
repo_schema = 'http://ppa.launchpad.net/%s/%s/ubuntu'
|
||||
def get_ppa_url(ppa, key_proxy)
|
||||
repo_schema = 'http://ppa.launchpad.net/%s/%s/ubuntu'
|
||||
|
||||
# ppa:user/repo logic ported from
|
||||
# http://bazaar.launchpad.net/~ubuntu-core-dev/software-properties/main/view/head:/softwareproperties/ppa.py#L86
|
||||
@ -131,7 +171,7 @@ def get_ppa_url(ppa)
|
||||
ppa_repo = ppa_name.split('/')[1]
|
||||
ppa_repo = 'ppa' if ppa_repo.nil?
|
||||
|
||||
get_ppa_key(ppa_owner, ppa_repo)
|
||||
get_ppa_key(ppa_owner, ppa_repo, key_proxy)
|
||||
|
||||
format(repo_schema, ppa_owner, ppa_repo)
|
||||
end
|
||||
@ -139,7 +179,7 @@ end
|
||||
action :add do
|
||||
# add key
|
||||
if new_resource.keyserver && new_resource.key
|
||||
install_key_from_keyserver(new_resource.key, new_resource.keyserver)
|
||||
install_key_from_keyserver(new_resource.key, new_resource.keyserver, new_resource.key_proxy)
|
||||
elsif new_resource.key
|
||||
install_key_from_uri(new_resource.key)
|
||||
end
|
||||
@ -156,6 +196,7 @@ action :add do
|
||||
execute 'apt-get update' do
|
||||
command "apt-get update -o Dir::Etc::sourcelist='sources.list.d/#{new_resource.name}.list' -o Dir::Etc::sourceparts='-' -o APT::Get::List-Cleanup='0'"
|
||||
ignore_failure true
|
||||
sensitive new_resource.sensitive if respond_to?(:sensitive)
|
||||
action :nothing
|
||||
notifies :run, 'execute[apt-cache gencaches]', :immediately
|
||||
end
|
||||
@ -163,13 +204,13 @@ action :add do
|
||||
if new_resource.uri.start_with?('ppa:')
|
||||
# build ppa repo file
|
||||
repository = build_repo(
|
||||
get_ppa_url(new_resource.uri),
|
||||
get_ppa_url(new_resource.uri, new_resource.key_proxy),
|
||||
new_resource.distribution,
|
||||
'main',
|
||||
new_resource.trusted,
|
||||
new_resource.arch,
|
||||
new_resource.deb_src
|
||||
)
|
||||
)
|
||||
else
|
||||
# build repo file
|
||||
repository = build_repo(
|
||||
@ -179,7 +220,7 @@ action :add do
|
||||
new_resource.trusted,
|
||||
new_resource.arch,
|
||||
new_resource.deb_src
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
file "/etc/apt/sources.list.d/#{new_resource.name}.list" do
|
||||
@ -187,6 +228,7 @@ action :add do
|
||||
group 'root'
|
||||
mode 00644
|
||||
content repository
|
||||
sensitive new_resource.sensitive if respond_to?(:sensitive)
|
||||
action :create
|
||||
notifies :delete, 'file[/var/lib/apt/periodic/update-success-stamp]', :immediately
|
||||
notifies :run, 'execute[apt-get update]', :immediately if new_resource.cache_rebuild
|
||||
@ -197,6 +239,7 @@ action :remove do
|
||||
if ::File.exist?("/etc/apt/sources.list.d/#{new_resource.name}.list")
|
||||
Chef::Log.info "Removing #{new_resource.name} repository from /etc/apt/sources.list.d/"
|
||||
file "/etc/apt/sources.list.d/#{new_resource.name}.list" do
|
||||
sensitive new_resource.sensitive if respond_to?(:sensitive)
|
||||
action :delete
|
||||
end
|
||||
end
|
||||
|
@ -64,11 +64,11 @@ if servers.length > 0
|
||||
group 'root'
|
||||
mode 00644
|
||||
variables(
|
||||
:proxy => cacher_ipaddress,
|
||||
:port => servers[0]['apt']['cacher_port'],
|
||||
:proxy_ssl => servers[0]['apt']['cacher_ssl_support'],
|
||||
:bypass => node['apt']['cache_bypass']
|
||||
)
|
||||
proxy: cacher_ipaddress,
|
||||
port: servers[0]['apt']['cacher_port'],
|
||||
proxy_ssl: servers[0]['apt']['cacher_ssl_support'],
|
||||
bypass: node['apt']['cache_bypass']
|
||||
)
|
||||
action(node['apt']['compiletime'] ? :nothing : :create)
|
||||
notifies :run, 'execute[apt-get update]', :immediately
|
||||
end
|
||||
|
@ -38,6 +38,6 @@ template '/etc/apt-cacher-ng/acng.conf' do
|
||||
end
|
||||
|
||||
service 'apt-cacher-ng' do
|
||||
supports :restart => true, :status => false
|
||||
supports restart: true, status: false
|
||||
action [:enable, :start]
|
||||
end
|
||||
|
@ -35,7 +35,7 @@ file '/var/lib/apt/periodic/update-success-stamp' do
|
||||
end
|
||||
|
||||
# If compile_time_update run apt-get update at compile time
|
||||
if node['apt']['compile_time_update'] && (!::File.exist?('/var/lib/apt/periodic/update-success-stamp') || !::File.exist?(first_run_file))
|
||||
if node['apt']['compile_time_update'] && (!apt_up_to_date? || !::File.exist?(first_run_file))
|
||||
e = bash 'apt-get-update at compile time' do
|
||||
code <<-EOH
|
||||
apt-get update
|
||||
@ -58,15 +58,6 @@ cookbook_file '/etc/apt/apt.conf.d/15update-stamp' do
|
||||
source '15update-stamp'
|
||||
end
|
||||
|
||||
# Run apt-get update to create the stamp file
|
||||
execute 'apt-get-update' do
|
||||
command 'apt-get update'
|
||||
ignore_failure true
|
||||
only_if { apt_installed? }
|
||||
not_if { ::File.exist?('/var/lib/apt/periodic/update-success-stamp') }
|
||||
notifies :touch, 'file[/var/lib/apt/periodic/update-success-stamp]', :immediately
|
||||
end
|
||||
|
||||
# For other recipes to call to force an update
|
||||
execute 'apt-get update' do
|
||||
command 'apt-get update'
|
||||
@ -93,11 +84,8 @@ end
|
||||
execute 'apt-get-update-periodic' do
|
||||
command 'apt-get update'
|
||||
ignore_failure true
|
||||
only_if do
|
||||
apt_installed? &&
|
||||
::File.exist?('/var/lib/apt/periodic/update-success-stamp') &&
|
||||
::File.mtime('/var/lib/apt/periodic/update-success-stamp') < Time.now - node['apt']['periodic_update_min_delay']
|
||||
end
|
||||
only_if { apt_installed? }
|
||||
not_if { apt_up_to_date? }
|
||||
notifies :touch, 'file[/var/lib/apt/periodic/update-success-stamp]', :immediately
|
||||
end
|
||||
|
||||
@ -110,3 +98,15 @@ end
|
||||
only_if { apt_installed? }
|
||||
end
|
||||
end
|
||||
|
||||
template '/etc/apt/apt.conf.d/10recommends' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '644'
|
||||
source '10recommends.erb'
|
||||
end
|
||||
|
||||
package 'apt-transport-https' do
|
||||
only_if { apt_installed? }
|
||||
action :install
|
||||
end
|
||||
|
@ -31,7 +31,7 @@ state_attrs :glob,
|
||||
:pin,
|
||||
:pin_priority
|
||||
|
||||
attribute :package_name, :kind_of => String, :name_attribute => true, :regex => [/^([a-z]|[A-Z]|[0-9]|_|-|\.)+$/]
|
||||
attribute :glob, :kind_of => String
|
||||
attribute :pin, :kind_of => String
|
||||
attribute :pin_priority, :kind_of => String
|
||||
attribute :package_name, kind_of: String, name_attribute: true, regex: [/^([a-z]|[A-Z]|[0-9]|_|-|\.|\*)+$/]
|
||||
attribute :glob, kind_of: String
|
||||
attribute :pin, kind_of: String
|
||||
attribute :pin_priority, kind_of: String
|
||||
|
@ -34,22 +34,27 @@ state_attrs :arch,
|
||||
:distribution,
|
||||
:key,
|
||||
:keyserver,
|
||||
:key_proxy,
|
||||
:repo_name,
|
||||
:trusted,
|
||||
:uri
|
||||
:uri,
|
||||
:sensitive
|
||||
|
||||
# name of the repo, used for source.list filename
|
||||
attribute :repo_name, :kind_of => String, :name_attribute => true, :regex => [/^([a-z]|[A-Z]|[0-9]|_|-|\.)+$/]
|
||||
attribute :uri, :kind_of => String
|
||||
attribute :distribution, :kind_of => String
|
||||
attribute :components, :kind_of => Array, :default => []
|
||||
attribute :arch, :kind_of => String, :default => nil
|
||||
attribute :trusted, :kind_of => [TrueClass, FalseClass], :default => false
|
||||
attribute :repo_name, kind_of: String, name_attribute: true, regex: [/^([a-z]|[A-Z]|[0-9]|_|-|\.)+$/]
|
||||
attribute :uri, kind_of: String
|
||||
attribute :distribution, kind_of: String
|
||||
attribute :components, kind_of: Array, default: []
|
||||
attribute :arch, kind_of: String, default: nil
|
||||
attribute :trusted, kind_of: [TrueClass, FalseClass], default: false
|
||||
# whether or not to add the repository as a source repo as well
|
||||
attribute :deb_src, :default => false
|
||||
attribute :keyserver, :kind_of => String, :default => nil
|
||||
attribute :key, :kind_of => String, :default => nil
|
||||
attribute :cookbook, :kind_of => String, :default => nil
|
||||
attribute :deb_src, default: false
|
||||
attribute :keyserver, kind_of: String, default: nil
|
||||
attribute :key, kind_of: String, default: nil
|
||||
attribute :key_proxy, kind_of: String, default: node['apt']['key_proxy']
|
||||
attribute :cookbook, kind_of: String, default: nil
|
||||
# trigger cache rebuild
|
||||
# If not you can trigger in the recipe itself after checking the status of resource.updated{_by_last_action}?
|
||||
attribute :cache_rebuild, :kind_of => [TrueClass, FalseClass], :default => true
|
||||
attribute :cache_rebuild, kind_of: [TrueClass, FalseClass], default: true
|
||||
# Hide content of the source file, don't show output for commands being run, etc.
|
||||
attribute :sensitive, kind_of: [TrueClass, FalseClass], default: false
|
||||
|
3
cookbooks/apt/templates/default/10recommends.erb
Normal file
3
cookbooks/apt/templates/default/10recommends.erb
Normal file
@ -0,0 +1,3 @@
|
||||
# Managed by Chef
|
||||
APT::Install-Recommends "<%= node['apt']['confd']['install_recommends'] ? 1 : 0 %>";
|
||||
APT::Install-Suggests "<%= node['apt']['confd']['install_suggests'] ? 1 : 0 %>";
|
@ -1,63 +1,80 @@
|
||||
ark Cookbook CHANGELOG
|
||||
======================
|
||||
# ark Cookbook CHANGELOG
|
||||
This file is used to list changes made in each version of the ark cookbook.
|
||||
|
||||
## v1.0.1 (2016-02-16)
|
||||
- Remove a large number of zero byte archives that snuck into the repository
|
||||
- Remove a Chef 10 compatibility check in the custom resource
|
||||
|
||||
v0.9.0 (2014-06-06)
|
||||
-------------------
|
||||
* [COOK-3642] Add Windows support
|
||||
## v1.0.0 (2016-02-09)
|
||||
- Added the pkg-config package to the debian platform family
|
||||
- Added tar, xz-lzma-compat, and bzip2 packages to the RHEL and fedora platform families
|
||||
- Updated FreeBSD to install gmake instead of make
|
||||
- Added OS X, SmartOS, and FreeBSD to the tar path attributes to support those platforms
|
||||
- Removed the has_binaries attribute from put action documentation in the readme file since this isn't supported there
|
||||
- Moved the libraries module locations to no longer be under Opscode:: and broke out libraries into more logical units
|
||||
- Fixed issues with spaces in Windows paths that could cause failures
|
||||
- Fixed a bad attribute for the 7zip home on windows. Instead of using a node attribute use the value directly to avoid computed attribute overiding issues
|
||||
- Switched from the 7-zip cookbook to seven_zip since the 7-zip cookbook is now deprecated
|
||||
- Changed unzip commands to not use -u so that a newer archive can overwrite an existing directory
|
||||
- Added support for actions py_setup, py_setup_install, py_setup_build
|
||||
- Fixed setting home_dir attribute
|
||||
- Added source_url and issues_url to the metadata.rb
|
||||
- Expanded the supported platforms in metadata.rb
|
||||
- Removed all references to Opscode
|
||||
- Improved error logging when an unknown extension is encountered
|
||||
- Added support for .tar files
|
||||
- Improved overall testing:
|
||||
- Removed the kitchen.cloud.yml file and gem dependencies
|
||||
- Added integration testing in Travis with Kitchen-Docker and Travis tests now run using the nightly build of ChefDK
|
||||
- Expanded platforms tested in the .kitchen.yml file
|
||||
- Updated the Gemfile with the latest testing dependencies
|
||||
- Added full Chefspec coverage
|
||||
- Greatly expanded the ark_spec test cookbook
|
||||
- Removed the original minitests
|
||||
|
||||
- Added standard Chef .gitignore and chefignore files
|
||||
- Resolved a large number of rubocop warnings
|
||||
- Removed old Opscode contributing and testing docs
|
||||
- Added a cookbook version badge to the readme
|
||||
- Removed the Toftfile
|
||||
|
||||
v0.8.2 (2014-04-23)
|
||||
-------------------
|
||||
## v0.9.0 (2014-06-06)
|
||||
- [COOK-3642] Add Windows support
|
||||
|
||||
## v0.8.2 (2014-04-23)
|
||||
- [COOK-4514] - Support for SLES with the Ark cookbook
|
||||
|
||||
|
||||
v0.8.0 (2014-04-10)
|
||||
-------------------
|
||||
## v0.8.0 (2014-04-10)
|
||||
- [COOK-2771] - Add support for XZ compression
|
||||
|
||||
|
||||
v0.7.2 (2014-03-28)
|
||||
-------------------
|
||||
## v0.7.2 (2014-03-28)
|
||||
- [COOK-4477] - Fix failing test suite
|
||||
- [COOK-4484] - Replace strip_leading_dir attribute with more general strip_components
|
||||
|
||||
|
||||
v0.7.0 (2014-03-18)
|
||||
-------------------
|
||||
## v0.7.0 (2014-03-18)
|
||||
- [COOK-4437] - configure and install_with_make should chown after unpack
|
||||
|
||||
|
||||
v0.6.0 (2014-02-27)
|
||||
-------------------
|
||||
## v0.6.0 (2014-02-27)
|
||||
[COOK-3786] - Unable to install multiple versions of archive without duplication
|
||||
|
||||
|
||||
v0.5.0 (2014-02-21)
|
||||
-------------------
|
||||
## v0.5.0 (2014-02-21)
|
||||
### Bug
|
||||
- **[COOK-4288](https://tickets.opscode.com/browse/COOK-4288)** - Cleanup the Kitchen
|
||||
|
||||
### Improvement
|
||||
- **[COOK-4264](https://tickets.opscode.com/browse/COOK-4264)** - Add node['ark']['package_dependencies'] to allow tuning packages.
|
||||
|
||||
|
||||
v0.4.2
|
||||
------
|
||||
## v0.4.2
|
||||
### Improvement
|
||||
- **[COOK-3854](https://tickets.opscode.com/browse/COOK-3854)** - Capability with mac_os_x: '/bin/chown' - No such file or directory
|
||||
- Cleaning up some style for rubucop
|
||||
- Updating test harness
|
||||
|
||||
|
||||
v0.4.0
|
||||
------
|
||||
## v0.4.0
|
||||
### Improvement
|
||||
- **[COOK-3539](https://tickets.opscode.com/browse/COOK-3539)** - Allow dumping of bz2 and gzip files
|
||||
|
||||
v0.3.2
|
||||
------
|
||||
## v0.3.2
|
||||
### Bug
|
||||
- **[COOK-3191](https://tickets.opscode.com/browse/COOK-3191)** - Propogate unzip failures
|
||||
- **[COOK-3118](https://tickets.opscode.com/browse/COOK-3118)** - Set cookbook attribute in provider
|
||||
@ -67,54 +84,41 @@ v0.3.2
|
||||
### Improvement
|
||||
- **[COOK-3179](https://tickets.opscode.com/browse/COOK-3179)** - README updates and refactor
|
||||
|
||||
v0.3.0
|
||||
------
|
||||
## v0.3.0
|
||||
### Improvement
|
||||
|
||||
- [COOK-3087]: Can't use ark with chef < 11
|
||||
|
||||
### Bug
|
||||
|
||||
- [COOK-3064]: `only_if` statements in ark's `install_with_make` and configure actions are not testing for file existence correctly.
|
||||
- [COOK-3067]: ark kitchen test for `cherry_pick` is expecting the binary to be in the same parent folder as in the archive.
|
||||
|
||||
v0.2.4
|
||||
------
|
||||
## v0.2.4
|
||||
### Bug
|
||||
|
||||
- [COOK-3048]: Ark provider contains a `ruby_block` resource without a block attribute
|
||||
- [COOK-3063]: Ark cookbook `cherry_pick` action's unzip command does not close if statement
|
||||
- [COOK-3065]: Ark install action does not symlink binaries correctly
|
||||
|
||||
v0.2.2
|
||||
------
|
||||
## v0.2.2
|
||||
- Update the README to reflect the requirement for Chef 11 to use the ark resource (`use_inline_resources`).
|
||||
- Making this a release so it will also appear on the community site page.
|
||||
|
||||
v0.2.0
|
||||
------
|
||||
## v0.2.0
|
||||
### Bug
|
||||
|
||||
- [COOK-2772]: Ark cookbook has foodcritic failures in provides/default.rb
|
||||
|
||||
### Improvement
|
||||
|
||||
- [COOK-2520]: Refactor ark providers to use the '`use_inline_resources`' LWRP DSL feature
|
||||
|
||||
v0.1.0
|
||||
------
|
||||
## v0.1.0
|
||||
- [COOK-2335] - ark resource broken on Chef 11
|
||||
|
||||
v0.0.1
|
||||
------
|
||||
## v0.0.1
|
||||
- [COOK-2026] - Allow `cherry_pick` action to be used for directories as well as files
|
||||
|
||||
v0.0.1
|
||||
------
|
||||
## v0.0.1
|
||||
- [COOK-1593] - README formatting updates for better display on Community Site
|
||||
|
||||
v0.0.1
|
||||
------
|
||||
## v0.0.1
|
||||
### Bug
|
||||
- dangling "unless"
|
||||
|
||||
@ -124,12 +128,11 @@ v0.0.1
|
||||
- add foodcritic test
|
||||
- travis.ci support
|
||||
|
||||
v0.0.10 (May 23, 2012
|
||||
------
|
||||
## v0.0.10 (May 23, 2012
|
||||
### Bug
|
||||
- `strip_leading_dir` not working for zip files https://github.com/bryanwb/chef-ark/issues/19
|
||||
- `strip_leading_dir` not working for zip files [https://github.com/bryanwb/chef-ark/issues/19](https://github.com/bryanwb/chef-ark/issues/19)
|
||||
|
||||
### Improvement
|
||||
- use autogen.sh to generate configure script for configure action https://github.com/bryanwb/chef-ark/issues/16
|
||||
- support more file extensions https://github.com/bryanwb/chef-ark/pull/18
|
||||
- use autogen.sh to generate configure script for configure action [https://github.com/bryanwb/chef-ark/issues/16](https://github.com/bryanwb/chef-ark/issues/16)
|
||||
- support more file extensions [https://github.com/bryanwb/chef-ark/pull/18](https://github.com/bryanwb/chef-ark/pull/18)
|
||||
- add extension attribute which allows you to download files which do not have the file extension as part of the URL
|
||||
|
@ -1,297 +1,245 @@
|
||||
# <a name="title"></a> chef-ark [](https://travis-ci.org/opscode-cookbooks/ark)
|
||||
# ark cookbook
|
||||
[](https://travis-ci.org/burtlo/ark) [](https://supermarket.chef.io/cookbooks/ark)
|
||||
|
||||
Overview
|
||||
========
|
||||
## Overview
|
||||
This cookbook provides `ark`, a resource for managing software archives. It manages the fetch-unpack-configure-build-install process common to installing software from source, or from binary distributions that are not fully fledged OS packages.
|
||||
|
||||
This cookbook provides `ark`, a resource for managing software
|
||||
archives. It manages the fetch-unpack-configure-build-install process
|
||||
common to installing software from source, or from binary
|
||||
distributions that are not fully fledged OS packages.
|
||||
|
||||
This is a modified verion of Infochimp's awesome
|
||||
[install_from cookbook](http://github.com/infochimps-cookbooks/install_from).
|
||||
It has been heavily refactored and extended to meet different use
|
||||
cases.
|
||||
This cookbook started its life as a modified version of Infochimp's install_from cookbook. It has since been heavily refactored and extended to meet different use cases.
|
||||
|
||||
Given a simple project archive available at a url:
|
||||
|
||||
ark 'pig' do
|
||||
url 'http://apache.org/pig/pig-0.8.0.tar.gz'
|
||||
end
|
||||
```ruby
|
||||
ark 'pig' do
|
||||
url 'http://apache.org/pig/pig-0.8.0.tar.gz'
|
||||
end
|
||||
```
|
||||
|
||||
The provider will:
|
||||
- fetch it to to `/var/cache/chef/`
|
||||
- unpack it to the default path (`/usr/local/pig-0.8.0`)
|
||||
- create a symlink for `:home_dir` (`/usr/local/pig`) pointing to path
|
||||
- add specified binary commands to the environment `PATH` variable
|
||||
|
||||
* fetch it to to `/var/cache/chef/`
|
||||
* unpack it to the default path (`/usr/local/pig-0.8.0`)
|
||||
* create a symlink for `:home_dir` (`/usr/local/pig`) pointing to path
|
||||
* add specified binary commands to the enviroment `PATH` variable
|
||||
By default, the ark will not run again if the `:path` is not empty. Ark provides many actions to accommodate different use cases, such as `:dump`, `:cherry_pick`, `:put`, and `:install_with_make`.
|
||||
|
||||
By default, the ark will not run again if the `:path` is not empty.
|
||||
Ark provides many actions to accommodate different use cases, such as
|
||||
`:dump`, `:cherry_pick`, `:put`, and `:install_with_make`.
|
||||
At this time ark only handles files available from URLs using the [remote_file](http://docs.chef.io/resource_remote_file.html) provider. It does handle local files using the `file://` protocol.
|
||||
|
||||
At this time ark only handles files available from URLs. It does not
|
||||
handle local files.
|
||||
## Requirements
|
||||
### Platforms
|
||||
- Debian/Ubuntu
|
||||
- RHEL/CentOS/Scientific/Oracle
|
||||
- Fedora
|
||||
- FreeBSD
|
||||
- SmartOS
|
||||
- Mac OS X
|
||||
|
||||
Requirements
|
||||
============
|
||||
Should work on common Unix/Linux systems with typical userland utilities like tar, gzip, etc. May require the installation of build tools for compiling from source, but that installation is outside the scope of this cookbook.
|
||||
|
||||
This cookbook requires Chef 11 for the provider, as it uses the
|
||||
`use_inline_resources` method.
|
||||
### Chef
|
||||
- Chef 11+
|
||||
|
||||
More about
|
||||
[use_inline_resources](http://docs.opscode.com/lwrp_common_inline_compile.html)
|
||||
in the Chef documentation.
|
||||
### Cookbooks
|
||||
- build-essential
|
||||
- seven_zip
|
||||
- windows
|
||||
|
||||
Should work on common Unix/Linux systems with typical userland
|
||||
utilities like tar, gzip, etc. May require the installation of build
|
||||
tools for compiling from source, but that installation is outside the
|
||||
scope of this cookbook.
|
||||
## Attributes
|
||||
Customize the attributes to suit site specific conventions and defaults.
|
||||
- `node['ark']['apache_mirror']` - if the URL is an apache mirror, use the attribute as the default.
|
||||
- `node['ark']['prefix_root']` - default base location if the `prefix_root` is not passed into the resource.
|
||||
- `node['ark']['prefix_bin']` - default binary location if the `prefix_bin` is not passed into the resource.
|
||||
- `node['ark']['prefix_home']` - default home location if the `prefix_home` is not passed into the resource.
|
||||
- `node['ark']['win_install_dir']` - directory where the files will be put on windows
|
||||
- `node['ark']['package_dependencies']` - prerequisite system packages that need to be installed to support ark.
|
||||
|
||||
Attributes
|
||||
==========
|
||||
## Resources
|
||||
- `ark` - does the extract/build/configure dance
|
||||
|
||||
Customize the attributes to suit site specific conventions and
|
||||
defaults.
|
||||
|
||||
* `node['ark']['apache_mirror']` - if the URL is an apache mirror,
|
||||
use the attribute as the default.
|
||||
* `node['ark']['prefix_root']` - default base location if the
|
||||
`prefix_root` is not passed into the resource.
|
||||
* `node['ark']['prefix_bin']` - default binary location if the
|
||||
`prefix_bin` is not passed into the resource.
|
||||
* `node['ark']['prefix_home']` - default home location if the
|
||||
`prefix_home` is not passed into the resource.
|
||||
* `node['ark']['win_install_dir']` - directory where the files will
|
||||
be put on windows
|
||||
* `node['ark']['package_dependencies']` - prerequisite system
|
||||
packages that need to be installed to support ark.
|
||||
|
||||
Resources/Providers
|
||||
===================
|
||||
|
||||
* `ark` - does the extract/build/configure dance
|
||||
|
||||
Actions
|
||||
-------
|
||||
|
||||
- `:install`: extracts the file and creates a 'friendly' symbolic link
|
||||
to the extracted directory path
|
||||
### Actions
|
||||
- `:install`: extracts the file and creates a 'friendly' symbolic link to the extracted directory path
|
||||
- `:configure`: configure ahead of the install action
|
||||
- `:install_with_make`: extracts the archive to a path, runs `make`,
|
||||
and `make install`. It does _not_ run the configure step at this
|
||||
time
|
||||
- `:dump`: strips all directories from the archive and dumps the
|
||||
contained files into a specified path
|
||||
- `:cherry_pick`: extract a specified file from an archive and places
|
||||
in specified path
|
||||
- `:put`: extract the archive to a specified path, does not create any
|
||||
symbolic links
|
||||
- `:install_with_make`: extracts the archive to a path, runs `make`, and `make install`. It does _not_ run the configure step at this time
|
||||
- `:dump`: strips all directories from the archive and dumps the contained files into a specified path
|
||||
- `:cherry_pick`: extract a specified file from an archive and places in specified path
|
||||
- `:put`: extract the archive to a specified path, does not create any symbolic links
|
||||
- `:remove`: removes the extracted directory and related symlink #TODO
|
||||
- `:setup_py_build`: runs the command "python setup.py build" in the
|
||||
extracted directory
|
||||
- `:setup_py_install`: runs the comand "python setup.py install" in
|
||||
the extracted directory
|
||||
|
||||
## :cherry_pick
|
||||
- `:setup_py`: runs the command "python setup.py" in the extracted directory
|
||||
- `:setup_py_build`: runs the command "python setup.py build" in the extracted directory
|
||||
- `:setup_py_install`: runs the command "python setup.py install" in the extracted directory
|
||||
|
||||
### :cherry_pick
|
||||
Extract a specified file from an archive and places in specified path.
|
||||
|
||||
### Relevant Attribute Parameters for :cherry_pick
|
||||
|
||||
#### Relevant Attribute Parameters for :cherry_pick
|
||||
- `path`: directory to place file in.
|
||||
- `creates`: specific file to cherry-pick.
|
||||
|
||||
## :dump
|
||||
|
||||
Strips all directories from the archive and dumps the contained files
|
||||
into a specified path.
|
||||
### :dump
|
||||
Strips all directories from the archive and dumps the contained files into a specified path.
|
||||
|
||||
NOTE: This currently only works for zip archives
|
||||
|
||||
### Attribute Parameters for :dump
|
||||
|
||||
#### Attribute Parameters for :dump
|
||||
- `path`: path to dump files to.
|
||||
- `mode`: file mode for `app_home`, as an integer.
|
||||
- Example: `0775`
|
||||
- `creates`: if you are appending files to a given directory, ark
|
||||
needs a condition to test whether the file has already been
|
||||
extracted. You can specify with creates, a file whose existence
|
||||
indicates the ark has previously been extracted and does not need to
|
||||
be extracted again.
|
||||
|
||||
## :put
|
||||
- `creates`: if you are appending files to a given directory, ark needs a condition to test whether the file has already been extracted. You can specify with creates, a file whose existence indicates the ark has previously been extracted and does not need to be extracted again.
|
||||
|
||||
Extract the archive to a specified path, does not create any symbolic
|
||||
links.
|
||||
|
||||
### Attribute Parameters for :put
|
||||
### :put
|
||||
Extract the archive to a specified path, does not create any symbolic links.
|
||||
|
||||
#### Attribute Parameters for :put
|
||||
- `path`: path to extract to.
|
||||
- Default: `/usr/local`
|
||||
- `has_binaries`: array of binary commands to symlink into
|
||||
`/usr/local/bin/`, you must specify the relative path.
|
||||
- Example: `[ 'bin/java', 'bin/javaws' ]`
|
||||
- `append_env_path`: boolean, if true, append the `./bin` directory of
|
||||
the extracted directory to the global `PATH` variable for all users.
|
||||
|
||||
Attribute Parameters
|
||||
--------------------
|
||||
- `append_env_path`: boolean, if true, append the `./bin` directory of the extracted directory to the global `PATH` variable for all users.
|
||||
|
||||
### Attribute Parameters
|
||||
- `name`: name of the package, defaults to the resource name.
|
||||
- `url`: url for tarball, `.tar.gz`, `.bin` (oracle-specific), `.war`,
|
||||
and `.zip` currently supported. Also supports special syntax
|
||||
`:name:version:apache_mirror:` that will auto-magically construct
|
||||
download url from the apache mirrors site.
|
||||
- `url`: url for tarball, `.tar.gz`, `.bin` (oracle-specific), `.war`, and `.zip` currently supported. Also supports special syntax
|
||||
- `:name:version:apache_mirror:` that will auto-magically construct download url from the apache mirrors site.
|
||||
- `version`: software version, defaults to `1`.
|
||||
- `checksum`: sha256 checksum, used for security .
|
||||
- `mode`: file mode for `app_home`, is an integer.
|
||||
- `prefix_root`: default `prefix_root`, for use with `:install*`
|
||||
actions.
|
||||
- `prefix_home`: default directory prefix for a friendly symlink to
|
||||
the path.
|
||||
- `prefix_root`: default `prefix_root`, for use with `:install*` actions.
|
||||
- `prefix_home`: default directory prefix for a friendly symlink to the path.
|
||||
- Example: `/usr/local/maven` -> `/usr/local/maven-2.2.1`
|
||||
- `prefix_bin`: default directory to place a symlink to a binary
|
||||
command.
|
||||
- Example: `/opt/bin/mvn` -> `/opt/maven-2.2.1/bin/mvn`, where the
|
||||
`prefix_bin` is `/opt/bin`
|
||||
- `path`: path to extract the ark to. The `:install*` actions
|
||||
overwrite any user-provided values for `:path`.
|
||||
- Default: `/usr/local/<name>-<version>` for the `:install`,
|
||||
`:install_with_make` actions
|
||||
- `home_dir`: symbolic link to the path `:prefix_root/:name-:version`,
|
||||
does not apply to `:dump`, `:put`, or `:cherry_pick` actions.
|
||||
|
||||
- `prefix_bin`: default directory to place a symlink to a binary command.
|
||||
- Example: `/opt/bin/mvn` -> `/opt/maven-2.2.1/bin/mvn`, where the `prefix_bin` is `/opt/bin`
|
||||
|
||||
- `path`: path to extract the ark to. The `:install*` actions overwrite any user-provided values for `:path`.
|
||||
- Default: `/usr/local/<name>-<version>` for the `:install`, `:install_with_make` actions
|
||||
|
||||
- `home_dir`: symbolic link to the path `:prefix_root/:name-:version`, does not apply to `:dump`, `:put`, or `:cherry_pick` actions.
|
||||
- Default: `:prefix_root/:name`
|
||||
- `has_binaries`: array of binary commands to symlink into
|
||||
`/usr/local/bin/`, you must specify the relative path.
|
||||
|
||||
- `has_binaries`: array of binary commands to symlink into `/usr/local/bin/`, you must specify the relative path.
|
||||
- Example: `[ 'bin/java', 'bin/javaws' ]`
|
||||
- `append_env_path`: boolean, similar to `has_binaries` but less
|
||||
granular. If true, append the `./bin` directory of the extracted
|
||||
directory to. the `PATH` environment variable for all users, by
|
||||
placing a file in `/etc/profile.d/`. The commands are symbolically
|
||||
linked into `/usr/bin/*`. This option provides more granularity than
|
||||
the boolean option.
|
||||
|
||||
- `append_env_path`: boolean, similar to `has_binaries` but less granular. If true, append the `./bin` directory of the extracted directory to. the `PATH` environment variable for all users, by placing a file in `/etc/profile.d/`. The commands are symbolically linked into `/usr/bin/*`. This option provides more granularity than the boolean option.
|
||||
- Example: `mvn`, `java`, `javac`, etc.
|
||||
- `environment`: hash of environment variables to pass to invoked
|
||||
shell commands like `tar`, `unzip`, `configure`, and `make`.
|
||||
- `strip_components`: number of components in path to strip when extracting archive.
|
||||
With default value of `1`, ark strips the leading directory from an archive,
|
||||
which is the default for both `unzip` and `tar` commands.
|
||||
- `autoconf_opts`: an array of command line options for use with the
|
||||
GNU `autoconf` script.
|
||||
|
||||
- `environment`: hash of environment variables to pass to invoked shell commands like `tar`, `unzip`, `configure`, and `make`.
|
||||
- `strip_components`: number of components in path to strip when extracting archive. With default value of `1`, ark strips the leading directory from an archive, which is the default for both `unzip` and `tar` commands.
|
||||
- `autoconf_opts`: an array of command line options for use with the GNU `autoconf` script.
|
||||
- Example: `[ '--include=/opt/local/include', '--force' ]`
|
||||
|
||||
- `make_opts`: an array of command line options for use with `make`.
|
||||
- Example: `[ '--warn-undefined-variables', '--load-average=2' ]`
|
||||
|
||||
- `owner`: owner of extracted directory.
|
||||
- Default: `root`
|
||||
|
||||
### Examples
|
||||
#### Examples
|
||||
This example copies `ivy.tar.gz` to `/var/cache/chef/ivy-2.2.0.tar.gz`, unpacks its contents to `/usr/local/ivy-2.2.0/` -- stripping the leading directory, and symlinks `/usr/local/ivy` to `/usr/local/ivy-2.2.0`
|
||||
|
||||
This example copies `ivy.tar.gz` to
|
||||
`/var/cache/chef/ivy-2.2.0.tar.gz`, unpacks its contents to
|
||||
`/usr/local/ivy-2.2.0/` -- stripping the leading directory, and
|
||||
symlinks `/usr/local/ivy` to `/usr/local/ivy-2.2.0`
|
||||
```ruby
|
||||
# install Apache Ivy dependency resolution tool
|
||||
ark "ivy" do
|
||||
url 'http://someurl.example.com/ivy.tar.gz'
|
||||
version '2.2.0'
|
||||
checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
|
||||
action :install
|
||||
end
|
||||
```
|
||||
|
||||
# install Apache Ivy dependency resolution tool
|
||||
ark "ivy" do
|
||||
url 'http://someurl.example.com/ivy.tar.gz'
|
||||
version '2.2.0'
|
||||
checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
|
||||
action :install
|
||||
end
|
||||
This example copies `jdk-7u2-linux-x64.tar.gz` to `/var/cache/chef/jdk-7.2.tar.gz`, unpacks its contents to `/usr/local/jvm/jdk-7.2/` -- stripping the leading directory, symlinks `/usr/local/jvm/default` to `/usr/local/jvm/jdk-7.2`, and adds `/usr/local/jvm/jdk-7.2/bin/` to the global `PATH` for all users. The user 'foobar' is the owner of the `/usr/local/jvm/jdk-7.2` directory:
|
||||
|
||||
This example copies `jdk-7u2-linux-x64.tar.gz` to
|
||||
`/var/cache/chef/jdk-7.2.tar.gz`, unpacks its contents to
|
||||
`/usr/local/jvm/jdk-7.2/` -- stripping the leading directory, symlinks
|
||||
`/usr/local/jvm/default` to `/usr/local/jvm/jdk-7.2`, and adds
|
||||
`/usr/local/jvm/jdk-7.2/bin/` to the global `PATH` for all users. The
|
||||
user 'foobar' is the owner of the `/usr/local/jvm/jdk-7.2` directory:
|
||||
```ruby
|
||||
ark 'jdk' do
|
||||
url 'http://download.example.com/jdk-7u2-linux-x64.tar.gz'
|
||||
version '7.2'
|
||||
path "/usr/local/jvm/"
|
||||
home_dir "/usr/local/jvm/default"
|
||||
checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
|
||||
append_env_path true
|
||||
owner 'foobar'
|
||||
end
|
||||
```
|
||||
|
||||
ark 'jdk' do
|
||||
url 'http://download.example.com/jdk-7u2-linux-x64.tar.gz'
|
||||
version '7.2'
|
||||
path "/usr/local/jvm/"
|
||||
home_dir "/usr/local/jvm/default"
|
||||
checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
|
||||
append_env_path true
|
||||
owner 'foobar'
|
||||
end
|
||||
Install Apache Ivy dependency resolution tool in <path>/resource_name in this case `/usr/local/ivy`, do not symlink, and strip any leading directory if one exists in the tarball:
|
||||
|
||||
Install Apache Ivy dependency resolution tool in <path>/resource_name in this case
|
||||
`/usr/local/ivy`, do not symlink, and strip any leading directory if one
|
||||
exists in the tarball:
|
||||
```ruby
|
||||
ark "ivy" do
|
||||
url 'http://someurl.example.com/ivy.tar.gz'
|
||||
checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
|
||||
action :put
|
||||
end
|
||||
```
|
||||
|
||||
ark "ivy" do
|
||||
url 'http://someurl.example.com/ivy.tar.gz'
|
||||
checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
|
||||
action :put
|
||||
end
|
||||
Install Apache Ivy dependency resolution tool in /home/foobar/ivy, strip any leading directory if one exists:
|
||||
|
||||
Install Apache Ivy dependency resolution tool in /home/foobar/ivy, strip any
|
||||
leading directory if one exists:
|
||||
```ruby
|
||||
ark "ivy" do
|
||||
path "/home/foobar"
|
||||
url 'http://someurl.example.com/ivy.tar.gz'
|
||||
checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
|
||||
action :put
|
||||
end
|
||||
```
|
||||
|
||||
ark "ivy" do
|
||||
path "/home/foobar
|
||||
url 'http://someurl.example.com/ivy.tar.gz'
|
||||
checksum '89ba5fde0c596db388c3bbd265b63007a9cc3df3a8e6d79a46780c1a39408cb5'
|
||||
action :put
|
||||
end
|
||||
Strip all directories and dump files into path specified by the path attribute. You must specify the `creates` attribute in order to keep the extraction from running every time. The directory path will be created if it doesn't already exist:
|
||||
|
||||
Strip all directories and dump files into path specified by the path attribute.
|
||||
You must specify the `creates` attribute in order to keep the extraction from
|
||||
running every time. The directory path will be created if it doesn't already exist:
|
||||
|
||||
ark "my_jars" do
|
||||
url "http://example.com/bunch_of_jars.zip"
|
||||
path "/usr/local/tomcat/lib"
|
||||
creates "mysql.jar"
|
||||
owner "tomcat"
|
||||
action :dump
|
||||
end
|
||||
```ruby
|
||||
ark "my_jars" do
|
||||
url "http://example.com/bunch_of_jars.zip"
|
||||
path "/usr/local/tomcat/lib"
|
||||
creates "mysql.jar"
|
||||
owner "tomcat"
|
||||
action :dump
|
||||
end
|
||||
```
|
||||
|
||||
Extract specific files from a tarball (currently only handles one named file):
|
||||
|
||||
ark 'mysql-connector-java' do
|
||||
url 'http://oracle.com/mysql-connector.zip'
|
||||
creates 'mysql-connector-java-5.0.8-bin.jar'
|
||||
path '/usr/local/tomcat/lib'
|
||||
action :cherry_pick
|
||||
end
|
||||
```ruby
|
||||
ark 'mysql-connector-java' do
|
||||
url 'http://oracle.com/mysql-connector.zip'
|
||||
creates 'mysql-connector-java-5.0.8-bin.jar'
|
||||
path '/usr/local/tomcat/lib'
|
||||
action :cherry_pick
|
||||
end
|
||||
```
|
||||
|
||||
Build and install haproxy and use alternave values for `prefix_root`, `prefix_home`, and `prefix_bin`:
|
||||
Build and install haproxy and use alternative values for `prefix_root`, `prefix_home`, and `prefix_bin`:
|
||||
|
||||
ark "haproxy" do
|
||||
url "http://haproxy.1wt.eu/download/1.5/src/snapshot/haproxy-ss-20120403.tar.gz"
|
||||
version "1.5"
|
||||
checksum 'ba0424bf7d23b3a607ee24bbb855bb0ea347d7ffde0bec0cb12a89623cbaf911'
|
||||
make_opts [ 'TARGET=linux26' ]
|
||||
prefix_root '/opt'
|
||||
prefix_home '/opt'
|
||||
prefix_bin '/opt/bin'
|
||||
action :install_with_make
|
||||
end
|
||||
```ruby
|
||||
ark "haproxy" do
|
||||
url "http://haproxy.1wt.eu/download/1.5/src/snapshot/haproxy-ss-20120403.tar.gz"
|
||||
version "1.5"
|
||||
checksum 'ba0424bf7d23b3a607ee24bbb855bb0ea347d7ffde0bec0cb12a89623cbaf911'
|
||||
make_opts [ 'TARGET=linux26' ]
|
||||
prefix_root '/opt'
|
||||
prefix_home '/opt'
|
||||
prefix_bin '/opt/bin'
|
||||
action :install_with_make
|
||||
end
|
||||
```
|
||||
|
||||
You can also pass multiple actions to ark and supply the file extension in case
|
||||
the file extension can not be determined by the URL:
|
||||
You can also pass multiple actions to ark and supply the file extension in case the file extension can not be determined by the URL:
|
||||
|
||||
ark "test_autogen" do
|
||||
url 'https://github.com/zeromq/libzmq/tarball/master'
|
||||
extension "tar.gz"
|
||||
action [ :configure, :install_with_make ]
|
||||
end
|
||||
```ruby
|
||||
ark "test_autogen" do
|
||||
url 'https://github.com/zeromq/libzmq/tarball/master'
|
||||
extension "tar.gz"
|
||||
action [ :configure, :install_with_make ]
|
||||
end
|
||||
```
|
||||
|
||||
License and Author
|
||||
==================
|
||||
|
||||
- Author: Philip (flip) Kromer - Infochimps, Inc(<coders@infochimps.com>)
|
||||
- Author: Bryan W. Berry (<bryan.berry@gmail.com>)
|
||||
- Author: Denis Barishev (<denis.barishev@gmail.com>)
|
||||
- Author: Sean OMeara (<someara@opscode.com>)
|
||||
## License and Authors
|
||||
- Author: Philip (flip) Kromer - Infochimps, Inc([coders@infochimps.com](mailto:coders@infochimps.com))
|
||||
- Author: Bryan W. Berry ([bryan.berry@gmail.com](mailto:bryan.berry@gmail.com))
|
||||
- Author: Denis Barishev ([denis.barishev@gmail.com](mailto:denis.barishev@gmail.com))
|
||||
- Author: Sean OMeara ([someara@chef.io](mailto:someara@chef.io))
|
||||
- Author: John Bellone ([jbellone@bloomberg.net](mailto:jbellone@bloomberg.net))
|
||||
- Copyright: 2011, Philip (flip) Kromer - Infochimps, Inc
|
||||
- Copyright: 2012, Bryan W. Berry
|
||||
- Copyright: 2012, Denis Barishev
|
||||
- Copyright: 2013, Opscode, Inc
|
||||
- Copyright: 2013, Chef Software, Inc
|
||||
- Copyright: 2014, Bloomberg L.P.
|
||||
|
||||
```
|
||||
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
|
||||
@ -303,3 +251,4 @@ 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.
|
||||
```
|
||||
|
@ -1,16 +1,43 @@
|
||||
#
|
||||
# Cookbook Name:: ark
|
||||
# Attributes:: default
|
||||
#
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
default['ark']['apache_mirror'] = 'http://apache.mirrors.tds.net'
|
||||
default['ark']['prefix_root'] = '/usr/local'
|
||||
default['ark']['prefix_bin'] = '/usr/local/bin'
|
||||
default['ark']['prefix_home'] = '/usr/local'
|
||||
if node['platform_family'] === 'windows'
|
||||
default['ark']['tar'] = "\"#{default['7-zip']['home']}\\7z.exe\""
|
||||
else
|
||||
default['ark']['tar'] = '/bin/tar'
|
||||
end
|
||||
default['ark']['tar'] = case node['platform_family']
|
||||
when 'windows'
|
||||
"\"#{ENV['SYSTEMDRIVE']}\\7-zip\\7z.exe\""
|
||||
when 'mac_os_x', 'freebsd'
|
||||
'/usr/bin/tar'
|
||||
when 'smartos'
|
||||
'/bin/gtar'
|
||||
else
|
||||
'/bin/tar'
|
||||
end
|
||||
|
||||
pkgs = %w(libtool autoconf) unless platform_family?('mac_os_x','windows')
|
||||
pkgs += %w(unzip rsync make gcc) unless platform_family?('mac_os_x','windows')
|
||||
pkgs += %w(autogen) unless platform_family?('rhel', 'fedora', 'mac_os_x', 'suse','windows')
|
||||
pkgs += %w(gtar) if platform?('freebsd')
|
||||
pkgs = %w(libtool autoconf) unless platform_family?('mac_os_x', 'windows')
|
||||
pkgs += %w(make) unless platform_family?('mac_os_x', 'windows', 'freebsd')
|
||||
pkgs += %w(unzip rsync gcc) unless platform_family?('mac_os_x', 'windows')
|
||||
pkgs += %w(autogen) unless platform_family?('rhel', 'fedora', 'mac_os_x', 'suse', 'windows')
|
||||
pkgs += %w(gtar) if platform?('freebsd') || platform?('smartos')
|
||||
pkgs += %w(gmake) if platform?('freebsd')
|
||||
pkgs += %w(xz-lzma-compat bzip2 tar) if platform_family?('rhel', 'fedora')
|
||||
pkgs += %w(shtool pkg-config) if platform_family?('debian')
|
||||
|
||||
default['ark']['package_dependencies'] = pkgs
|
||||
|
@ -1,102 +0,0 @@
|
||||
require 'minitest/spec'
|
||||
|
||||
describe_recipe 'ark::test' do
|
||||
|
||||
# It's often convenient to load these includes in a separate
|
||||
# helper along with
|
||||
# your own helper methods, but here we just include them directly:
|
||||
include MiniTest::Chef::Assertions
|
||||
include MiniTest::Chef::Context
|
||||
include MiniTest::Chef::Resources
|
||||
|
||||
it 'installed the unzip package' do
|
||||
package('unzip').must_be_installed
|
||||
end
|
||||
|
||||
if RUBY_PLATFORM =~ /freebsd/
|
||||
it 'installs the gnu tar package on freebsc' do
|
||||
package('gtar').must_be_installed
|
||||
end
|
||||
end
|
||||
|
||||
it 'puts an ark in the desired directory w/out symlinks' do
|
||||
directory('/usr/local/test_put').must_exist
|
||||
end
|
||||
|
||||
it 'dumps the correct files into place with correct owner and group' do
|
||||
file('/usr/local/foo_dump/foo1.txt').must_have(:owner, 'foobarbaz').and(:group, 'foobarbaz')
|
||||
end
|
||||
|
||||
it 'cherrypicks the mysql connector and set the correct owner and group' do
|
||||
file('/usr/local/foo_cherry_pick/foo1.txt').must_have(:owner, 'foobarbaz').and(:group, 'foobarbaz')
|
||||
end
|
||||
|
||||
it 'cherrypicks the file from a zip' do
|
||||
file('/usr/local/foo_cherry_pick_from_zip/foo1.txt').must_exist
|
||||
end
|
||||
|
||||
it 'creates directory and symlink properly for the full ark install' do
|
||||
directory('/usr/local/foo-2').must_have(:owner, 'foobarbaz').and(:group, 'foobarbaz')
|
||||
link('/usr/local/foo').must_exist.with(:link_type, :symbolic).and(:to, '/usr/local/foo-2')
|
||||
end
|
||||
|
||||
it 'symlinks multiple binary commands' do
|
||||
link('/usr/local/bin/do_foo').must_exist.with(:link_type, :symbolic).and(:to, '/usr/local/foo-2/bin/do_foo')
|
||||
link('/usr/local/bin/do_more_foo').must_exist.with(:link_type, :symbolic).and(:to, '/usr/local/foo-2/bin/do_more_foo')
|
||||
end
|
||||
|
||||
it 'appends to the environment PATH' do
|
||||
unless RUBY_PLATFORM =~ /freebsd/
|
||||
file('/etc/profile.d/foo_append_env.sh').must_include '/usr/local/foo_append_env-7.0.26/bin'
|
||||
|
||||
bin_path_present = !ENV['PATH'].scan('/usr/local/foo_append_env-7.0.26/bin').empty?
|
||||
assert bin_path_present
|
||||
end
|
||||
end
|
||||
|
||||
it 'doesnt strip top-level directory if specified' do
|
||||
directory('/usr/local/foo_dont_strip/foo_sub').must_exist
|
||||
end
|
||||
|
||||
it 'does strip for zip file' do
|
||||
file('/usr/local/foo_zip_strip/foo1.txt').must_exist
|
||||
end
|
||||
|
||||
it 'successfully compiles haproxy' do
|
||||
file('/usr/local/haproxy-1.5/haproxy').must_exist
|
||||
end
|
||||
|
||||
unless RUBY_PLATFORM =~ /freebsd/
|
||||
it 'installs haproxy binary' do
|
||||
file('/usr/local/sbin/haproxy').must_exist
|
||||
directory('/usr/local/doc/haproxy').must_exist
|
||||
end
|
||||
end
|
||||
|
||||
it 'creates an alternate prefix_bin' do
|
||||
link('/opt/bin/do_foo').must_exist.with(:link_type, :symbolic).and(:to, '/opt/foo_alt_bin-3/bin/do_foo')
|
||||
end
|
||||
|
||||
it 'properly unpacks .tbz and .tgz archives' do
|
||||
file('/usr/local/foo_tbz/foo1.txt').must_exist
|
||||
file('/usr/local/foo_tgz/foo1.txt').must_exist
|
||||
end
|
||||
|
||||
it 'sends notification when resource updated' do
|
||||
file('/tmp/foobarbaz/notification_successful.txt').must_exist
|
||||
end
|
||||
|
||||
it 'uses autogen.sh to generate configure script' do
|
||||
file('/usr/local/test_autogen-1/configure').must_exist
|
||||
end
|
||||
|
||||
it 'strips 2 components out of foo_sub.tar.gz archive path' do
|
||||
directory('/usr/local/foo_sub-1/bin').must_exist
|
||||
file('/usr/local/foo_sub-1/foo1.txt').must_exist
|
||||
end
|
||||
|
||||
it 'strips 2 components out of foo_sub.zip archive path' do
|
||||
directory('/usr/local/foo_sub-2/bin').must_exist
|
||||
file('/usr/local/foo_sub-2/foo1.txt').must_exist
|
||||
end
|
||||
end
|
@ -1,234 +1,113 @@
|
||||
# libs
|
||||
require_relative 'platform_specific_builders'
|
||||
require_relative 'resource_deprecations'
|
||||
require_relative 'resource_defaults'
|
||||
require_relative 'sevenzip_command_builder'
|
||||
require_relative 'unzip_command_builder'
|
||||
require_relative 'tar_command_builder'
|
||||
require_relative 'general_owner'
|
||||
require_relative 'windows_owner'
|
||||
|
||||
module Opscode
|
||||
module Ark
|
||||
module ProviderHelpers
|
||||
private
|
||||
module Ark
|
||||
module ProviderHelpers
|
||||
extend ::Ark::PlatformSpecificBuilders
|
||||
|
||||
def unpack_type
|
||||
case parse_file_extension
|
||||
when /tar.gz|tgz/ then "tar_xzf"
|
||||
when /tar.bz2|tbz/ then "tar_xjf"
|
||||
when /tar.xz|txz/ then "tar_xJf"
|
||||
when /zip|war|jar/ then "unzip"
|
||||
else fail "Don't know how to expand #{new_resource.url}"
|
||||
end
|
||||
end
|
||||
generates_archive_commands_for :seven_zip,
|
||||
when_the: -> { node['platform_family'] == 'windows' },
|
||||
with_klass: ::Ark::SevenZipCommandBuilder
|
||||
|
||||
def parse_file_extension
|
||||
if new_resource.extension.nil?
|
||||
# purge any trailing redirect
|
||||
url = new_resource.url.clone
|
||||
url =~ %r{^https?:\/\/.*(.bin|bz2|gz|jar|tbz|tgz|txz|war|xz|zip)(\/.*\/)}
|
||||
url.gsub!(Regexp.last_match(2), '') unless Regexp.last_match(2).nil?
|
||||
# remove tailing query string
|
||||
release_basename = ::File.basename(url.gsub(/\?.*\z/, '')).gsub(/-bin\b/, '')
|
||||
# (\?.*)? accounts for a trailing querystring
|
||||
Chef::Log.debug("DEBUG: release_basename is #{release_basename}")
|
||||
release_basename =~ /^(.+?)\.(jar|tar\.bz2|tar\.gz|tar\.xz|tbz|tgz|txz|war|zip)(\?.*)?/
|
||||
Chef::Log.debug("DEBUG: file_extension is #{Regexp.last_match(2)}")
|
||||
new_resource.extension = Regexp.last_match(2)
|
||||
end
|
||||
new_resource.extension
|
||||
end
|
||||
generates_archive_commands_for :unzip,
|
||||
when_the: -> { new_resource.extension =~ /zip|war|jar/ },
|
||||
with_klass: ::Ark::UnzipCommandBuilder
|
||||
|
||||
def unpack_command
|
||||
if node['platform_family'] === 'windows'
|
||||
cmd = sevenzip_command
|
||||
else
|
||||
case unpack_type
|
||||
when "tar_xzf"
|
||||
cmd = tar_command("xzf")
|
||||
when "tar_xjf"
|
||||
cmd = tar_command("xjf")
|
||||
when "tar_xJf"
|
||||
cmd = tar_command("xJf")
|
||||
when "unzip"
|
||||
cmd = unzip_command
|
||||
end
|
||||
end
|
||||
Chef::Log.debug("DEBUG: cmd: #{cmd}")
|
||||
cmd
|
||||
end
|
||||
generates_archive_commands_for :tar,
|
||||
when_the: -> { true },
|
||||
with_klass: ::Ark::TarCommandBuilder
|
||||
|
||||
def tar_command(tar_args)
|
||||
cmd = node['ark']['tar']
|
||||
cmd += " #{tar_args} "
|
||||
cmd += new_resource.release_file
|
||||
cmd += tar_strip_args
|
||||
cmd
|
||||
end
|
||||
generates_owner_commands_for :windows,
|
||||
when_the: -> { node['platform_family'] == 'windows' },
|
||||
with_klass: ::Ark::WindowsOwner
|
||||
|
||||
def unzip_command
|
||||
if new_resource.strip_components > 0
|
||||
require 'tmpdir'
|
||||
tmpdir = Dir.mktmpdir
|
||||
strip_dir = '*/' * new_resource.strip_components
|
||||
cmd = "unzip -q -u -o #{new_resource.release_file} -d #{tmpdir}"
|
||||
cmd += " && rsync -a #{tmpdir}/#{strip_dir} #{new_resource.path}"
|
||||
cmd += " && rm -rf #{tmpdir}"
|
||||
cmd
|
||||
else
|
||||
"unzip -q -u -o #{new_resource.release_file} -d #{new_resource.path}"
|
||||
end
|
||||
end
|
||||
generates_owner_commands_for :all_other_platforms,
|
||||
when_the: -> { true },
|
||||
with_klass: ::Ark::GeneralOwner
|
||||
|
||||
def sevenzip_command
|
||||
if new_resource.strip_components > 0
|
||||
require 'tmpdir'
|
||||
tmpdir = Dir.mktmpdir
|
||||
cmd = sevenzip_command_builder(tmpdir,'e')
|
||||
cmd += " && "
|
||||
currdir = tmpdir
|
||||
var = 0
|
||||
while var < new_resource.strip_components do
|
||||
var += 1
|
||||
cmd += "for /f %#{var} in ('dir /ad /b \"#{currdir.gsub! '/', '\\'}\"') do "
|
||||
currdir += "\\%#{var}"
|
||||
end
|
||||
cmd += "xcopy \"#{currdir}\" \"#{new_resource.home_dir}\" /s /e"
|
||||
else
|
||||
cmd = sevenzip_command_builder(new_resource.path,'x')
|
||||
end
|
||||
cmd
|
||||
end
|
||||
def deprecations
|
||||
::Ark::ResourceDeprecations.on(new_resource)
|
||||
end
|
||||
|
||||
def sevenzip_command_builder(dir, command)
|
||||
cmd = "#{node['ark']['tar']} #{command} \"";
|
||||
cmd += new_resource.release_file
|
||||
cmd += "\" "
|
||||
case parse_file_extension
|
||||
when /tar.gz|tgz|tar.bz2|tbz|tar.xz|txz/
|
||||
cmd += " -so | #{node['ark']['tar']} x -aoa -si -ttar"
|
||||
end
|
||||
cmd += " -o\"#{dir}\" -uy"
|
||||
cmd
|
||||
end
|
||||
def show_deprecations
|
||||
deprecations.each { |message| Chef::Log.warn("DEPRECATED: #{message}") }
|
||||
end
|
||||
|
||||
def dump_command
|
||||
if node['platform_family'] === 'windows'
|
||||
cmd = sevenzip_command_builder(new_resource.path,'e')
|
||||
else
|
||||
case unpack_type
|
||||
when "tar_xzf", "tar_xjf", "tar_xJf"
|
||||
cmd = "tar -mxf \"#{new_resource.release_file}\" -C \"#{new_resource.path}\""
|
||||
when "unzip"
|
||||
cmd = "unzip -j -q -u -o \"#{new_resource.release_file}\" -d \"#{new_resource.path}\""
|
||||
end
|
||||
end
|
||||
Chef::Log.debug("DEBUG: cmd: #{cmd}")
|
||||
cmd
|
||||
end
|
||||
def defaults
|
||||
@resource_defaults ||= ::Ark::ResourceDefaults.new(new_resource)
|
||||
end
|
||||
|
||||
def cherry_pick_command
|
||||
if node['platform_family'] === 'windows'
|
||||
cmd = sevenzip_command_builder(new_resource.path,'e')
|
||||
cmd += " -r #{new_resource.creates}"
|
||||
else
|
||||
case unpack_type
|
||||
when "tar_xzf"
|
||||
cmd = cherry_pick_tar_command("xzf")
|
||||
when "tar_xjf"
|
||||
cmd = cherry_pick_tar_command("xjf")
|
||||
when "tar_xJf"
|
||||
cmd = cherry_pick_tar_command("xJf")
|
||||
when "unzip"
|
||||
cmd = "unzip -t #{new_resource.release_file} \"*/#{new_resource.creates}\" ; stat=$? ;"
|
||||
cmd += "if [ $stat -eq 11 ] ; then "
|
||||
cmd += "unzip -j -o #{new_resource.release_file} \"#{new_resource.creates}\" -d #{new_resource.path} ;"
|
||||
cmd += "elif [ $stat -ne 0 ] ; then false ;"
|
||||
cmd += "else "
|
||||
cmd += "unzip -j -o #{new_resource.release_file} \"*/#{new_resource.creates}\" -d #{new_resource.path} ;"
|
||||
cmd += "fi"
|
||||
end
|
||||
end
|
||||
Chef::Log.debug("DEBUG: cmd: #{cmd}")
|
||||
cmd
|
||||
end
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def set_paths
|
||||
new_resource.extension = defaults.extension
|
||||
new_resource.prefix_bin = defaults.prefix_bin
|
||||
new_resource.prefix_root = defaults.prefix_root
|
||||
new_resource.home_dir = defaults.home_dir
|
||||
new_resource.version = defaults.version
|
||||
|
||||
def cherry_pick_tar_command(tar_args)
|
||||
cmd = node['ark']['tar']
|
||||
cmd += " #{tar_args}"
|
||||
cmd += " #{new_resource.release_file}"
|
||||
cmd += " -C"
|
||||
cmd += " #{new_resource.path}"
|
||||
cmd += " #{new_resource.creates}"
|
||||
cmd += tar_strip_args
|
||||
cmd
|
||||
end
|
||||
# TODO: what happens when the path is already set --
|
||||
# with the current logic we overwrite it
|
||||
# if you are in windows we overwrite it
|
||||
# otherwise we overwrite it with the root/name-version
|
||||
new_resource.path = defaults.path
|
||||
new_resource.release_file = defaults.release_file
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
|
||||
def set_paths
|
||||
release_ext = parse_file_extension
|
||||
prefix_bin = new_resource.prefix_bin.nil? ? new_resource.run_context.node['ark']['prefix_bin'] : new_resource.prefix_bin
|
||||
prefix_root = new_resource.prefix_root.nil? ? new_resource.run_context.node['ark']['prefix_root'] : new_resource.prefix_root
|
||||
if new_resource.prefix_home.nil?
|
||||
default_home_dir = ::File.join(new_resource.run_context.node['ark']['prefix_home'], new_resource.name)
|
||||
else
|
||||
default_home_dir = ::File.join(new_resource.prefix_home, new_resource.name)
|
||||
end
|
||||
# set effective paths
|
||||
new_resource.prefix_bin = prefix_bin
|
||||
new_resource.version ||= "1" # initialize to one if nil
|
||||
new_resource.home_dir ||= default_home_dir
|
||||
if node['platform_family'] === 'windows'
|
||||
new_resource.path = new_resource.win_install_dir
|
||||
else
|
||||
new_resource.path = ::File.join(prefix_root, "#{new_resource.name}-#{new_resource.version}")
|
||||
end
|
||||
Chef::Log.debug("path is #{new_resource.path}")
|
||||
new_resource.release_file = ::File.join(Chef::Config[:file_cache_path], "#{new_resource.name}-#{new_resource.version}.#{release_ext}")
|
||||
end
|
||||
def set_put_paths
|
||||
new_resource.extension = defaults.extension
|
||||
|
||||
def set_put_paths
|
||||
release_ext = parse_file_extension
|
||||
path = new_resource.path.nil? ? new_resource.run_context.node['ark']['prefix_root'] : new_resource.path
|
||||
new_resource.path = ::File.join(path, new_resource.name)
|
||||
Chef::Log.debug("DEBUG: path is #{new_resource.path}")
|
||||
new_resource.release_file = ::File.join(Chef::Config[:file_cache_path], "#{new_resource.name}.#{release_ext}")
|
||||
end
|
||||
# TODO: Should we be setting the prefix_root -
|
||||
# as the prefix_root could be used in the path_with_version
|
||||
# new_resource.prefix_root = default.prefix_root
|
||||
new_resource.path = defaults.path_without_version
|
||||
new_resource.release_file = defaults.release_file_without_version
|
||||
end
|
||||
|
||||
def set_dump_paths
|
||||
release_ext = parse_file_extension
|
||||
new_resource.release_file = ::File.join(Chef::Config[:file_cache_path], "#{new_resource.name}.#{release_ext}")
|
||||
end
|
||||
def set_dump_paths
|
||||
new_resource.extension = defaults.extension
|
||||
new_resource.release_file = defaults.release_file_without_version
|
||||
end
|
||||
|
||||
def tar_strip_args
|
||||
new_resource.strip_components > 0 ? " --strip-components=#{new_resource.strip_components}" : ""
|
||||
end
|
||||
def unpack_command
|
||||
archive_application.unpack
|
||||
end
|
||||
|
||||
def show_deprecations
|
||||
if [true, false].include?(new_resource.strip_leading_dir)
|
||||
Chef::Log.warn("DEPRECATED: strip_leading_dir attribute was deprecated. Use strip_components instead.")
|
||||
end
|
||||
end
|
||||
def dump_command
|
||||
archive_application.dump
|
||||
end
|
||||
|
||||
def owner_command
|
||||
if node['platform_family'] === 'windows'
|
||||
cmd = "icacls #{new_resource.path}\\* /setowner #{new_resource.owner}"
|
||||
else
|
||||
cmd = "chown -R #{new_resource.owner}:#{new_resource.group} #{new_resource.path}"
|
||||
end
|
||||
cmd
|
||||
end
|
||||
def cherry_pick_command
|
||||
archive_application.cherry_pick
|
||||
end
|
||||
|
||||
# def unpacked?(path)
|
||||
# if new_resource.creates
|
||||
# full_path = ::File.join(new_resource.path, new_resource.creates)
|
||||
# else
|
||||
# full_path = path
|
||||
# end
|
||||
# if ::File.directory? full_path
|
||||
# if ::File.stat(full_path).nlink == 2
|
||||
# false
|
||||
# else
|
||||
# true
|
||||
# end
|
||||
# elsif ::File.exists? full_path
|
||||
# true
|
||||
# else
|
||||
# false
|
||||
# end
|
||||
# end
|
||||
def unzip_command
|
||||
archive_application.unpack
|
||||
end
|
||||
|
||||
def owner_command
|
||||
owner_builder_klass.new(new_resource).command
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def archive_application
|
||||
@archive_application ||= archive_builder_klass.new(new_resource)
|
||||
end
|
||||
|
||||
def archive_builder_klass
|
||||
new_resource.extension ||= defaults.extension
|
||||
Ark::ProviderHelpers.archive_command_generators.find { |condition, _klass| instance_exec(&condition) }.last
|
||||
end
|
||||
|
||||
def owner_builder_klass
|
||||
Ark::ProviderHelpers.owner_command_generators.find { |condition, _klass| instance_exec(&condition) }.last
|
||||
end
|
||||
end
|
||||
end
|
||||
|
13
cookbooks/ark/libraries/general_owner.rb
Normal file
13
cookbooks/ark/libraries/general_owner.rb
Normal file
@ -0,0 +1,13 @@
|
||||
module Ark
|
||||
class GeneralOwner
|
||||
def initialize(resource)
|
||||
@resource = resource
|
||||
end
|
||||
|
||||
attr_reader :resource
|
||||
|
||||
def command
|
||||
"chown -R #{resource.owner}:#{resource.group} #{resource.path}"
|
||||
end
|
||||
end
|
||||
end
|
42
cookbooks/ark/libraries/matchers.rb
Normal file
42
cookbooks/ark/libraries/matchers.rb
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
if defined?(ChefSpec)
|
||||
def install_ark(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:ark, :install, resource_name)
|
||||
end
|
||||
|
||||
def dump_ark(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:ark, :dump, resource_name)
|
||||
end
|
||||
|
||||
def cherry_pick_ark(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:ark, :cherry_pick, resource_name)
|
||||
end
|
||||
|
||||
def put_ark(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:ark, :put, resource_name)
|
||||
end
|
||||
|
||||
def install_with_make_ark(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:ark, :install_with_make, resource_name)
|
||||
end
|
||||
|
||||
def configure_ark(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:ark, :configure, resource_name)
|
||||
end
|
||||
|
||||
def setup_py_build_ark(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:ark, :setup_py_build, resource_name)
|
||||
end
|
||||
|
||||
def setup_py_install_ark(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:ark, :setup_py_install, resource_name)
|
||||
end
|
||||
|
||||
def setup_py_ark(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:ark, :setup_py, resource_name)
|
||||
end
|
||||
|
||||
def unzip_ark(resource_name)
|
||||
ChefSpec::Matchers::ResourceMatcher.new(:ark, :unzip, resource_name)
|
||||
end
|
||||
end
|
23
cookbooks/ark/libraries/platform_specific_builders.rb
Normal file
23
cookbooks/ark/libraries/platform_specific_builders.rb
Normal file
@ -0,0 +1,23 @@
|
||||
module Ark
|
||||
module PlatformSpecificBuilders
|
||||
def generates_archive_commands_for(_name, options)
|
||||
condition = options[:when_the]
|
||||
builder = options[:with_klass]
|
||||
archive_command_generators.push [condition, builder]
|
||||
end
|
||||
|
||||
def archive_command_generators
|
||||
@archive_command_generators ||= []
|
||||
end
|
||||
|
||||
def generates_owner_commands_for(_name, options)
|
||||
condition = options[:when_the]
|
||||
builder = options[:with_klass]
|
||||
owner_command_generators.push [condition, builder]
|
||||
end
|
||||
|
||||
def owner_command_generators
|
||||
@owner_command_generators ||= []
|
||||
end
|
||||
end
|
||||
end
|
100
cookbooks/ark/libraries/resource_defaults.rb
Normal file
100
cookbooks/ark/libraries/resource_defaults.rb
Normal file
@ -0,0 +1,100 @@
|
||||
module Ark
|
||||
class ResourceDefaults
|
||||
def extension
|
||||
resource.extension || generate_extension_from_url(resource.url.clone)
|
||||
end
|
||||
|
||||
def prefix_bin
|
||||
resource.prefix_bin || prefix_bin_from_node_in_run_context
|
||||
end
|
||||
|
||||
def prefix_root
|
||||
resource.prefix_root || prefix_root_from_node_in_run_context
|
||||
end
|
||||
|
||||
def home_dir
|
||||
if resource.home_dir.nil? || resource.home_dir.empty?
|
||||
prefix_home = resource.prefix_home || prefix_home_from_node_in_run_context
|
||||
::File.join(prefix_home, resource.name)
|
||||
else
|
||||
resource.home_dir
|
||||
end
|
||||
end
|
||||
|
||||
def version
|
||||
resource.version || default_version
|
||||
end
|
||||
|
||||
def path
|
||||
if windows?
|
||||
resource.win_install_dir
|
||||
else
|
||||
::File.join(resource.prefix_root, "#{resource.name}-#{resource.version}")
|
||||
end
|
||||
end
|
||||
|
||||
def windows?
|
||||
node_in_run_context['platform_family'] == 'windows'
|
||||
end
|
||||
|
||||
def path_without_version
|
||||
partial_path = resource.path || prefix_root_from_node_in_run_context
|
||||
::File.join(partial_path, resource.name)
|
||||
end
|
||||
|
||||
def release_file
|
||||
release_filename = "#{resource.name}-#{resource.version}.#{resource.extension}"
|
||||
::File.join(file_cache_path, release_filename)
|
||||
end
|
||||
|
||||
def release_file_without_version
|
||||
release_filename = "#{resource.name}.#{resource.extension}"
|
||||
::File.join(file_cache_path, release_filename)
|
||||
end
|
||||
|
||||
def initialize(resource)
|
||||
@resource = resource
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
attr_reader :resource
|
||||
|
||||
def generate_extension_from_url(url)
|
||||
# purge any trailing redirect
|
||||
url =~ %r{^https?:\/\/.*(.bin|bz2|gz|jar|tbz|tgz|txz|war|xz|zip)(\/.*\/)}
|
||||
url.gsub!(Regexp.last_match(2), '') unless Regexp.last_match(2).nil?
|
||||
# remove tailing query string
|
||||
release_basename = ::File.basename(url.gsub(/\?.*\z/, '')).gsub(/-bin\b/, '')
|
||||
# (\?.*)? accounts for a trailing querystring
|
||||
Chef::Log.debug("DEBUG: release_basename is #{release_basename}")
|
||||
release_basename =~ /^(.+?)\.(jar|tar\.bz2|tar\.gz|tar\.xz|tbz|tgz|txz|war|zip|tar)(\?.*)?/
|
||||
Chef::Log.debug("DEBUG: file_extension is #{Regexp.last_match(2)}")
|
||||
Regexp.last_match(2)
|
||||
end
|
||||
|
||||
def prefix_bin_from_node_in_run_context
|
||||
node_in_run_context['ark']['prefix_bin']
|
||||
end
|
||||
|
||||
def prefix_root_from_node_in_run_context
|
||||
node_in_run_context['ark']['prefix_root']
|
||||
end
|
||||
|
||||
def prefix_home_from_node_in_run_context
|
||||
node_in_run_context['ark']['prefix_home']
|
||||
end
|
||||
|
||||
def default_version
|
||||
"1"
|
||||
end
|
||||
|
||||
def file_cache_path
|
||||
Chef::Config[:file_cache_path]
|
||||
end
|
||||
|
||||
def node_in_run_context
|
||||
resource.run_context.node
|
||||
end
|
||||
end
|
||||
end
|
33
cookbooks/ark/libraries/resource_deprecations.rb
Normal file
33
cookbooks/ark/libraries/resource_deprecations.rb
Normal file
@ -0,0 +1,33 @@
|
||||
module Ark
|
||||
class ResourceDeprecations
|
||||
def self.on(resource)
|
||||
new(resource).warnings
|
||||
end
|
||||
|
||||
def initialize(resource)
|
||||
@resource = resource
|
||||
end
|
||||
|
||||
attr_reader :resource
|
||||
|
||||
def warnings
|
||||
applicable_deprecrations.map { |_, message| message }
|
||||
end
|
||||
|
||||
def applicable_deprecrations
|
||||
deprecations.select { |condition, _| send(condition) }
|
||||
end
|
||||
|
||||
def deprecations
|
||||
{ strip_leading_dir_feature: strip_leading_dir_feature_message }
|
||||
end
|
||||
|
||||
def strip_leading_dir_feature
|
||||
[true, false].include?(resource.strip_leading_dir)
|
||||
end
|
||||
|
||||
def strip_leading_dir_feature_message
|
||||
"strip_leading_dir attribute was deprecated. Use strip_components instead."
|
||||
end
|
||||
end
|
||||
end
|
66
cookbooks/ark/libraries/sevenzip_command_builder.rb
Normal file
66
cookbooks/ark/libraries/sevenzip_command_builder.rb
Normal file
@ -0,0 +1,66 @@
|
||||
module Ark
|
||||
class SevenZipCommandBuilder
|
||||
def unpack
|
||||
sevenzip_command
|
||||
end
|
||||
|
||||
def dump
|
||||
sevenzip_command_builder(resource.path, 'e')
|
||||
end
|
||||
|
||||
def cherry_pick
|
||||
"#{sevenzip_command_builder(resource.path, 'e')} -r #{resource.creates}"
|
||||
end
|
||||
|
||||
def initialize(resource)
|
||||
@resource = resource
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
attr_reader :resource
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def sevenzip_command
|
||||
if resource.strip_components <= 0
|
||||
sevenzip_command_builder(resource.path, 'x')
|
||||
return
|
||||
end
|
||||
|
||||
tmpdir = make_temp_directory
|
||||
cmd = sevenzip_command_builder(tmpdir, 'e')
|
||||
|
||||
cmd += " && "
|
||||
currdir = tmpdir.tr('/', '\\')
|
||||
|
||||
1.upto(resource.strip_components).each do |count|
|
||||
cmd += "for /f %#{count} in ('dir /ad /b \"#{currdir}\"') do "
|
||||
currdir += "\\%#{count}"
|
||||
end
|
||||
|
||||
cmd += "xcopy \"#{currdir}\" \"#{resource.home_dir}\" /s /e"
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
|
||||
def sevenzip_binary
|
||||
resource.run_context.node['ark']['tar']
|
||||
end
|
||||
|
||||
def sevenzip_command_builder(dir, command)
|
||||
"#{sevenzip_binary} #{command} \"#{resource.release_file}\"#{extension_is_tar} -o\"#{dir}\" -uy"
|
||||
end
|
||||
|
||||
def extension_is_tar
|
||||
if resource.extension =~ /tar.gz|tgz|tar.bz2|tbz|tar.xz|txz/
|
||||
" -so | #{sevenzip_binary} x -aoa -si -ttar"
|
||||
else
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
def make_temp_directory
|
||||
require 'tmpdir'
|
||||
Dir.mktmpdir
|
||||
end
|
||||
end
|
||||
end
|
49
cookbooks/ark/libraries/tar_command_builder.rb
Normal file
49
cookbooks/ark/libraries/tar_command_builder.rb
Normal file
@ -0,0 +1,49 @@
|
||||
module Ark
|
||||
class TarCommandBuilder
|
||||
def unpack
|
||||
"#{tar_binary} #{args} #{resource.release_file}#{strip_args}"
|
||||
end
|
||||
|
||||
def dump
|
||||
"tar -mxf \"#{resource.release_file}\" -C \"#{resource.path}\""
|
||||
end
|
||||
|
||||
def cherry_pick
|
||||
"#{tar_binary} #{args} #{resource.release_file} -C #{resource.path} #{resource.creates}#{strip_args}"
|
||||
end
|
||||
|
||||
def initialize(resource)
|
||||
@resource = resource
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
attr_reader :resource
|
||||
|
||||
def node
|
||||
resource.run_context.node
|
||||
end
|
||||
|
||||
def tar_binary
|
||||
resource.run_context.node['ark']['tar']
|
||||
end
|
||||
|
||||
def args
|
||||
case resource.extension
|
||||
when /^(tar)$/ then "xf"
|
||||
when /^(tar.gz|tgz)$/ then "xzf"
|
||||
when /^(tar.bz2|tbz)$/ then "xjf"
|
||||
when /^(tar.xz|txz)$/ then "xJf"
|
||||
else raise unsupported_extension
|
||||
end
|
||||
end
|
||||
|
||||
def strip_args
|
||||
resource.strip_components > 0 ? " --strip-components=#{resource.strip_components}" : ""
|
||||
end
|
||||
|
||||
def unsupported_extension
|
||||
"Don't know how to expand #{resource.url} (extension: #{resource.extension})"
|
||||
end
|
||||
end
|
||||
end
|
50
cookbooks/ark/libraries/unzip_command_builder.rb
Normal file
50
cookbooks/ark/libraries/unzip_command_builder.rb
Normal file
@ -0,0 +1,50 @@
|
||||
module Ark
|
||||
class UnzipCommandBuilder
|
||||
def unpack
|
||||
if resource.strip_components > 0
|
||||
unzip_with_strip_components
|
||||
else
|
||||
"unzip -q -o #{resource.release_file} -d #{resource.path}"
|
||||
end
|
||||
end
|
||||
|
||||
def dump
|
||||
"unzip -j -q -o \"#{resource.release_file}\" -d \"#{resource.path}\""
|
||||
end
|
||||
|
||||
# rubocop:disable Metrics/AbcSize
|
||||
def cherry_pick
|
||||
cmd = "unzip -t #{resource.release_file} \"*/#{resource.creates}\" ; stat=$? ;"
|
||||
cmd += "if [ $stat -eq 11 ] ; then "
|
||||
cmd += "unzip -j -o #{resource.release_file} \"#{resource.creates}\" -d #{resource.path} ;"
|
||||
cmd += "elif [ $stat -ne 0 ] ; then false ;"
|
||||
cmd += "else "
|
||||
cmd += "unzip -j -o #{resource.release_file} \"*/#{resource.creates}\" -d #{resource.path} ;"
|
||||
cmd += "fi"
|
||||
cmd
|
||||
end
|
||||
# rubocop:enable Metrics/AbcSize
|
||||
|
||||
def initialize(resource)
|
||||
@resource = resource
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
attr_reader :resource
|
||||
|
||||
def unzip_with_strip_components
|
||||
tmpdir = make_temp_directory
|
||||
strip_dir = '*/' * resource.strip_components
|
||||
cmd = "unzip -q -o #{resource.release_file} -d #{tmpdir}"
|
||||
cmd += " && rsync -a #{tmpdir}/#{strip_dir} #{resource.path}"
|
||||
cmd += " && rm -rf #{tmpdir}"
|
||||
cmd
|
||||
end
|
||||
|
||||
def make_temp_directory
|
||||
require 'tmpdir'
|
||||
Dir.mktmpdir
|
||||
end
|
||||
end
|
||||
end
|
13
cookbooks/ark/libraries/windows_owner.rb
Normal file
13
cookbooks/ark/libraries/windows_owner.rb
Normal file
@ -0,0 +1,13 @@
|
||||
module Ark
|
||||
class WindowsOwner
|
||||
def initialize(resource)
|
||||
@resource = resource
|
||||
end
|
||||
|
||||
attr_reader :resource
|
||||
|
||||
def command
|
||||
"icacls \"#{resource.path}\\*\" /setowner \"#{resource.owner}\""
|
||||
end
|
||||
end
|
||||
end
|
File diff suppressed because one or more lines are too long
@ -1,16 +0,0 @@
|
||||
name 'ark'
|
||||
maintainer 'Bryan W. Berry'
|
||||
maintainer_email 'bryan.berry@gmail.com'
|
||||
license 'Apache 2.0'
|
||||
description 'Installs/Configures ark'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '0.9.0'
|
||||
|
||||
%w( debian ubuntu centos redhat fedora windows ).each do |os|
|
||||
supports os
|
||||
end
|
||||
|
||||
recipe 'ark::default', 'Installs and configures ark'
|
||||
|
||||
depends 'windows'
|
||||
depends '7-zip'
|
@ -3,9 +3,11 @@
|
||||
# Provider:: Ark
|
||||
#
|
||||
# Author:: Bryan W. Berry <bryan.berry@gmail.com>
|
||||
# Author:: Sean OMeara <someara@opscode.com
|
||||
# Author:: Sean OMeara <someara@chef.io
|
||||
# Author:: John Bellone <jbellone@bloomberg.net>
|
||||
# Copyright 2012, Bryan W. Berry
|
||||
# Copyright 2013, Opscode, Inc.
|
||||
# Copyright 2013, Chef Software, Inc.
|
||||
# Copyright 2014, Bloomberg L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -20,14 +22,8 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
use_inline_resources if defined?(use_inline_resources)
|
||||
include ::Opscode::Ark::ProviderHelpers
|
||||
|
||||
# From resources/default.rb
|
||||
# :install, :put, :dump, :cherry_pick, :install_with_make, :configure, :setup_py_build, :setup_py_install, :setup_py
|
||||
#
|
||||
# Used in test.rb
|
||||
# :install, :put, :dump, :cherry_pick, :install_with_make, :configure
|
||||
use_inline_resources
|
||||
include ::Ark::ProviderHelpers
|
||||
|
||||
#################
|
||||
# action :install
|
||||
@ -51,9 +47,8 @@ action :install do
|
||||
end
|
||||
|
||||
# unpack based on file extension
|
||||
_unpack_command = unpack_command
|
||||
execute "unpack #{new_resource.release_file}" do
|
||||
command _unpack_command
|
||||
command unpack_command
|
||||
cwd new_resource.path
|
||||
environment new_resource.environment
|
||||
notifies :run, "execute[set owner on #{new_resource.path}]"
|
||||
@ -61,14 +56,13 @@ action :install do
|
||||
end
|
||||
|
||||
# set_owner
|
||||
_owner_command = owner_command
|
||||
execute "set owner on #{new_resource.path}" do
|
||||
command _owner_command
|
||||
command owner_command
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# usually on windows there is no central directory with executables where the applciations are linked
|
||||
if not node['platform_family'] === 'windows'
|
||||
unless node['platform_family'] == 'windows'
|
||||
# symlink binaries
|
||||
new_resource.has_binaries.each do |bin|
|
||||
link ::File.join(new_resource.prefix_bin, ::File.basename(bin)) do
|
||||
@ -89,7 +83,7 @@ action :install do
|
||||
group 'root'
|
||||
mode '0755'
|
||||
cookbook 'ark'
|
||||
variables(:directory => "#{new_resource.path}/bin")
|
||||
variables(directory: "#{new_resource.path}/bin")
|
||||
only_if { new_resource.append_env_path }
|
||||
end
|
||||
end
|
||||
@ -100,7 +94,9 @@ action :install do
|
||||
block do
|
||||
ENV['PATH'] = bin_path + ':' + ENV['PATH']
|
||||
end
|
||||
only_if { new_resource.append_env_path && ENV['PATH'].scan(bin_path).empty? }
|
||||
only_if do
|
||||
new_resource.append_env_path && ENV['PATH'].scan(bin_path).empty?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -126,9 +122,8 @@ action :put do
|
||||
end
|
||||
|
||||
# unpack based on file extension
|
||||
_unpack_command = unpack_command
|
||||
execute "unpack #{new_resource.release_file}" do
|
||||
command _unpack_command
|
||||
command unpack_command
|
||||
cwd new_resource.path
|
||||
environment new_resource.environment
|
||||
notifies :run, "execute[set owner on #{new_resource.path}]"
|
||||
@ -136,9 +131,8 @@ action :put do
|
||||
end
|
||||
|
||||
# set_owner
|
||||
_owner_command = owner_command
|
||||
execute "set owner on #{new_resource.path}" do
|
||||
command _owner_command
|
||||
command owner_command
|
||||
action :nothing
|
||||
end
|
||||
end
|
||||
@ -166,9 +160,8 @@ action :dump do
|
||||
end
|
||||
|
||||
# unpack based on file extension
|
||||
_dump_command = dump_command
|
||||
execute "unpack #{new_resource.release_file}" do
|
||||
command _dump_command
|
||||
command dump_command
|
||||
cwd new_resource.path
|
||||
environment new_resource.environment
|
||||
notifies :run, "execute[set owner on #{new_resource.path}]"
|
||||
@ -176,9 +169,8 @@ action :dump do
|
||||
end
|
||||
|
||||
# set_owner
|
||||
_owner_command = owner_command
|
||||
execute "set owner on #{new_resource.path}" do
|
||||
command _owner_command
|
||||
command owner_command
|
||||
action :nothing
|
||||
end
|
||||
end
|
||||
@ -206,9 +198,8 @@ action :unzip do
|
||||
end
|
||||
|
||||
# unpack based on file extension
|
||||
_unzip_command = unzip_command
|
||||
execute "unpack #{new_resource.release_file}" do
|
||||
command _unzip_command
|
||||
command unzip_command
|
||||
cwd new_resource.path
|
||||
environment new_resource.environment
|
||||
notifies :run, "execute[set owner on #{new_resource.path}]"
|
||||
@ -216,9 +207,8 @@ action :unzip do
|
||||
end
|
||||
|
||||
# set_owner
|
||||
_owner_command = owner_command
|
||||
execute "set owner on #{new_resource.path}" do
|
||||
command _owner_command
|
||||
command owner_command
|
||||
action :nothing
|
||||
end
|
||||
end
|
||||
@ -245,20 +235,16 @@ action :cherry_pick do
|
||||
notifies :run, "execute[cherry_pick #{new_resource.creates} from #{new_resource.release_file}]"
|
||||
end
|
||||
|
||||
_unpack_type = unpack_type
|
||||
_cherry_pick_command = cherry_pick_command
|
||||
execute "cherry_pick #{new_resource.creates} from #{new_resource.release_file}" do
|
||||
Chef::Log.debug("DEBUG: unpack_type: #{_unpack_type}")
|
||||
command _cherry_pick_command
|
||||
command cherry_pick_command
|
||||
creates "#{new_resource.path}/#{new_resource.creates}"
|
||||
notifies :run, "execute[set owner on #{new_resource.path}]"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# set_owner
|
||||
_owner_command = owner_command
|
||||
execute "set owner on #{new_resource.path}" do
|
||||
command _owner_command
|
||||
command owner_command
|
||||
action :nothing
|
||||
end
|
||||
end
|
||||
@ -285,9 +271,8 @@ action :install_with_make do
|
||||
end
|
||||
|
||||
# unpack based on file extension
|
||||
_unpack_command = unpack_command
|
||||
execute "unpack #{new_resource.release_file}" do
|
||||
command _unpack_command
|
||||
command unpack_command
|
||||
cwd new_resource.path
|
||||
environment new_resource.environment
|
||||
notifies :run, "execute[set owner on #{new_resource.path}]"
|
||||
@ -299,9 +284,8 @@ action :install_with_make do
|
||||
end
|
||||
|
||||
# set_owner
|
||||
_owner_command = owner_command
|
||||
execute "set owner on #{new_resource.path}" do
|
||||
command _owner_command
|
||||
command owner_command
|
||||
action :nothing
|
||||
end
|
||||
|
||||
@ -335,9 +319,132 @@ action :install_with_make do
|
||||
environment new_resource.environment
|
||||
action :nothing
|
||||
end
|
||||
end
|
||||
|
||||
# unless new_resource.creates and ::File.exists? new_resource.creates
|
||||
# end
|
||||
action :setup_py_build do
|
||||
show_deprecations
|
||||
set_paths
|
||||
|
||||
directory new_resource.path do
|
||||
recursive true
|
||||
action :create
|
||||
notifies :run, "execute[unpack #{new_resource.release_file}]"
|
||||
end
|
||||
|
||||
remote_file new_resource.release_file do
|
||||
Chef::Log.debug('DEBUG: new_resource.release_file')
|
||||
source new_resource.url
|
||||
checksum new_resource.checksum if new_resource.checksum
|
||||
action :create
|
||||
notifies :run, "execute[unpack #{new_resource.release_file}]"
|
||||
end
|
||||
|
||||
# unpack based on file extension
|
||||
execute "unpack #{new_resource.release_file}" do
|
||||
command unpack_command
|
||||
cwd new_resource.path
|
||||
environment new_resource.environment
|
||||
notifies :run, "execute[set owner on #{new_resource.path}]"
|
||||
notifies :run, "execute[python setup.py build #{new_resource.path}]"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# set_owner
|
||||
execute "set owner on #{new_resource.path}" do
|
||||
command owner_command
|
||||
action :nothing
|
||||
end
|
||||
|
||||
execute "python setup.py build #{new_resource.path}" do
|
||||
command "python setup.py build #{new_resource.make_opts.join(' ')}"
|
||||
cwd new_resource.path
|
||||
environment new_resource.environment
|
||||
action :nothing
|
||||
end
|
||||
end
|
||||
|
||||
action :setup_py_install do
|
||||
show_deprecations
|
||||
set_paths
|
||||
|
||||
directory new_resource.path do
|
||||
recursive true
|
||||
action :create
|
||||
notifies :run, "execute[unpack #{new_resource.release_file}]"
|
||||
end
|
||||
|
||||
remote_file new_resource.release_file do
|
||||
Chef::Log.debug('DEBUG: new_resource.release_file')
|
||||
source new_resource.url
|
||||
checksum new_resource.checksum if new_resource.checksum
|
||||
action :create
|
||||
notifies :run, "execute[unpack #{new_resource.release_file}]"
|
||||
end
|
||||
|
||||
# unpack based on file extension
|
||||
execute "unpack #{new_resource.release_file}" do
|
||||
command unpack_command
|
||||
cwd new_resource.path
|
||||
environment new_resource.environment
|
||||
notifies :run, "execute[set owner on #{new_resource.path}]"
|
||||
notifies :run, "execute[python setup.py install #{new_resource.path}]"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# set_owner
|
||||
execute "set owner on #{new_resource.path}" do
|
||||
command owner_command
|
||||
action :nothing
|
||||
end
|
||||
|
||||
execute "python setup.py install #{new_resource.path}" do
|
||||
command "python setup.py install #{new_resource.make_opts.join(' ')}"
|
||||
cwd new_resource.path
|
||||
environment new_resource.environment
|
||||
action :nothing
|
||||
end
|
||||
end
|
||||
|
||||
action :setup_py do
|
||||
show_deprecations
|
||||
set_paths
|
||||
|
||||
directory new_resource.path do
|
||||
recursive true
|
||||
action :create
|
||||
notifies :run, "execute[unpack #{new_resource.release_file}]"
|
||||
end
|
||||
|
||||
remote_file new_resource.release_file do
|
||||
Chef::Log.debug('DEBUG: new_resource.release_file')
|
||||
source new_resource.url
|
||||
checksum new_resource.checksum if new_resource.checksum
|
||||
action :create
|
||||
notifies :run, "execute[unpack #{new_resource.release_file}]"
|
||||
end
|
||||
|
||||
# unpack based on file extension
|
||||
execute "unpack #{new_resource.release_file}" do
|
||||
command unpack_command
|
||||
cwd new_resource.path
|
||||
environment new_resource.environment
|
||||
notifies :run, "execute[set owner on #{new_resource.path}]"
|
||||
notifies :run, "execute[python setup.py #{new_resource.path}]"
|
||||
action :nothing
|
||||
end
|
||||
|
||||
# set_owner
|
||||
execute "set owner on #{new_resource.path}" do
|
||||
command owner_command
|
||||
action :nothing
|
||||
end
|
||||
|
||||
execute "python setup.py #{new_resource.path}" do
|
||||
command "python setup.py #{new_resource.make_opts.join(' ')}"
|
||||
cwd new_resource.path
|
||||
environment new_resource.environment
|
||||
action :nothing
|
||||
end
|
||||
end
|
||||
|
||||
action :configure do
|
||||
@ -359,9 +466,8 @@ action :configure do
|
||||
end
|
||||
|
||||
# unpack based on file extension
|
||||
_unpack_command = unpack_command
|
||||
execute "unpack #{new_resource.release_file}" do
|
||||
command _unpack_command
|
||||
command unpack_command
|
||||
cwd new_resource.path
|
||||
environment new_resource.environment
|
||||
notifies :run, "execute[set owner on #{new_resource.path}]"
|
||||
@ -371,9 +477,8 @@ action :configure do
|
||||
end
|
||||
|
||||
# set_owner
|
||||
_owner_command = owner_command
|
||||
execute "set owner on #{new_resource.path}" do
|
||||
command _owner_command
|
||||
command owner_command
|
||||
action :nothing
|
||||
end
|
||||
|
||||
|
@ -22,6 +22,4 @@ Array(node['ark']['package_dependencies']).each do |pkg|
|
||||
package pkg
|
||||
end
|
||||
|
||||
if node['platform_family'] === 'windows'
|
||||
include_recipe "7-zip"
|
||||
end
|
||||
include_recipe "seven_zip" if node['platform_family'] == 'windows'
|
||||
|
@ -1,152 +0,0 @@
|
||||
# require 'fileutils'
|
||||
|
||||
# remove file so we can test sending notification on its creation
|
||||
|
||||
FileUtils.rm_f '/tmp/foobarbaz/foo1.txt' if ::File.exist? '/tmp/foobarbaz/foo1.txt'
|
||||
|
||||
ruby_block 'test_notification' do
|
||||
block do
|
||||
FileUtils.touch '/tmp/foobarbaz/notification_successful.txt' if ::File.exist? '/tmp/foobarbaz/foo1.txt'
|
||||
end
|
||||
action :nothing
|
||||
end
|
||||
|
||||
user 'foobarbaz'
|
||||
|
||||
directory '/opt/bin' do
|
||||
recursive true
|
||||
end
|
||||
|
||||
ark 'foo' do
|
||||
url 'https://github.com/opscode-cookbooks/ark/raw/master/files/default/foo.tar.gz'
|
||||
checksum '5996e676f17457c823d86f1605eaa44ca8a81e70d6a0e5f8e45b51e62e0c52e8'
|
||||
version '2'
|
||||
prefix_root '/usr/local'
|
||||
owner 'foobarbaz'
|
||||
group 'foobarbaz'
|
||||
has_binaries ['bin/do_foo', 'bin/do_more_foo']
|
||||
action :install
|
||||
end
|
||||
|
||||
ark 'test_put' do
|
||||
url 'https://github.com/opscode-cookbooks/ark/raw/master/files/default/foo.tar.gz'
|
||||
checksum '5996e676f17457c823d86f1605eaa44ca8a81e70d6a0e5f8e45b51e62e0c52e8'
|
||||
owner 'foobarbaz'
|
||||
group 'foobarbaz'
|
||||
action :put
|
||||
end
|
||||
|
||||
ark 'test_dump' do
|
||||
url 'https://github.com/opscode-cookbooks/ark/raw/master/files/default/foo.zip'
|
||||
checksum 'deea3a324115c9ca0f3078362f807250080bf1b27516f7eca9d34aad863a11e0'
|
||||
path '/usr/local/foo_dump'
|
||||
creates 'foo1.txt'
|
||||
owner 'foobarbaz'
|
||||
group 'foobarbaz'
|
||||
action :dump
|
||||
end
|
||||
|
||||
ark 'cherry_pick_test' do
|
||||
url 'https://github.com/opscode-cookbooks/ark/raw/master/files/default/foo.tar.gz'
|
||||
checksum '5996e676f17457c823d86f1605eaa44ca8a81e70d6a0e5f8e45b51e62e0c52e8'
|
||||
path '/usr/local/foo_cherry_pick'
|
||||
owner 'foobarbaz'
|
||||
group 'foobarbaz'
|
||||
creates 'foo_sub/foo1.txt'
|
||||
action :cherry_pick
|
||||
end
|
||||
|
||||
ark 'cherry_pick_with_zip' do
|
||||
url 'https://github.com/opscode-cookbooks/ark/raw/master/files/default/foo.zip'
|
||||
checksum 'deea3a324115c9ca0f3078362f807250080bf1b27516f7eca9d34aad863a11e0'
|
||||
path '/usr/local/foo_cherry_pick_from_zip'
|
||||
creates 'foo_sub/foo1.txt'
|
||||
action :cherry_pick
|
||||
end
|
||||
|
||||
ark 'foo_append_env' do
|
||||
version '7.0.26'
|
||||
url 'https://github.com/opscode-cookbooks/ark/raw/master/files/default/foo.tar.gz'
|
||||
checksum '5996e676f17457c823d86f1605eaa44ca8a81e70d6a0e5f8e45b51e62e0c52e8'
|
||||
append_env_path true
|
||||
action :install
|
||||
end
|
||||
|
||||
ark 'foo_dont_strip' do
|
||||
version '2'
|
||||
url 'https://github.com/opscode-cookbooks/ark/raw/master/files/default/foo.tar.gz'
|
||||
checksum '5996e676f17457c823d86f1605eaa44ca8a81e70d6a0e5f8e45b51e62e0c52e8'
|
||||
strip_components 0
|
||||
action :install
|
||||
end
|
||||
|
||||
ark 'foo_zip_strip' do
|
||||
version '2'
|
||||
url 'https://github.com/opscode-cookbooks/ark/raw/master/files/default/foo.zip'
|
||||
checksum 'deea3a324115c9ca0f3078362f807250080bf1b27516f7eca9d34aad863a11e0'
|
||||
action :install
|
||||
end
|
||||
|
||||
ark 'haproxy' do
|
||||
url 'http://haproxy.1wt.eu/download/1.5/src/snapshot/haproxy-ss-20120403.tar.gz'
|
||||
version '1.5'
|
||||
checksum 'ba0424bf7d23b3a607ee24bbb855bb0ea347d7ffde0bec0cb12a89623cbaf911'
|
||||
make_opts ['TARGET=linux26']
|
||||
action :install_with_make
|
||||
end unless platform?('freebsd')
|
||||
|
||||
ark 'foo_alt_bin' do
|
||||
url 'https://github.com/opscode-cookbooks/ark/raw/master/files/default/foo.tar.gz'
|
||||
checksum '5996e676f17457c823d86f1605eaa44ca8a81e70d6a0e5f8e45b51e62e0c52e8'
|
||||
version '3'
|
||||
prefix_root '/opt'
|
||||
prefix_home '/opt'
|
||||
prefix_bin '/opt/bin'
|
||||
owner 'foobarbaz'
|
||||
group 'foobarbaz'
|
||||
has_binaries ['bin/do_foo']
|
||||
action :install
|
||||
end
|
||||
|
||||
ark 'foo_tbz' do
|
||||
url 'https://github.com/opscode-cookbooks/ark/raw/master/files/default/foo.tbz'
|
||||
version '3'
|
||||
end
|
||||
|
||||
ark 'foo_tgz' do
|
||||
url 'https://github.com/opscode-cookbooks/ark/raw/master/files/default/foo.tgz'
|
||||
version '3'
|
||||
end
|
||||
|
||||
ark 'foo_txz' do
|
||||
url 'https://github.com/opscode-cookbooks/ark/raw/master/files/default/foo.txz'
|
||||
version '3'
|
||||
end
|
||||
|
||||
ark 'test notification' do
|
||||
url 'https://github.com/opscode-cookbooks/ark/raw/master/files/default/foo.zip'
|
||||
path '/tmp/foobarbaz'
|
||||
creates 'foo1.txt'
|
||||
action :dump
|
||||
notifies :create, 'ruby_block[test_notification]', :immediately
|
||||
end
|
||||
|
||||
ark 'test_autogen' do
|
||||
url 'https://github.com/zeromq/libzmq/tarball/master'
|
||||
extension 'tar.gz'
|
||||
action :configure
|
||||
# autoconf in RHEL < 6 is too old
|
||||
not_if { platform_family?('rhel') && node['platform_version'].to_f < 6.0 }
|
||||
end
|
||||
|
||||
ark 'foo_sub' do
|
||||
url 'https://github.com/opscode-cookbooks/ark/raw/master/files/default/foo_sub.tar.gz'
|
||||
version '1'
|
||||
strip_components 2
|
||||
end
|
||||
|
||||
ark 'foo_sub' do
|
||||
url 'https://github.com/opscode-cookbooks/ark/raw/master/files/default/foo_sub.zip'
|
||||
version '2'
|
||||
strip_components 2
|
||||
end
|
@ -18,38 +18,51 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
def initialize(name, run_context = nil)
|
||||
super
|
||||
@resource_name = :ark
|
||||
@allowed_actions.push(:install, :dump, :cherry_pick, :put, :install_with_make, :configure, :setup_py_build, :setup_py_install, :setup_py, :unzip)
|
||||
@action = :install
|
||||
@provider = Chef::Provider::Ark
|
||||
end
|
||||
actions(
|
||||
:cherry_pick,
|
||||
:configure,
|
||||
:dump,
|
||||
:install,
|
||||
:install_with_make,
|
||||
:put,
|
||||
:setup_py,
|
||||
:setup_py_build,
|
||||
:setup_py_install,
|
||||
:unzip
|
||||
)
|
||||
|
||||
attr_accessor :path, :release_file, :prefix_bin, :prefix_root, :home_dir, :extension, :version
|
||||
default_action :install
|
||||
|
||||
attribute :owner, :kind_of => String, :default => 'root'
|
||||
attribute :group, :kind_of => [String, Fixnum], :default => 0
|
||||
attribute :url, :kind_of => String, :required => true
|
||||
attribute :path, :kind_of => String, :default => nil
|
||||
attribute :full_path, :kind_of => String, :default => nil
|
||||
attribute :append_env_path, :kind_of => [TrueClass, FalseClass], :default => false
|
||||
attribute :checksum, :regex => /^[a-zA-Z0-9]{64}$/, :default => nil
|
||||
attribute :has_binaries, :kind_of => Array, :default => []
|
||||
attribute :creates, :kind_of => String, :default => nil
|
||||
attribute :release_file, :kind_of => String, :default => ''
|
||||
attribute :strip_leading_dir, :kind_of => [TrueClass, FalseClass, NilClass]
|
||||
attribute :strip_components, :kind_of => Integer, :default => 1
|
||||
attribute :mode, :kind_of => Fixnum, :default => 0755
|
||||
attribute :prefix_root, :kind_of => String, :default => nil
|
||||
attribute :prefix_home, :kind_of => String, :default => nil
|
||||
attribute :prefix_bin, :kind_of => String, :default => nil
|
||||
attribute :version, :kind_of => String, :default => nil
|
||||
attribute :home_dir, :kind_of => String, :default => nil
|
||||
attribute :win_install_dir, :kind_of => String, :default => nil
|
||||
attribute :environment, :kind_of => Hash, :default => {}
|
||||
attribute :autoconf_opts, :kind_of => Array, :default => []
|
||||
attribute :make_opts, :kind_of => Array, :default => []
|
||||
attribute :home_dir, :kind_of => String, :default => nil
|
||||
attribute :autoconf_opts, :kind_of => Array, :default => []
|
||||
attribute :extension, :kind_of => String
|
||||
attr_accessor :extension,
|
||||
:home_dir,
|
||||
:path,
|
||||
:prefix_bin,
|
||||
:prefix_root,
|
||||
:release_file,
|
||||
:version
|
||||
|
||||
attribute :owner, kind_of: String, default: 'root'
|
||||
attribute :group, kind_of: [String, Fixnum], default: 0
|
||||
attribute :url, kind_of: String, required: true
|
||||
attribute :path, kind_of: String, default: nil
|
||||
attribute :full_path, kind_of: String, default: nil
|
||||
attribute :append_env_path, kind_of: [TrueClass, FalseClass], default: false
|
||||
attribute :checksum, regex: /^[a-zA-Z0-9]{64}$/, default: nil
|
||||
attribute :has_binaries, kind_of: Array, default: []
|
||||
attribute :creates, kind_of: String, default: nil
|
||||
attribute :release_file, kind_of: String, default: ''
|
||||
attribute :strip_leading_dir, kind_of: [TrueClass, FalseClass, NilClass]
|
||||
attribute :strip_components, kind_of: Integer, default: 1
|
||||
attribute :mode, kind_of: Fixnum, default: 0755
|
||||
attribute :prefix_root, kind_of: String, default: nil
|
||||
attribute :prefix_home, kind_of: String, default: nil
|
||||
attribute :prefix_bin, kind_of: String, default: nil
|
||||
attribute :version, kind_of: String, default: nil
|
||||
attribute :home_dir, kind_of: String, default: nil
|
||||
attribute :win_install_dir, kind_of: String, default: nil
|
||||
attribute :environment, kind_of: Hash, default: {}
|
||||
attribute :autoconf_opts, kind_of: Array, default: []
|
||||
attribute :make_opts, kind_of: Array, default: []
|
||||
attribute :home_dir, kind_of: String, default: nil
|
||||
attribute :autoconf_opts, kind_of: Array, default: []
|
||||
attribute :extension, kind_of: String
|
||||
|
@ -1 +1 @@
|
||||
export PATH=<%= @directory -%>:$PATH
|
||||
export PATH=<%= @directory -%>:$PATH
|
||||
|
@ -2,17 +2,45 @@ bluepill Cookbook CHANGELOG
|
||||
===========================
|
||||
This file is used to list changes made in each version of the bluepill cookbook.
|
||||
|
||||
2.4.1 (11-10-2015)
|
||||
------
|
||||
- Require rsyslog ~> 2.0.0 to preserve Chef 11 compatibility
|
||||
- Fix rsyslog restarting on RHEL
|
||||
- Use platform_family when setting platform specific node attributes and fix bad syntax. This should improve RHEL support
|
||||
|
||||
v2.4.0 (09-17-2015)
|
||||
------
|
||||
- Updated the LSB Required-Start and Required-Stop comments of the LSB init script template to be valid
|
||||
- Added name to the bluepill_test cookbook metadata for Chef 12
|
||||
- If a defaults file on RHEL or Debian based systems exist for the service source that within the init scripts. Example if /etc/default/bar exists on debian for the bar service then source that
|
||||
- Added .kitchen.yml file with vagrant based testing for local testing and moved the cloud based kitchen to .kitchen.cloud.yml
|
||||
- Add Travis CI config
|
||||
- Added rubocop config
|
||||
- Updated Berksfile to 3.X format and removed yum cookbook that wasn't used
|
||||
- Updated contributing.md and added testing.md documentation
|
||||
- Updated development and testing dependencies in the Gemfile
|
||||
- Added maintainers.md and .toml and added Rake task for generating the MD file
|
||||
- Opscode -> Chef Software everywhere
|
||||
- Added Travis and cookbook version badges to the readme
|
||||
- Add rake file to easy testing
|
||||
- Resolved all Rubocop warnings
|
||||
- Added a chefignore file and added additional files to the gitignore
|
||||
- Added source_url and issues_url metadata for Supermarket
|
||||
|
||||
v2.3.2
|
||||
------
|
||||
- Never actually released
|
||||
|
||||
v2.3.1
|
||||
------
|
||||
### New Feature
|
||||
- **[COOK-3705](https://tickets.opscode.com/browse/COOK-3705)** - Add init.d script with LSB style
|
||||
- **[COOK-3705](https://tickets.chef.io/browse/COOK-3705)** - Add init.d script with LSB style
|
||||
|
||||
|
||||
v2.3.0
|
||||
------
|
||||
### Improvement
|
||||
- **[COOK-3503](https://tickets.opscode.com/browse/COOK-3503)** - Add why-run support
|
||||
- **[COOK-3503](https://tickets.chef.io/browse/COOK-3503)** - Add why-run support
|
||||
|
||||
v2.2.2
|
||||
------
|
||||
|
@ -1,12 +1,23 @@
|
||||
bluepill Cookbook
|
||||
=================
|
||||
Installs bluepill RubyGem and configures it to manage services. Also includes a LWRP.
|
||||
|
||||
[](https://travis-ci.org/chef-cookbooks/bluepill)
|
||||
[](https://supermarket.chef.io/cookbooks/bluepill)
|
||||
|
||||
Installs bluepill Ruby Gem and configures it to manage services. Also includes a LWRP.
|
||||
|
||||
|
||||
Requirements
|
||||
------------
|
||||
#### Platforms
|
||||
Bluepill is a pure Ruby service management tool/library, so this cookbook should work on any system. The attributes do set up paths based on FHS locations, see below.
|
||||
|
||||
#### Chef
|
||||
- Chef 11+
|
||||
|
||||
#### Cookbooks
|
||||
- none
|
||||
|
||||
|
||||
Attributes
|
||||
----------
|
||||
@ -68,11 +79,12 @@ See bluepill's documentation for more information on creating pill templates.
|
||||
|
||||
License & Authors
|
||||
-----------------
|
||||
- Author:: Joshua Timberman (<joshua@opscode.com>)
|
||||
|
||||
```text
|
||||
Copyright 2010-2013, Opscode, Inc.
|
||||
**Author:** Cookbook Engineering Team (<cookbooks@chef.io>)
|
||||
|
||||
**Copyright:** 2010-2015, Chef Software, Inc.
|
||||
|
||||
```
|
||||
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
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Cookbook Name:: bluepill
|
||||
# Attributes:: default
|
||||
#
|
||||
# Copyright 2010, Opscode, Inc.
|
||||
# Copyright 2010-2015, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -15,21 +15,30 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
default["bluepill"]["bin"] = "#{node['languages']['ruby']['bin_dir']}/bluepill"
|
||||
default["bluepill"]["logfile"] = "/var/log/bluepill.log"
|
||||
default["bluepill"]["pid_dir"] = "/var/run/bluepill"
|
||||
default["bluepill"]["state_dir"] = "/var/lib/bluepill"
|
||||
default["bluepill"]["group"] = 0
|
||||
default["bluepill"]["use_rsyslog"] = false
|
||||
default['bluepill']['bin'] = "#{node['languages']['ruby']['bin_dir']}/bluepill"
|
||||
default['bluepill']['logfile'] = '/var/log/bluepill.log'
|
||||
default['bluepill']['pid_dir'] = '/var/run/bluepill'
|
||||
default['bluepill']['state_dir'] = '/var/lib/bluepill'
|
||||
default['bluepill']['group'] = 0
|
||||
default['bluepill']['use_rsyslog'] = false
|
||||
|
||||
case platform
|
||||
when "arch"
|
||||
default["bluepill"]["init_dir"] = "/etc/rc.d"
|
||||
default["bluepill"]["conf_dir"] = "/etc/bluepill"
|
||||
when "freebsd"
|
||||
default["bluepill"]["init_dir"] = "/usr/local/etc/rc.d"
|
||||
default["bluepill"]["conf_dir"] = "/usr/local/etc/bluepill"
|
||||
case node['platform_family']
|
||||
when 'arch'
|
||||
default['bluepill']['init_dir'] = '/etc/rc.d'
|
||||
default['bluepill']['conf_dir'] = '/etc/bluepill'
|
||||
default['bluepill']['defaults_dir'] = '/etc/default'
|
||||
when 'freebsd'
|
||||
default['bluepill']['init_dir'] = '/usr/local/etc/rc.d'
|
||||
default['bluepill']['conf_dir'] = '/usr/local/etc/bluepill'
|
||||
default['bluepill']['defaults_dir'] = '/etc/defaults'
|
||||
else
|
||||
default["bluepill"]["init_dir"] = "/etc/init.d"
|
||||
default["bluepill"]["conf_dir"] = "/etc/bluepill"
|
||||
default['bluepill']['init_dir'] = '/etc/init.d'
|
||||
default['bluepill']['conf_dir'] = '/etc/bluepill'
|
||||
end
|
||||
|
||||
case node['platform_family']
|
||||
when 'fedora', 'rhel'
|
||||
default['bluepill']['defaults_dir'] = '/etc/sysconfig'
|
||||
when 'debian'
|
||||
default['bluepill']['defaults_dir'] = '/etc/default'
|
||||
end
|
||||
|
@ -1,31 +1 @@
|
||||
{
|
||||
"name": "bluepill",
|
||||
"version": "2.3.1",
|
||||
"description": "Installs bluepill gem and configures to manage services, includes bluepill_service LWRP",
|
||||
"long_description": "bluepill Cookbook\n=================\nInstalls bluepill RubyGem and configures it to manage services. Also includes a LWRP.\n\n\nRequirements\n------------\nBluepill is a pure Ruby service management tool/library, so this cookbook should work on any system. The attributes do set up paths based on FHS locations, see below.\n\n\nAttributes\n----------\nDefault locations for bluepill are in \"FHS compliant\" locations.\n\n* `node[\"bluepill\"][\"bin\"]` - Path to bluepill program, default is 'bluepill' in the RubyGems binary directory.\n* `node[\"bluepill\"][\"logfile\"]` - Location of the bluepill log file, default \"/var/log/bluepill.log\".\n* `node[\"bluepill\"][\"conf_dir\"]` - Location of service config files (pills), default \"/etc/bluepill\".\n* `node[\"bluepill\"][\"pid_dir\"]` - Location of pidfiles, default \"/var/run/bluepill\"\n* `node[\"bluepill\"][\"state_dir\"]` - Location of state directory, default \"/var/lib/bluepill\"\n* `node[\"bluepill\"][\"init_dir\"]` - Location of init script directory, default selected by platform.\n* `node[\"bluepill\"][\"version\"]` - Version of bluepill to install, default is latest.\n* `node[\"bluepill\"][\"use_rsyslog\"]` - Enable configuration and use of rsyslog for bluepill.\n\n\nResources/Providers\n-------------------\nThis cookbook contains an LWRP, `bluepill_service`. This can be used with the normal Chef service resource, by using the `provider` parameter, or by specifying the `bluepill_service` shortcut. These two resources are equivalent.\n\n```ruby\nservice 'my_app' do\n provider bluepill_service\n action [:enable, :load, :start]\nend\n\nbluepill_service 'my_app' do\n action [:enable, :load, :start]\nend\n```\n\nThe load action should probably always be specified, to ensure that if bluepill isn't running already it gets started. The\n\nThe recipe using the service must contain a template resource for the pill and it must be named `my_app.pill.erb`, where `my_app` is the service name passed to the bluepill service resource.\n\n\nUsage\n-----\nBe sure to include the bluepill recipe in the run list to ensure that the gem and bluepill-related directories are created. This will also make the cookbook available on the system and other cookbooks won't need to explicitly depend on it in the metadata.\n\nIf the default directory locations in the attributes/default.rb aren't what you want, change them by setting them either in the attributes file itself, or create attributes in a role applied to any systems that will use bluepill.\n\nExample pill template resource and .erb file:\n\n```ruby\ntemplate '/etc/bluepill/my_app.pill' do\n source 'my_app.pill.erb'\nend\n\nBluepill.application('my_app') do |app|\n app.process('my_app') do |process|\n process.pid_file = '/var/run/my_app.pid'\n process.start_command = '/usr/bin/my_app'\n end\nend\n```\n\nSee bluepill's documentation for more information on creating pill templates.\n\n\nLicense & Authors\n-----------------\n- Author:: Joshua Timberman (<joshua@opscode.com>)\n\n```text\nCopyright 2010-2013, Opscode, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n",
|
||||
"maintainer": "Opscode, Inc.",
|
||||
"maintainer_email": "cookbooks@opscode.com",
|
||||
"license": "Apache 2.0",
|
||||
"platforms": {
|
||||
},
|
||||
"dependencies": {
|
||||
"rsyslog": ">= 0.0.0"
|
||||
},
|
||||
"recommendations": {
|
||||
},
|
||||
"suggestions": {
|
||||
},
|
||||
"conflicting": {
|
||||
},
|
||||
"providing": {
|
||||
},
|
||||
"replacing": {
|
||||
},
|
||||
"attributes": {
|
||||
},
|
||||
"groupings": {
|
||||
},
|
||||
"recipes": {
|
||||
"bluepill::default": "Installs bluepill rubygem and set up management directories"
|
||||
}
|
||||
}
|
||||
{"name":"bluepill","version":"2.4.1","description":"Installs bluepill gem and configures to manage services, includes bluepill_service LWRP","long_description":"bluepill Cookbook\n=================\n\n[](https://travis-ci.org/chef-cookbooks/bluepill)\n[](https://supermarket.chef.io/cookbooks/bluepill)\n\nInstalls bluepill Ruby Gem and configures it to manage services. Also includes a LWRP.\n\n\nRequirements\n------------\n#### Platforms\nBluepill is a pure Ruby service management tool/library, so this cookbook should work on any system. The attributes do set up paths based on FHS locations, see below.\n\n#### Chef\n- Chef 11+\n\n#### Cookbooks\n- none\n\n\nAttributes\n----------\nDefault locations for bluepill are in \"FHS compliant\" locations.\n\n* `node[\"bluepill\"][\"bin\"]` - Path to bluepill program, default is 'bluepill' in the RubyGems binary directory.\n* `node[\"bluepill\"][\"logfile\"]` - Location of the bluepill log file, default \"/var/log/bluepill.log\".\n* `node[\"bluepill\"][\"conf_dir\"]` - Location of service config files (pills), default \"/etc/bluepill\".\n* `node[\"bluepill\"][\"pid_dir\"]` - Location of pidfiles, default \"/var/run/bluepill\"\n* `node[\"bluepill\"][\"state_dir\"]` - Location of state directory, default \"/var/lib/bluepill\"\n* `node[\"bluepill\"][\"init_dir\"]` - Location of init script directory, default selected by platform.\n* `node[\"bluepill\"][\"version\"]` - Version of bluepill to install, default is latest.\n* `node[\"bluepill\"][\"use_rsyslog\"]` - Enable configuration and use of rsyslog for bluepill.\n\n\nResources/Providers\n-------------------\nThis cookbook contains an LWRP, `bluepill_service`. This can be used with the normal Chef service resource, by using the `provider` parameter, or by specifying the `bluepill_service` shortcut. These two resources are equivalent.\n\n```ruby\nservice 'my_app' do\n provider bluepill_service\n action [:enable, :load, :start]\nend\n\nbluepill_service 'my_app' do\n action [:enable, :load, :start]\nend\n```\n\nThe load action should probably always be specified, to ensure that if bluepill isn't running already it gets started. The\n\nThe recipe using the service must contain a template resource for the pill and it must be named `my_app.pill.erb`, where `my_app` is the service name passed to the bluepill service resource.\n\n\nUsage\n-----\nBe sure to include the bluepill recipe in the run list to ensure that the gem and bluepill-related directories are created. This will also make the cookbook available on the system and other cookbooks won't need to explicitly depend on it in the metadata.\n\nIf the default directory locations in the attributes/default.rb aren't what you want, change them by setting them either in the attributes file itself, or create attributes in a role applied to any systems that will use bluepill.\n\nExample pill template resource and .erb file:\n\n```ruby\ntemplate '/etc/bluepill/my_app.pill' do\n source 'my_app.pill.erb'\nend\n\nBluepill.application('my_app') do |app|\n app.process('my_app') do |process|\n process.pid_file = '/var/run/my_app.pid'\n process.start_command = '/usr/bin/my_app'\n end\nend\n```\n\nSee bluepill's documentation for more information on creating pill templates.\n\n\nLicense & Authors\n-----------------\n\n**Author:** Cookbook Engineering Team (<cookbooks@chef.io>)\n\n**Copyright:** 2010-2015, Chef Software, Inc.\n\n```\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache 2.0","platforms":{},"dependencies":{"rsyslog":"~> 2.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{"bluepill::default":"Installs bluepill rubygem and sets up management directories"}}
|
@ -1,10 +0,0 @@
|
||||
name "bluepill"
|
||||
maintainer "Opscode, Inc."
|
||||
maintainer_email "cookbooks@opscode.com"
|
||||
license "Apache 2.0"
|
||||
description "Installs bluepill gem and configures to manage services, includes bluepill_service LWRP"
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version "2.3.1"
|
||||
recipe "bluepill::default", "Installs bluepill rubygem and set up management directories"
|
||||
|
||||
depends "rsyslog"
|
@ -2,7 +2,7 @@
|
||||
# Cookbook Name:: bluepill
|
||||
# Provider:: service
|
||||
#
|
||||
# Copyright 2010, Opscode, Inc.
|
||||
# Copyright 2010-2015, Chef Software, Inc.
|
||||
# Copyright 2012, Heavy Water Operations, LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -31,31 +31,30 @@ action :enable do
|
||||
config_file = ::File.join(node['bluepill']['conf_dir'],
|
||||
"#{new_resource.service_name}.pill")
|
||||
unless @current_resource.enabled
|
||||
converge_by("enable #{ @new_resource }") do
|
||||
converge_by("enable #{@new_resource}") do
|
||||
link "#{node['bluepill']['init_dir']}/#{new_resource.service_name}" do
|
||||
to node['bluepill']['bin']
|
||||
only_if { ::File.exists?(config_file) }
|
||||
only_if { ::File.exist?(config_file) }
|
||||
end
|
||||
template_suffix = case node['platform_family']
|
||||
when "rhel", "fedora", "freebsd" then node['platform_family']
|
||||
when 'rhel', 'fedora', 'freebsd' then node['platform_family']
|
||||
when 'debian' then 'lsb'
|
||||
else nil
|
||||
end
|
||||
|
||||
template "#{node['bluepill']['init_dir']}/bluepill-#{new_resource.service_name}" do
|
||||
source "bluepill_init.#{template_suffix}.erb"
|
||||
cookbook "bluepill"
|
||||
owner "root"
|
||||
cookbook 'bluepill'
|
||||
owner 'root'
|
||||
group node['bluepill']['group']
|
||||
mode "0755"
|
||||
mode '0755'
|
||||
variables(
|
||||
:service_name => new_resource.service_name,
|
||||
:config_file => config_file
|
||||
)
|
||||
service_name: new_resource.service_name,
|
||||
config_file: config_file
|
||||
)
|
||||
end if template_suffix
|
||||
|
||||
service "bluepill-#{new_resource.service_name}" do
|
||||
action [ :enable ]
|
||||
action [:enable]
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -63,14 +62,14 @@ end
|
||||
|
||||
action :load do
|
||||
unless @current_resource.running
|
||||
converge_by("load #{ @new_resource }") do
|
||||
converge_by("load #{@new_resource}") do
|
||||
shell_out!(load_command)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
action :reload do
|
||||
converge_by("reload #{ @new_resource }") do
|
||||
converge_by("reload #{@new_resource}") do
|
||||
shell_out!(stop_command) if @current_resource.running
|
||||
shell_out!(load_command)
|
||||
end
|
||||
@ -78,7 +77,7 @@ end
|
||||
|
||||
action :start do
|
||||
unless @current_resource.running
|
||||
converge_by("start #{ @new_resource }") do
|
||||
converge_by("start #{@new_resource}") do
|
||||
shell_out!(start_command)
|
||||
end
|
||||
end
|
||||
@ -86,7 +85,7 @@ end
|
||||
|
||||
action :disable do
|
||||
if @current_resource.enabled
|
||||
converge_by("disable #{ @new_resource }") do
|
||||
converge_by("disable #{@new_resource}") do
|
||||
file "#{node['bluepill']['conf_dir']}/#{new_resource.service_name}.pill" do
|
||||
action :delete
|
||||
end
|
||||
@ -99,7 +98,7 @@ end
|
||||
|
||||
action :stop do
|
||||
if @current_resource.running
|
||||
converge_by("stop #{ @new_resource }") do
|
||||
converge_by("stop #{@new_resource}") do
|
||||
shell_out!(stop_command)
|
||||
end
|
||||
end
|
||||
@ -107,7 +106,7 @@ end
|
||||
|
||||
action :restart do
|
||||
if @current_resource.running
|
||||
converge_by("restart #{ @new_resource }") do
|
||||
converge_by("restart #{@new_resource}") do
|
||||
Chef::Log.debug "Restarting #{new_resource.service_name}"
|
||||
shell_out!(restart_command)
|
||||
Chef::Log.debug "Restarted #{new_resource.service_name}"
|
||||
@ -154,20 +153,18 @@ def determine_current_status!
|
||||
end
|
||||
|
||||
def service_running?
|
||||
begin
|
||||
if shell_out(status_command).exitstatus == 0
|
||||
@current_resource.running true
|
||||
Chef::Log.debug("#{new_resource} is running")
|
||||
end
|
||||
rescue Mixlib::ShellOut::ShellCommandFailed, SystemCallError
|
||||
@current_resource.running false
|
||||
nil
|
||||
if shell_out(status_command).exitstatus == 0
|
||||
@current_resource.running true
|
||||
Chef::Log.debug("#{new_resource} is running")
|
||||
end
|
||||
rescue Mixlib::ShellOut::ShellCommandFailed, SystemCallError
|
||||
@current_resource.running false
|
||||
nil
|
||||
end
|
||||
|
||||
def service_enabled?
|
||||
if ::File.exists?("#{node['bluepill']['conf_dir']}/#{new_resource.service_name}.pill") &&
|
||||
::File.symlink?("#{node['bluepill']['init_dir']}/#{new_resource.service_name}")
|
||||
if ::File.exist?("#{node['bluepill']['conf_dir']}/#{new_resource.service_name}.pill") &&
|
||||
::File.symlink?("#{node['bluepill']['init_dir']}/#{new_resource.service_name}")
|
||||
@current_resource.enabled true
|
||||
else
|
||||
@current_resource.enabled false
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Cookbook Name:: bluepill
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2010, Opscode, Inc.
|
||||
# Copyright 2010-2015, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -17,32 +17,29 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
gem_package "i18n" do
|
||||
action :install
|
||||
end
|
||||
gem_package 'i18n'
|
||||
|
||||
gem_package "bluepill" do
|
||||
version node["bluepill"]["version"] if node["bluepill"]["version"]
|
||||
action :install
|
||||
gem_package 'bluepill' do
|
||||
version node['bluepill']['version'] if node['bluepill']['version']
|
||||
end
|
||||
|
||||
[
|
||||
node["bluepill"]["conf_dir"],
|
||||
node["bluepill"]["pid_dir"],
|
||||
node["bluepill"]["state_dir"]
|
||||
node['bluepill']['conf_dir'],
|
||||
node['bluepill']['pid_dir'],
|
||||
node['bluepill']['state_dir']
|
||||
].each do |dir|
|
||||
directory dir do
|
||||
recursive true
|
||||
owner "root"
|
||||
group node["bluepill"]["group"]
|
||||
owner 'root'
|
||||
group node['bluepill']['group']
|
||||
end
|
||||
end
|
||||
|
||||
file node["bluepill"]["logfile"] do
|
||||
owner "root"
|
||||
group node["bluepill"]["group"]
|
||||
mode "0755"
|
||||
file node['bluepill']['logfile'] do
|
||||
owner 'root'
|
||||
group node['bluepill']['group']
|
||||
mode '0755'
|
||||
action :create_if_missing
|
||||
end
|
||||
|
||||
include_recipe "bluepill::rsyslog" if node['bluepill']['use_rsyslog']
|
||||
include_recipe 'bluepill::rsyslog' if node['bluepill']['use_rsyslog']
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Cookbook Name:: bluepill
|
||||
# Recipe:: rsyslog
|
||||
#
|
||||
# Copyright 2010, Opscode, Inc.
|
||||
# Copyright 2010-2015, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -17,12 +17,12 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
include_recipe "rsyslog"
|
||||
include_recipe 'rsyslog::default'
|
||||
|
||||
template "/etc/rsyslog.d/bluepill.conf" do
|
||||
owner "root"
|
||||
group "root"
|
||||
mode 0644
|
||||
source "bluepill_rsyslog.conf.erb"
|
||||
notifies :restart, "service[rsyslog]"
|
||||
template '/etc/rsyslog.d/bluepill.conf' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
mode '0644'
|
||||
source 'bluepill_rsyslog.conf.erb'
|
||||
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
|
||||
end
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Cookbook Name:: bluepill
|
||||
# Resource:: service
|
||||
#
|
||||
# Copyright 2010, Opscode, Inc.
|
||||
# Copyright 2010-2015, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -20,8 +20,8 @@
|
||||
actions :start, :stop, :enable, :disable, :load, :restart, :reload
|
||||
default_action :start
|
||||
|
||||
attribute :service_name, :name_attribute => true
|
||||
attribute :enabled, :default => false
|
||||
attribute :running, :default => false
|
||||
attribute :variables, :kind_of => Hash
|
||||
attribute :supports, :default => { :restart => true, :status => true }
|
||||
attribute :service_name, name_attribute: true
|
||||
attribute :enabled, default: false
|
||||
attribute :running, default: false
|
||||
attribute :variables, kind_of: Hash
|
||||
attribute :supports, default: { restart: true, status: true }
|
||||
|
@ -12,6 +12,8 @@ BLUEPILL_BIN=<%= node['bluepill']['bin'] %>
|
||||
BLUEPILL_CONFIG=<%= @config_file %>
|
||||
SERVICE_NAME=<%= @service_name %>
|
||||
|
||||
[ -r <%= node['bluepill']['defaults_dir'] %>/$SERVICE_NAME ] && . <%= node['bluepill']['defaults_dir'] %>/$SERVICE_NAME
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Loading bluepill configuration for $SERVICE_NAME "
|
||||
|
@ -24,6 +24,7 @@ status_cmd="${command} ${name} status"
|
||||
stop_cmd="${command} ${name} stop"
|
||||
stop_postcmd="${command} ${name} quit"
|
||||
|
||||
[ -r <%= node['bluepill']['defaults_dir'] %>/$name ] && . <%= node['bluepill']['defaults_dir'] %>/$name
|
||||
load_rc_config ${name}
|
||||
|
||||
PATH="${PATH}:/usr/local/bin"
|
||||
|
@ -2,7 +2,8 @@
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Provides: <%= @service_name %>
|
||||
# Required-Start: bar
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Defalt-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 2 6
|
||||
# Description: Bluepill loader for <%= @service_name %>
|
||||
@ -12,6 +13,8 @@ BLUEPILL_BIN=<%= node['bluepill']['bin'] %>
|
||||
BLUEPILL_CONFIG=<%= @config_file %>
|
||||
SERVICE_NAME=<%= @service_name %>
|
||||
|
||||
[ -r <%= node['bluepill']['defaults_dir'] %>/$SERVICE_NAME ] && . <%= node['bluepill']['defaults_dir'] %>/$SERVICE_NAME
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Loading bluepill configuration for $SERVICE_NAME "
|
||||
|
@ -12,6 +12,8 @@ BLUEPILL_BIN=<%= node['bluepill']['bin'] %>
|
||||
BLUEPILL_CONFIG=<%= @config_file %>
|
||||
SERVICE_NAME=<%= @service_name %>
|
||||
|
||||
[ -r <%= node['bluepill']['defaults_dir'] %>/$SERVICE_NAME ] && . <%= node['bluepill']['defaults_dir'] %>/$SERVICE_NAME
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Loading bluepill configuration for $SERVICE_NAME "
|
||||
|
@ -2,6 +2,36 @@ Chef Sugar Changelog
|
||||
=========================
|
||||
This file is used to list changes made in each version of the chef-sugar cookbook and gem.
|
||||
|
||||
v3.3.0 (2016-01-11)
|
||||
-------------------
|
||||
### Improvements
|
||||
- Break up `Chef::Sugar::Constraints` into a class and a dsl file
|
||||
- Add `platform_version` method with full constraints comparison support
|
||||
|
||||
v3.2.0 (2015-12-10)
|
||||
-------------------
|
||||
### Improvements
|
||||
- Add platform matchers for `debian` and `fedora`
|
||||
- Add `openvz` support under virtualization
|
||||
- Add init system detection support
|
||||
- Add support for `nexus`, `ios_xr` platforms and `wrlinux` platform_family
|
||||
- Add additional `aix` helpers
|
||||
|
||||
### Bug Fixes
|
||||
- Properly expose `Architecture#i386?` in the DSL
|
||||
|
||||
v3.1.1 (2015-06-23)
|
||||
-------------------
|
||||
### Improvements
|
||||
- Update Intel CPU types based on existing Fauxhai data
|
||||
- Update SPARC logic and 32/64-bit logic for x86 and i386
|
||||
|
||||
### Bug Fixes
|
||||
- Fix 32-bit logic
|
||||
- Fix default behavior to include chef-sugar at compile time
|
||||
- Fix Chef 12.1.0 warnings for chef_gem compile time install
|
||||
- Fix `redhat_enterprise_linux?` matcher
|
||||
|
||||
v3.0.2 (2015-03-26)
|
||||
-------------------
|
||||
### Improvements
|
||||
|
20
cookbooks/chef-sugar/CONTRIBUTING.md
Normal file
20
cookbooks/chef-sugar/CONTRIBUTING.md
Normal file
@ -0,0 +1,20 @@
|
||||
Contributing to Chef Sugar
|
||||
===============================
|
||||
The process for contributing to Chef sugar is rather straight-forward. It is unlikely that you'll need to modify the actual Chef recipe, so it's assumed that you want to work on the Gem itself.
|
||||
|
||||
1. Fork the repository on GitHub.
|
||||
2. Clone your fork.
|
||||
3. Create a new, semantically-named branch:
|
||||
|
||||
$ git checkout -b my_feature_branch
|
||||
|
||||
4. Make any changes, ensuring you write adequate test coverage.
|
||||
5. Document your changes (YARD).
|
||||
6. Run the tests (make sure they pass).
|
||||
7. Submit a Pull Request on GitHub.
|
||||
8. (optional) Ping me on Twitter (@sethvargo)
|
||||
|
||||
Additionally, please **DO NOT**:
|
||||
- Modify the version of the cookbook or gem.
|
||||
- Update the CHANGELOG
|
||||
- Make unnecessary changes to the gemspec
|
@ -4,7 +4,7 @@ Chef Sugar
|
||||
[][travis]
|
||||
|
||||
[gem]: https://rubygems.org/gems/chef-sugar
|
||||
[travis]: http://travis-ci.org/sethvargo/chef-suguar
|
||||
[travis]: http://travis-ci.org/sethvargo/chef-sugar
|
||||
|
||||
Chef Sugar is a Gem & Chef Recipe that includes series of helpful sugar of the Chef core and other resources to make a cleaner, more lean recipe DSL, enforce DRY principles, and make writing Chef recipes an awesome experience!
|
||||
|
||||
@ -82,6 +82,7 @@ API
|
||||
- `sparc?`
|
||||
- `ppc64?`
|
||||
- `ppc64le?`
|
||||
- `powerpc?`
|
||||
|
||||
#### Examples
|
||||
```ruby
|
||||
@ -249,6 +250,31 @@ class Chef
|
||||
end
|
||||
```
|
||||
|
||||
### Init
|
||||
- `systemd?` - detect if init system is systemd
|
||||
- `upstart?` - detect if init system is upstart
|
||||
- `runit?` - detect if init system is runit
|
||||
|
||||
#### Examples
|
||||
```ruby
|
||||
systemd_service 'my-service' do
|
||||
description 'My Service'
|
||||
install do
|
||||
wanted_by 'multi-user.target'
|
||||
end
|
||||
service do
|
||||
exec_start '/usr/bin/myserviced'
|
||||
end
|
||||
action [:create, :enable, :start]
|
||||
only_if { systemd? }
|
||||
end
|
||||
|
||||
cookbook_file '/etc/init/my-service.conf' do
|
||||
source 'my-service.conf'
|
||||
only_if { upstart? }
|
||||
end
|
||||
```
|
||||
|
||||
### IP
|
||||
- `best_ip_for` - determine the best IP address for the given "other" node, preferring local IP addresses over public ones.
|
||||
|
||||
@ -296,6 +322,9 @@ node.deep_fetch('apache2', 'config', 'root') => node['apache2']['config']['root'
|
||||
- `aix?`
|
||||
- `smartos?`
|
||||
- `omnios?`
|
||||
- `raspbian?`
|
||||
- `nexus?`
|
||||
- `ios_xr?`
|
||||
|
||||
There are also a series of dynamically defined matchers that map named operating system release versions and comparison operators in the form "#{platform}\_#{operator}\_#{name}?". For example:
|
||||
|
||||
@ -334,6 +363,7 @@ end
|
||||
- `slackware?`
|
||||
- `suse?`
|
||||
- `windows?`
|
||||
- `wrlinux?`
|
||||
|
||||
#### Examples
|
||||
```ruby
|
||||
@ -404,6 +434,7 @@ end
|
||||
- `lxc?`
|
||||
- `virtualbox?`
|
||||
- `vmware?`
|
||||
- `openvz?`
|
||||
|
||||
#### Examples
|
||||
```ruby
|
||||
|
@ -1,29 +1 @@
|
||||
{
|
||||
"name": "chef-sugar",
|
||||
"version": "3.1.0",
|
||||
"description": "Installs chef-sugar. Please see the chef-sugar Ruby gem for more information.",
|
||||
"long_description": "Chef Sugar is a Gem & Chef Recipe that includes series of helpful syntactic\nsugars on top of the Chef core and other resources to make a cleaner, more lean\nrecipe DSL, enforce DRY principles, and make writing Chef recipes an awesome and\nfun experience!\n\nFor the most up-to-date information and documentation, please visit the [Chef\nSugar project page on GitHub](https://github.com/sethvargo/chef-sugar).\n",
|
||||
"maintainer": "Seth Vargo",
|
||||
"maintainer_email": "sethvargo@gmail.com",
|
||||
"license": "Apache 2.0",
|
||||
"platforms": {
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"recommendations": {
|
||||
},
|
||||
"suggestions": {
|
||||
},
|
||||
"conflicting": {
|
||||
},
|
||||
"providing": {
|
||||
},
|
||||
"replacing": {
|
||||
},
|
||||
"attributes": {
|
||||
},
|
||||
"groupings": {
|
||||
},
|
||||
"recipes": {
|
||||
}
|
||||
}
|
||||
{"name":"chef-sugar","version":"3.3.0","description":"Installs chef-sugar. Please see the chef-sugar Ruby gem for more information.","long_description":"Chef Sugar is a Gem & Chef Recipe that includes series of helpful syntactic\nsugars on top of the Chef core and other resources to make a cleaner, more lean\nrecipe DSL, enforce DRY principles, and make writing Chef recipes an awesome and\nfun experience!\n\nFor the most up-to-date information and documentation, please visit the [Chef\nSugar project page on GitHub](https://github.com/sethvargo/chef-sugar).\n","maintainer":"Seth Vargo","maintainer_email":"sethvargo@gmail.com","license":"Apache 2.0","platforms":{},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{}}
|
@ -19,9 +19,16 @@
|
||||
|
||||
gem_version = run_context.cookbook_collection[cookbook_name].metadata.version
|
||||
|
||||
chef_gem('chef-sugar') do
|
||||
version gem_version
|
||||
action :nothing
|
||||
end.run_action(:install)
|
||||
if Chef::Resource::ChefGem.instance_methods(false).include?(:compile_time)
|
||||
chef_gem 'chef-sugar' do
|
||||
version gem_version
|
||||
compile_time true
|
||||
end
|
||||
else
|
||||
chef_gem 'chef-sugar' do
|
||||
version gem_version
|
||||
action :nothing
|
||||
end.run_action(:install)
|
||||
end
|
||||
|
||||
require 'chef/sugar'
|
||||
|
@ -1,56 +1,56 @@
|
||||
chef_handler cookbook CHANGELOG
|
||||
===============================
|
||||
# chef_handler cookbook CHANGELOG
|
||||
This file is used to list changes made in each version of the chef_handler cookbook.
|
||||
|
||||
v1.1.9 (2015-05-26)
|
||||
-------------------
|
||||
Bugfixes from 1.1.8 - loading without source is not allowed again.
|
||||
Class unloading is performed more carefully.
|
||||
Tests for resource providers.
|
||||
## v1.3.0 (2016-02-16)
|
||||
- Added state attributes to the custom resource
|
||||
- Added source_url and issues_url to metadata.rb
|
||||
- Replaced attributes for root user and group with the Ohai defined values to simplify the logic of the cookbook
|
||||
- Added lint, unit, and itegration testing in Travis CI
|
||||
- Added Test Kitchen testing of the recipes and the custom resource via a test cookbook
|
||||
- Added Berksfile
|
||||
- Added chefignore and .gitignore files
|
||||
- Added .rubocop.yml config and resolve multiple issues
|
||||
- Updated contributing and testing docs to the latest
|
||||
- Added all testing dependencies to the Gemfile
|
||||
- Added maintainers.md and maintainers.toml files
|
||||
- Expanded the Rakefile for simplified testing
|
||||
|
||||
v1.1.8 (2015-05-14)
|
||||
-------------------
|
||||
Updated Contribution and Readme docs.
|
||||
Fix ChefSpec matchers.
|
||||
Allow handler to load classes when no source is provided.
|
||||
## v1.2.0 (2015-06-25)
|
||||
- Move to support Chef 12+ only. Removes old 'handler class reload' behavior - it isn't necessary because chef-client forks and doesn't share a process between runs.
|
||||
|
||||
v1.1.6 (2014-04-09)
|
||||
-------------------
|
||||
[COOK-4494] - Add ChefSpec matchers
|
||||
## v1.1.9 (2015-05-26)
|
||||
- Bugfixes from 1.1.8 - loading without source is not allowed again. Class unloading is performed more carefully. Tests for resource providers.
|
||||
|
||||
## v1.1.8 (2015-05-14)
|
||||
- Updated Contribution and Readme docs
|
||||
- Fix ChefSpec matchers
|
||||
- Allow handler to load classes when no source is provided.
|
||||
|
||||
v1.1.5 (2014-02-25)
|
||||
-------------------
|
||||
## v1.1.6 (2014-04-09)
|
||||
- [COOK-4494] - Add ChefSpec matchers
|
||||
|
||||
## v1.1.5 (2014-02-25)
|
||||
- [COOK-4117] - use the correct scope when searching the children class name
|
||||
|
||||
|
||||
v1.1.4
|
||||
------
|
||||
## v1.1.4
|
||||
- [COOK-2146] - style updates
|
||||
|
||||
v1.1.2
|
||||
---------
|
||||
## v1.1.2
|
||||
- [COOK-1989] - fix scope for handler local variable to the enable block
|
||||
|
||||
v1.1.0
|
||||
------
|
||||
|
||||
## v1.1.0
|
||||
- [COOK-1645] - properly delete old handlers
|
||||
- [COOK-1322] - support platforms that use 'wheel' as root group'
|
||||
|
||||
v1.0.8
|
||||
------
|
||||
## v1.0.8
|
||||
- [COOK-1177] - doesn't work on windows due to use of unix specific attributes
|
||||
|
||||
v1.0.6
|
||||
------
|
||||
## v1.0.6
|
||||
- [COOK-1069] - typo in chef_handler readme
|
||||
|
||||
v1.0.4
|
||||
------
|
||||
## v1.0.4
|
||||
- [COOK-654] dont try and access a class before it has been loaded
|
||||
- fix bad boolean check (if vs unless)
|
||||
|
||||
v1.0.2
|
||||
------
|
||||
## v1.0.2
|
||||
- [COOK-620] ensure handler code is reloaded during daemonized chef runs
|
||||
|
||||
|
2
cookbooks/chef_handler/CONTRIBUTING.md
Normal file
2
cookbooks/chef_handler/CONTRIBUTING.md
Normal file
@ -0,0 +1,2 @@
|
||||
Please refer to
|
||||
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD
|
19
cookbooks/chef_handler/MAINTAINERS.md
Normal file
19
cookbooks/chef_handler/MAINTAINERS.md
Normal file
@ -0,0 +1,19 @@
|
||||
<!-- This is a generated file. Please do not edit directly -->
|
||||
|
||||
# Maintainers
|
||||
This file lists how this cookbook project is maintained. When making changes to the system, this
|
||||
file tells you who needs to review your patch - you need a simple majority of maintainers
|
||||
for the relevant subsystems to provide a :+1: on your pull request. Additionally, you need
|
||||
to not receive a veto from a Lieutenant or the Project Lead.
|
||||
|
||||
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD)
|
||||
for details on the process and how to become a maintainer or the project lead.
|
||||
|
||||
# Project Maintainer
|
||||
* [Tim Smith](https://github.com/tas50)
|
||||
|
||||
# Maintainers
|
||||
* [Jennifer Davis](https://github.com/sigje)
|
||||
* [Sean OMeara](https://github.com/someara)
|
||||
* [Tim Smith](https://github.com/tas50)
|
||||
* [Thom May](https://github.com/thommay)
|
@ -1,41 +1,40 @@
|
||||
Description
|
||||
===========
|
||||
# chef_handler Cookbook
|
||||
[](https://travis-ci.org/chef-cookbooks/chef_handler) [](https://supermarket.chef.io/cookbooks/chef_handler)
|
||||
|
||||
Creates a configured handler path for distributing [Chef report and exception handlers](http://docs.chef.io/handlers.html). Also exposes an LWRP for enabling Chef handlers from within recipe code (as opposed to hard coding in the client.rb file). This is useful for cookbook authors who may want to ship a product specific handler (see the `cloudkick` cookbook for an example) with their cookbook.
|
||||
|
||||
Requirements
|
||||
============
|
||||
## Requirements
|
||||
### Platforms
|
||||
- Debian/Ubuntu
|
||||
- RHEL/CentOS/Scientific/Amazon/Oracle
|
||||
- Windows
|
||||
|
||||
* Ruby >= 1.9
|
||||
### Chef
|
||||
- Chef 11+
|
||||
|
||||
Attributes
|
||||
==========
|
||||
### Cookbooks
|
||||
- none
|
||||
|
||||
`node["chef_handler"]["handler_path"]` - location to drop off handlers directory, default is `/var/chef/handlers`.
|
||||
|
||||
Resource/Provider
|
||||
=================
|
||||
|
||||
`chef_handler`
|
||||
--------------
|
||||
## Attributes
|
||||
`node['chef_handler']['handler_path']` - location to drop off handlers directory, default is a folder named 'handlers' in Chef's file cache directory
|
||||
|
||||
## Custom Resources
|
||||
### chef_handler
|
||||
Requires, configures and enables handlers on the node for the current Chef run. Also has the ability to pass arguments to the handlers initializer. This allows initialization data to be pulled from a node's attribute data.
|
||||
|
||||
It is best to declare `chef_handler` resources early on in the compile phase so they are available to fire for any exceptions during the Chef run. If you have a base role you would want any recipes that register Chef handlers to come first in the run_list.
|
||||
|
||||
### Actions
|
||||
#### Actions
|
||||
- `:enable:` Enables the Chef handler for the current Chef run on the current node
|
||||
- `:disable:` Disables the Chef handler for the current Chef run on the current node
|
||||
|
||||
- :enable: Enables the Chef handler for the current Chef run on the current node
|
||||
- :disable: Disables the Chef handler for the current Chef run on the current node
|
||||
#### Attribute Parameters
|
||||
- `class_name:` name attribute. The name of the handler class (can be module name-spaced).
|
||||
- `source:` full path to the handler file. can also be a gem path if the handler ships as part of a Ruby gem.
|
||||
- `arguments:` an array of arguments to pass the handler's class initializer
|
||||
- `supports:` type of Chef Handler to register as, i.e. :report, :exception or both. default is `:report => true, :exception => true`
|
||||
|
||||
### Attribute Parameters
|
||||
|
||||
- class_name: name attribute. The name of the handler class (can be module name-spaced).
|
||||
- source: full path to the handler file. can also be a gem path if the handler ships as part of a Ruby gem.
|
||||
- arguments: an array of arguments to pass the handler's class initializer
|
||||
- supports: type of Chef Handler to register as, i.e. :report, :exception or both. default is `:report => true, :exception => true`
|
||||
|
||||
### Example
|
||||
#### Example
|
||||
|
||||
```ruby
|
||||
# register the Chef::Handler::JsonFile handler
|
||||
@ -73,30 +72,18 @@ It is best to declare `chef_handler` resources early on in the compile phase so
|
||||
end
|
||||
```
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
default
|
||||
-------
|
||||
|
||||
## Usage
|
||||
### default
|
||||
Put the recipe `chef_handler` at the start of the node's run list to make sure that custom handlers are dropped off early on in the Chef run and available for later recipes.
|
||||
|
||||
For information on how to write report and exception handlers for Chef, please see the Chef wiki pages:
|
||||
http://wiki.chef.io/display/chef/Exception+and+Report+Handlers
|
||||
|
||||
json_file
|
||||
---------
|
||||
For information on how to write report and exception handlers for Chef, please see the Chef wiki pages: [https://docs.chef.io/handlers.html](https://docs.chef.io/handlers.html)
|
||||
|
||||
### json_file
|
||||
Leverages the `chef_handler` LWRP to automatically register the `Chef::Handler::JsonFile` handler that ships as part of Chef. This handler serializes the run status data to a JSON file located at `/var/chef/reports`.
|
||||
|
||||
|
||||
Unit Testing
|
||||
==================
|
||||
|
||||
## Unit Testing
|
||||
chef_handler provides built in [chefspec](https://github.com/sethvargo/chefspec) matchers for assisting unit tests. These matchers will only be loaded if chefspec is already loaded. Following is an example of asserting against the jsonfile handler:
|
||||
|
||||
|
||||
```ruby
|
||||
expect(runner).to enable_chef_handler("Chef::Handler::JsonFile").with(
|
||||
source: "chef/handler/json_file",
|
||||
@ -106,13 +93,12 @@ chef_handler provides built in [chefspec](https://github.com/sethvargo/chefspec)
|
||||
end
|
||||
```
|
||||
|
||||
License and Author
|
||||
==================
|
||||
## License & Authors
|
||||
**Author:** Cookbook Engineering Team ([cookbooks@chef.io](mailto:cookbooks@chef.io))
|
||||
|
||||
Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
|
||||
Copyright:: 2011, Chef Software, Inc
|
||||
**Copyright:** 2011-2016, Chef Software, Inc.
|
||||
|
||||
```
|
||||
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
|
||||
@ -124,3 +110,4 @@ 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.
|
||||
```
|
||||
|
@ -1,9 +1,9 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: chef_handlers
|
||||
# Attribute:: default
|
||||
# Cookbook Name:: chef_handler
|
||||
# Attributes:: default
|
||||
#
|
||||
# Copyright 2011-2013, Chef Software, Inc
|
||||
# Copyright 2011-2016, Chef Software, Inc
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -18,13 +18,4 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
default["chef_handler"]["root_user"] = "root"
|
||||
|
||||
case platform
|
||||
when "openbsd", "freebsd", "mac_os_x", "mac_os_x_server"
|
||||
default["chef_handler"]["root_group"] = "wheel"
|
||||
else
|
||||
default["chef_handler"]["root_group"] = "root"
|
||||
end
|
||||
|
||||
default["chef_handler"]["handler_path"] = "#{File.expand_path(File.join(Chef::Config[:file_cache_path], '..'))}/handlers"
|
||||
default['chef_handler']['handler_path'] = "#{File.expand_path(File.join(Chef::Config[:file_cache_path], '..'))}/handlers"
|
||||
|
@ -1,6 +1,6 @@
|
||||
#
|
||||
# Author:: Kartik Cating-Subramanian (<ksubramanian@chef.io>)
|
||||
# Copyright:: Copyright (c) 2015 Chef, Inc.
|
||||
# Copyright:: Copyright (c) 2015-2016 Chef Software, Inc.
|
||||
# License:: Apache License, Version 2.0
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -15,17 +15,15 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
|
||||
module ChefHandler
|
||||
module Helpers
|
||||
|
||||
# Registers a handler in Chef::Config.
|
||||
#
|
||||
# @param handler_type [Symbol] such as :report or :exception.
|
||||
# @param handler [Chef::Handler] handler to register.
|
||||
def register_handler(handler_type, handler)
|
||||
Chef::Log.info("Enabling #{handler.class.name} as a #{handler_type} handler.")
|
||||
Chef::Config.send("#{handler_type.to_s}_handlers") << handler
|
||||
Chef::Config.send("#{handler_type}_handlers") << handler
|
||||
end
|
||||
|
||||
# Removes all handlers that match the given class name in Chef::Config.
|
||||
@ -34,7 +32,7 @@ module ChefHandler
|
||||
# @param class_full_name [String] such as 'Chef::Handler::ErrorReport'.
|
||||
def unregister_handler(handler_type, class_full_name)
|
||||
Chef::Log.info("Disabling #{class_full_name} as a #{handler_type} handler.")
|
||||
Chef::Config.send("#{handler_type.to_s}_handlers").delete_if { |v| v.class.name == class_full_name }
|
||||
Chef::Config.send("#{handler_type}_handlers").delete_if { |v| v.class.name == class_full_name }
|
||||
end
|
||||
|
||||
# Walks down the namespace heirarchy to return the class object for the given class name.
|
||||
@ -51,38 +49,7 @@ module ChefHandler
|
||||
# (see COOK-4117).
|
||||
parent = ancestors.inject(Kernel) { |scope, const_name| scope.const_get(const_name, scope === Kernel) }
|
||||
child = parent.const_get(class_name, parent === Kernel)
|
||||
return parent, child
|
||||
end
|
||||
|
||||
# Unloads a given class and reloads it from the file provided.
|
||||
#
|
||||
# @param class_full_name [String] full class name such as 'Chef::Handler::Foo'. If a class
|
||||
# with that name currently exists, its definition is deleted from the enclosing module.
|
||||
# @param file_name [String] full path to the ruby file to be loaded. If path doesn't end with
|
||||
# .rb, that extension is appended.
|
||||
# @return [Class] definition for the freshly loaded class.
|
||||
def reload_class(class_full_name, file_name)
|
||||
begin
|
||||
parent, child = get_class(class_full_name)
|
||||
rescue
|
||||
Chef::Log.debug("#{class_full_name} was not previously loaded.")
|
||||
end
|
||||
|
||||
if child then
|
||||
class_name = class_full_name.split('::').last
|
||||
child = nil
|
||||
parent = Object if parent === Kernel
|
||||
parent.send(:remove_const, class_name)
|
||||
GC.start
|
||||
end
|
||||
|
||||
# Use load instead of require because we need to explicitly avoid any caching that 'require'
|
||||
# performs. If the file has changed, we want to get the changes.
|
||||
file_name << '.rb' unless file_name =~ /.*\.rb$/
|
||||
load file_name
|
||||
|
||||
parent, child = get_class(class_full_name)
|
||||
return child
|
||||
[parent, child]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Cookbook Name:: chef_handler
|
||||
# Library:: matchers
|
||||
#
|
||||
# Copyright 2014, Chef Software, Inc.
|
||||
# Copyright 2014-2016, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -19,12 +19,12 @@
|
||||
#
|
||||
|
||||
if defined?(ChefSpec)
|
||||
chefspec_version = Gem.loaded_specs["chefspec"].version
|
||||
if chefspec_version < Gem::Version.new('4.1.0')
|
||||
define_method = ChefSpec::Runner.method(:define_runner_method)
|
||||
else
|
||||
define_method = ChefSpec.method(:define_matcher)
|
||||
end
|
||||
chefspec_version = Gem.loaded_specs['chefspec'].version
|
||||
define_method = if chefspec_version < Gem::Version.new('4.1.0')
|
||||
ChefSpec::Runner.method(:define_runner_method)
|
||||
else
|
||||
ChefSpec.method(:define_matcher)
|
||||
end
|
||||
|
||||
define_method.call :chef_handler
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -3,7 +3,7 @@
|
||||
# Cookbook Name:: chef_handler
|
||||
# Provider:: default
|
||||
#
|
||||
# Copyright:: 2011-2013, Chef Software, Inc <legal@chef.io>
|
||||
# Copyright:: 2011-2016, Chef Software, Inc <legal@chef.io>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -25,36 +25,27 @@ def whyrun_supported?
|
||||
end
|
||||
|
||||
# This action needs to find an rb file that presumably contains the indicated class in it and the
|
||||
# load that file. It needs to do this keeping in mind that the same handler class can get enabled
|
||||
# and disabled multiple times and there may be multiple instances of them running around. The
|
||||
# handler code may also have changed between actions. To handle all this, we parse the full class
|
||||
# name and attempt to find its class object, in case it has already been loaded. If such a class
|
||||
# is found, we then attempt to unload that class before we load the file requested. We use "load"
|
||||
# instead of "require" because we want to reload the handler class in case it has changed and
|
||||
# don't want the caching behavior of "require".
|
||||
#
|
||||
# Note that during this process, we also need to keep track of the current handler configuration.
|
||||
# Any of the above steps might fail - in which case we would not want to be in a situation where
|
||||
# we have a registered handler that has been unloaded or mangled.
|
||||
# load that file. It then instantiates that class by name and registers it as a handler.
|
||||
action :enable do
|
||||
class_name = new_resource.class_name
|
||||
new_resource.supports.each do |type, enable|
|
||||
if enable
|
||||
converge_by("disable #{class_name} as a #{type} handler") do
|
||||
unregister_handler(type, class_name)
|
||||
end
|
||||
next unless enable
|
||||
converge_by("disable #{class_name} as a #{type} handler") do
|
||||
unregister_handler(type, class_name)
|
||||
end
|
||||
end
|
||||
|
||||
handler = nil
|
||||
converge_by("load #{class_name} from #{new_resource.source}") do
|
||||
klass = reload_class(class_name, new_resource.source)
|
||||
require new_resource.source
|
||||
_, klass = get_class(class_name)
|
||||
handler = klass.send(:new, *collect_args(new_resource.arguments))
|
||||
end
|
||||
|
||||
new_resource.supports.each do |type, enable|
|
||||
if enable
|
||||
converge_by("enable #{new_resource} as a #{type} handler") do
|
||||
register_handler(type, handler)
|
||||
end
|
||||
next unless enable
|
||||
converge_by("enable #{new_resource} as a #{type} handler") do
|
||||
register_handler(type, handler)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -83,4 +74,3 @@ def collect_args(resource_args = [])
|
||||
[resource_args]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: chef_handlers
|
||||
# Cookbook Name:: chef_handler
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2011, Chef Software, Inc.
|
||||
# Copyright 2011-2016, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -18,16 +18,15 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
Chef::Log.info("Chef Handlers will be at: #{node['chef_handler']['handler_path']}")
|
||||
Chef::Log.info("Chef Handlers will be located at: #{node['chef_handler']['handler_path']}")
|
||||
|
||||
remote_directory node['chef_handler']['handler_path'] do
|
||||
source 'handlers'
|
||||
# Just inherit permissions on Windows, don't try to set POSIX perms
|
||||
if node["platform"] != "windows"
|
||||
owner node['chef_handler']['root_user']
|
||||
group node['chef_handler']['root_group']
|
||||
mode "0755"
|
||||
unless platform?('windows')
|
||||
owner 'root'
|
||||
mode '0755'
|
||||
recursive true
|
||||
end
|
||||
group node['root_group']
|
||||
action :nothing
|
||||
end.run_action(:create)
|
||||
|
@ -1,9 +1,9 @@
|
||||
#
|
||||
# Author:: Seth Chisamore (<schisamo@chef.io>)
|
||||
# Cookbook Name:: chef_handlers
|
||||
# Cookbook Name:: chef_handler
|
||||
# Recipe:: json_file
|
||||
#
|
||||
# Copyright 2011, Chef Software, Inc.
|
||||
# Copyright 2011-2016, Chef Software, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -18,11 +18,11 @@
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
# force resource actions in compile phase so exception handler
|
||||
# force resource actions in compile phase so exception handler
|
||||
# fires for compile phase exceptions
|
||||
|
||||
chef_handler "Chef::Handler::JsonFile" do
|
||||
source "chef/handler/json_file"
|
||||
arguments :path => '/var/chef/reports'
|
||||
chef_handler 'Chef::Handler::JsonFile' do
|
||||
source 'chef/handler/json_file'
|
||||
arguments path: '/var/chef/reports'
|
||||
action :nothing
|
||||
end.run_action(:enable)
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Cookbook Name:: chef_handler
|
||||
# Resource:: default
|
||||
#
|
||||
# Copyright:: 2011-2013, Chef Software, Inc <legal@chef.io>
|
||||
# Copyright:: 2011-2016, Chef Software, Inc <legal@chef.io>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -20,15 +20,20 @@
|
||||
|
||||
actions :enable, :disable
|
||||
|
||||
attribute :class_name, :kind_of => String, :name_attribute => true
|
||||
attribute :source, :default => nil, :kind_of => String
|
||||
attribute :arguments, :default => []
|
||||
attribute :supports, :kind_of => Hash, :default => { :report => true, :exception => true }
|
||||
state_attrs :arguments,
|
||||
:class_name,
|
||||
:source,
|
||||
:supports
|
||||
|
||||
# we have to set default for the supports attribute
|
||||
attribute :class_name, kind_of: String, name_attribute: true
|
||||
attribute :source, default: nil, kind_of: String
|
||||
attribute :arguments, default: []
|
||||
attribute :supports, kind_of: Hash, default: { report: true, exception: true }
|
||||
|
||||
# we have to set default for the supports attribute
|
||||
# in initializer since it is a 'reserved' attribute name
|
||||
def initialize(*args)
|
||||
super
|
||||
@action = :enable
|
||||
@supports = { :report => true, :exception => true }
|
||||
@supports = { report: true, exception: true }
|
||||
end
|
||||
|
@ -23,11 +23,16 @@ _Store
|
||||
*.tmp
|
||||
*.bk
|
||||
*.bkup
|
||||
.ruby-version
|
||||
.ruby-gemset
|
||||
.rvmrc
|
||||
|
||||
# YARD artifacts
|
||||
.yardoc
|
||||
_yardoc
|
||||
doc/
|
||||
.idea
|
||||
.ruby-version
|
||||
|
||||
#chef stuff
|
||||
Berksfile.lock
|
182
cookbooks/database/.kitchen.cloud.yml
Normal file
182
cookbooks/database/.kitchen.cloud.yml
Normal file
@ -0,0 +1,182 @@
|
||||
#<% require 'kitchen-sync' %>
|
||||
---
|
||||
driver_config:
|
||||
digitalocean_client_id: <%= ENV['DIGITAL_OCEAN_CLIENT_ID'] %>
|
||||
google_client_email: <%= ENV['GOOGLE_CLIENT_EMAIL'] %>
|
||||
google_key_location: <%= ENV['GOOGLE_KEY_LOCATION'] %>
|
||||
google_project: <%= ENV['GOOGLE_PROJECT'] %>
|
||||
joyent_username: <%= ENV['SDC_CLI_ACCOUNT'] %>
|
||||
joyent_keyfile: <%= ENV['SDC_CLI_IDENTITY'] %>
|
||||
joyent_keyname: <%= ENV['SDC_CLI_KEY_ID'] %>
|
||||
joyent_url: <%= ENV['SDC_CLI_URL'] %>
|
||||
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'] %>
|
||||
flavor_id: <%= ENV['EC2_FLAVOR_ID'] %>
|
||||
availability_zone: <%= ENV['AWS_AVAILABILITY_ZONE'] %>
|
||||
|
||||
provisioner:
|
||||
name: chef_zero
|
||||
# require_chef_omnibus: 11.16.8
|
||||
# require_chef_omnibus: 12.0.3
|
||||
require_chef_omnibus: latest
|
||||
|
||||
platforms:
|
||||
- name: centos-5.8
|
||||
driver_plugin: digital_ocean
|
||||
driver_config:
|
||||
size: 2gb
|
||||
image: centos-5-8-x64
|
||||
region: <%= ENV['DIGITAL_OCEAN_REGION'] %>
|
||||
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
|
||||
ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %>
|
||||
|
||||
- name: centos-6.5
|
||||
driver_plugin: digital_ocean
|
||||
driver_config:
|
||||
size: 2gb
|
||||
image: centos-6-5-x64
|
||||
region: <%= ENV['DIGITAL_OCEAN_REGION'] %>
|
||||
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
|
||||
ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %>
|
||||
|
||||
- name: centos-7.0
|
||||
driver_plugin: digital_ocean
|
||||
driver_config:
|
||||
size: 2gb
|
||||
image: centos-7-0-x64
|
||||
region: <%= ENV['DIGITAL_OCEAN_REGION'] %>
|
||||
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
|
||||
ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %>
|
||||
|
||||
- name: amazon-2014.09
|
||||
driver_plugin: ec2
|
||||
driver_config:
|
||||
image_id: ami-9a6ed3f2
|
||||
username: ec2-user
|
||||
ssh_key: <%= ENV['EC2_SSH_KEY_PATH'] %>
|
||||
|
||||
- name: fedora-20
|
||||
driver_plugin: digital_ocean
|
||||
driver_config:
|
||||
size: 2gb
|
||||
image: fedora-20-x64
|
||||
region: <%= ENV['DIGITAL_OCEAN_REGION'] %>
|
||||
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
|
||||
ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %>
|
||||
|
||||
- name: suse-11.3
|
||||
driver_plugin: ec2
|
||||
driver_config:
|
||||
image_id: ami-e8084981
|
||||
username: root
|
||||
ssh_key: <%= ENV['EC2_SSH_KEY_PATH'] %>
|
||||
|
||||
- name: debian-7.0
|
||||
driver_plugin: gce
|
||||
driver_config:
|
||||
image_name: debian-7-wheezy-v20131120
|
||||
zone: <%= ENV['GCE_ZONE'] %>
|
||||
area: <%= ENV['GCE_AREA'] %>
|
||||
network: <%= ENV['GCE_NETWORK'] %>
|
||||
username: <%= ENV['GCE_USERNAME'] %>
|
||||
public_key_path: <%= ENV['GCE_PUBLIC_KEY_PATH'] %>
|
||||
ssh_key: <%= ENV['GCE_SSH_KEY_PATH'] %>
|
||||
run_list:
|
||||
- recipe[apt]
|
||||
|
||||
- name: ubuntu-10.04
|
||||
driver_plugin: digital_ocean
|
||||
driver_config:
|
||||
size: 2gb
|
||||
image: ubuntu-10-04-x64
|
||||
region: <%= ENV['DIGITAL_OCEAN_REGION'] %>
|
||||
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
|
||||
ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %>
|
||||
run_list:
|
||||
- recipe[apt]
|
||||
|
||||
- name: ubuntu-12.04
|
||||
driver_plugin: digital_ocean
|
||||
driver_config:
|
||||
size: 2gb
|
||||
image: ubuntu-12-04-x64
|
||||
region: <%= ENV['DIGITAL_OCEAN_REGION'] %>
|
||||
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
|
||||
ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %>
|
||||
run_list:
|
||||
- recipe[apt]
|
||||
|
||||
- name: ubuntu-14.04
|
||||
driver_plugin: digital_ocean
|
||||
driver_config:
|
||||
size: 2gb
|
||||
image: ubuntu-14-04-x64
|
||||
region: <%= ENV['DIGITAL_OCEAN_REGION'] %>
|
||||
ssh_key_ids: <%= ENV['DIGITAL_OCEAN_SSH_KEY_IDS'] %>
|
||||
ssh_key: <%= ENV['DIGITAL_OCEAN_SSH_KEY_PATH'] %>
|
||||
run_list:
|
||||
- recipe[apt]
|
||||
|
||||
suites:
|
||||
#
|
||||
# database-test
|
||||
#
|
||||
- name: myclient50
|
||||
run_list:
|
||||
- recipe[mysql_database_test]
|
||||
attributes:
|
||||
mysql:
|
||||
version: '5.0'
|
||||
includes: [
|
||||
'centos-5.8'
|
||||
]
|
||||
|
||||
- name: myclient51
|
||||
run_list:
|
||||
- recipe[mysql_database_test]
|
||||
attributes:
|
||||
mysql:
|
||||
version: '5.1'
|
||||
includes: [
|
||||
'centos-6.5',
|
||||
'ubuntu-10.04'
|
||||
]
|
||||
|
||||
- name: myclient55
|
||||
run_list:
|
||||
- recipe[mysql_database_test]
|
||||
attributes:
|
||||
mysql:
|
||||
version: '5.5'
|
||||
includes: [
|
||||
'centos-6.5',
|
||||
'debian-7.0',
|
||||
'ubuntu-12.04',
|
||||
'ubuntu-14.04'
|
||||
]
|
||||
|
||||
- name: myclient56
|
||||
run_list:
|
||||
- recipe[mysql_database_test]
|
||||
attributes:
|
||||
mysql:
|
||||
version: '5.6'
|
||||
includes: [
|
||||
'centos-5.8',
|
||||
'centos-6.5',
|
||||
'centos-7.0',
|
||||
'ubuntu-14.04'
|
||||
]
|
||||
|
||||
- name: myclient57
|
||||
run_list:
|
||||
- recipe[mysql_database_test]
|
||||
attributes:
|
||||
mysql:
|
||||
version: '5.7'
|
||||
includes: [
|
||||
'centos-5.8',
|
||||
'centos-6.5',
|
||||
'centos-7.0'
|
||||
]
|
33
cookbooks/database/.kitchen.yml
Normal file
33
cookbooks/database/.kitchen.yml
Normal file
@ -0,0 +1,33 @@
|
||||
---
|
||||
driver:
|
||||
name: vagrant
|
||||
|
||||
provisioner:
|
||||
name: chef_zero
|
||||
|
||||
platforms:
|
||||
- name: centos-5.11
|
||||
- name: centos-6.7
|
||||
- name: centos-7.1
|
||||
- name: debian-7.8
|
||||
run_list:
|
||||
- recipe[apt]
|
||||
- name: debian-8.1
|
||||
run_list:
|
||||
- recipe[apt]
|
||||
- name: fedora-21
|
||||
- name: ubuntu-12.04
|
||||
run_list:
|
||||
- recipe[apt]
|
||||
- name: ubuntu-14.04
|
||||
run_list:
|
||||
- recipe[apt]
|
||||
|
||||
suites:
|
||||
#
|
||||
# database-test
|
||||
#
|
||||
- name: default
|
||||
run_list:
|
||||
- recipe[mysql_database_test]
|
||||
- recipe[postgresql_database_test]
|
35
cookbooks/database/.rubocop.yml
Normal file
35
cookbooks/database/.rubocop.yml
Normal file
@ -0,0 +1,35 @@
|
||||
AllCops:
|
||||
Exclude:
|
||||
- vendor/**/*
|
||||
- 'Guardfile'
|
||||
|
||||
AlignParameters:
|
||||
Enabled: false
|
||||
|
||||
Encoding:
|
||||
Enabled: false
|
||||
|
||||
ClassLength:
|
||||
Enabled: false
|
||||
|
||||
MethodLength:
|
||||
Enabled: false
|
||||
|
||||
LineLength:
|
||||
Enabled: false
|
||||
|
||||
Documentation:
|
||||
Enabled: false
|
||||
|
||||
PerceivedComplexity:
|
||||
Enabled: false
|
||||
|
||||
CyclomaticComplexity:
|
||||
Enabled: false
|
||||
|
||||
Style/FileName:
|
||||
Enabled: false
|
||||
|
||||
Metrics/AbcSize:
|
||||
Enabled: false
|
||||
|
12
cookbooks/database/.travis.yml
Normal file
12
cookbooks/database/.travis.yml
Normal file
@ -0,0 +1,12 @@
|
||||
sudo: false
|
||||
cache: bundler
|
||||
language: ruby
|
||||
bundler_args: --without kitchen_common kitchen_vagrant
|
||||
rvm:
|
||||
- 2.0
|
||||
- 2.1
|
||||
- 2.2
|
||||
script:
|
||||
- bundle exec foodcritic -f any .
|
||||
- bundle exec rubocop
|
||||
- bundle exec rspec --color --format progress
|
12
cookbooks/database/Berksfile
Normal file
12
cookbooks/database/Berksfile
Normal file
@ -0,0 +1,12 @@
|
||||
source 'https://supermarket.chef.io'
|
||||
|
||||
metadata
|
||||
|
||||
group :integration do
|
||||
cookbook 'apt'
|
||||
cookbook 'selinux'
|
||||
cookbook 'mysql2_chef_gem'
|
||||
end
|
||||
|
||||
cookbook 'mysql_database_test', path: 'test/fixtures/cookbooks/mysql_database_test'
|
||||
cookbook 'postgresql_database_test', path: 'test/fixtures/cookbooks/postgresql_database_test'
|
@ -1,6 +1,34 @@
|
||||
Database cookbook README
|
||||
========================
|
||||
|
||||
v4.0.9 (2015-09-07)
|
||||
-------------------
|
||||
- Fix bad attribute name with postgresql_database in the readme
|
||||
- Add `flags` attribute to the mysql provider
|
||||
- Add `database` attribute to the mysql provider
|
||||
- Use the correct database with the mssql provider
|
||||
- Updated testing.md and contributing.md to point to documentation in the new community_cookbook_documentation repo
|
||||
- Add oracle as a supported platform in the metadata
|
||||
- Add source_url and issues_url metadata
|
||||
- Add cookbook version and travis badges to the readme
|
||||
- Clarify the minimum required Chef version in the readme
|
||||
- Add a Travis config
|
||||
- Resolve several rubocop and foodcritic warnings
|
||||
- Update all platforms in the Kitchen config
|
||||
- Update development dependencies to the latest releases
|
||||
- Add a maintainers.md and maintainers.toml file
|
||||
- Add a chefignore file
|
||||
- Update list of ignored files in the gitignore
|
||||
|
||||
v4.0.8 (2015-08-03)
|
||||
-------------------
|
||||
- #139 - Use a more reliable method of determining whether the
|
||||
Postgres server accepts the REPLICATION attribute on user creation.
|
||||
|
||||
v4.0.7 (2015-07-27)
|
||||
-------------------
|
||||
- #161 - Fixes multiple issues causing the MySQL database user creation to not be idempotent
|
||||
|
||||
v4.0.6 (2015-04-29)
|
||||
-------------------
|
||||
- #126 - Use sql_query property instead of sql in the mysql provider for :query action
|
||||
|
2
cookbooks/database/CONTRIBUTING.md
Normal file
2
cookbooks/database/CONTRIBUTING.md
Normal file
@ -0,0 +1,2 @@
|
||||
Please refer to
|
||||
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD
|
@ -2,14 +2,13 @@ source 'https://rubygems.org'
|
||||
|
||||
group :lint do
|
||||
gem 'foodcritic', '~> 4.0'
|
||||
gem 'rubocop', '~> 0.31'
|
||||
gem 'rubocop', '~> 0.33'
|
||||
gem 'rainbow', '< 2.0'
|
||||
gem 'rake'
|
||||
end
|
||||
|
||||
group :unit do
|
||||
gem 'berkshelf', '~> 3.2.0'
|
||||
gem 'chefspec', '~> 4.0'
|
||||
gem 'berkshelf', '~> 3.2'
|
||||
gem 'chefspec', '~> 4.3'
|
||||
end
|
||||
|
||||
group :kitchen_common do
|
||||
@ -23,6 +22,8 @@ end
|
||||
group :kitchen_cloud do
|
||||
gem 'kitchen-digitalocean'
|
||||
gem 'kitchen-ec2'
|
||||
gem 'kitchen-joyent'
|
||||
gem 'kitchen-gce'
|
||||
end
|
||||
|
||||
group :development do
|
||||
@ -34,4 +35,7 @@ group :development do
|
||||
gem 'guard-foodcritic'
|
||||
gem 'guard-rspec'
|
||||
gem 'guard-rubocop'
|
||||
gem 'rake'
|
||||
gem 'fauxhai'
|
||||
gem 'pry-nav'
|
||||
end
|
24
cookbooks/database/Guardfile
Normal file
24
cookbooks/database/Guardfile
Normal file
@ -0,0 +1,24 @@
|
||||
# More info at https://github.com/guard/guard#readme
|
||||
|
||||
guard 'foodcritic', :cookbook_paths => '.', :cli => '-t ~FC023 -t ~FC005', :all_on_start => false do
|
||||
watch(/attributes\/.+\.rb$/)
|
||||
watch(/providers\/.+\.rb$/)
|
||||
watch(/recipes\/.+\.rb$/)
|
||||
watch(/resources\/.+\.rb$/)
|
||||
watch('metadata.rb')
|
||||
end
|
||||
|
||||
guard 'rubocop' do
|
||||
watch(/attributes\/.+\.rb$/)
|
||||
watch(/providers\/.+\.rb$/)
|
||||
watch(/recipes\/.+\.rb$/)
|
||||
watch(/resources\/.+\.rb$/)
|
||||
watch('metadata.rb')
|
||||
end
|
||||
|
||||
guard :rspec, :cmd => 'chef exec /opt/chefdk/embedded/bin/rspec', :all_on_start => false, :notification => false do
|
||||
watch(/^libraries\/(.+)\.rb$/)
|
||||
watch(/^spec\/(.+)_spec\.rb$/)
|
||||
watch(/^(recipes)\/(.+)\.rb$/) { |m| "spec/#{m[1]}_spec.rb" }
|
||||
watch('spec/spec_helper.rb') { 'spec' }
|
||||
end
|
@ -186,7 +186,7 @@ APPENDIX: How to apply the Apache License to your work.
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
Copyright 2008-2015 Chef Software Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
19
cookbooks/database/MAINTAINERS.md
Normal file
19
cookbooks/database/MAINTAINERS.md
Normal file
@ -0,0 +1,19 @@
|
||||
<!-- This is a generated file. Please do not edit directly -->
|
||||
|
||||
# Maintainers
|
||||
This file lists how this cookbook project is maintained. When making changes to the system, this
|
||||
file tells you who needs to review your patch - you need a simple majority of maintainers
|
||||
for the relevant subsystems to provide a :+1: on your pull request. Additionally, you need
|
||||
to not receive a veto from a Lieutenant or the Project Lead.
|
||||
|
||||
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD)
|
||||
for details on the process and how to become a maintainer or the project lead.
|
||||
|
||||
# Project Maintainer
|
||||
* [Tim Smith](https://github.com/tas50)
|
||||
|
||||
# Maintainers
|
||||
* [Jennifer Davis](https://github.com/sigje)
|
||||
* [Sean OMeara](https://github.com/someara)
|
||||
* [Tim Smith](https://github.com/tas50)
|
||||
* [Thom May](https://github.com/thommay)
|
46
cookbooks/database/MAINTAINERS.toml
Normal file
46
cookbooks/database/MAINTAINERS.toml
Normal file
@ -0,0 +1,46 @@
|
||||
#
|
||||
# This file is structured to be consumed by both humans and computers.
|
||||
# It is a TOML document containing Markdown
|
||||
#
|
||||
[Preamble]
|
||||
title = "Maintainers"
|
||||
text = """
|
||||
This file lists how this cookbook project is maintained. When making changes to the system, this
|
||||
file tells you who needs to review your patch - you need a simple majority of maintainers
|
||||
for the relevant subsystems to provide a :+1: on your pull request. Additionally, you need
|
||||
to not receive a veto from a Lieutenant or the Project Lead.
|
||||
|
||||
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD)
|
||||
for details on the process and how to become a maintainer or the project lead.
|
||||
"""
|
||||
|
||||
[Org]
|
||||
[Org.Components]
|
||||
[Org.Components.Core]
|
||||
title = "Project Maintainer"
|
||||
|
||||
lieutenant = 'tas50'
|
||||
|
||||
maintainers = [
|
||||
'sigje',
|
||||
'someara',
|
||||
'tas50',
|
||||
'thommay'
|
||||
]
|
||||
|
||||
[people]
|
||||
[people.sigje]
|
||||
name = "Jennifer Davis"
|
||||
github = "sigje"
|
||||
|
||||
[people.someara]
|
||||
name = "Sean OMeara"
|
||||
github = "someara"
|
||||
|
||||
[people.tas50]
|
||||
name = "Tim Smith"
|
||||
github = "tas50"
|
||||
|
||||
[people.thommay]
|
||||
name = "Thom May"
|
||||
github = "thommay"
|
@ -1,5 +1,8 @@
|
||||
Database Cookbook
|
||||
=================
|
||||
[](http://travis-ci.org/opscode-cookbooks/database)
|
||||
[](https://supermarket.chef.io/cookbooks/database)
|
||||
|
||||
The main highlight of this cookbook is the `database` and
|
||||
`database_user` resources for managing databases and database users in
|
||||
a RDBMS. Providers for MySQL, PostgreSQL and SQL Server are also
|
||||
@ -7,11 +10,13 @@ provided, see usage documentation below.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
Chef version 0.11+
|
||||
|
||||
### Platforms
|
||||
- Debian, Ubuntu
|
||||
- Red Hat, CentOS, Scientific, Fedora, Amazon
|
||||
- Debian / Ubuntu derivatives
|
||||
- RHEL derivatives
|
||||
- Fedora
|
||||
|
||||
### Chef
|
||||
- Chef 11+
|
||||
|
||||
### Cookbooks
|
||||
The following Chef Software cookbooks are dependencies:
|
||||
|
@ -3,6 +3,8 @@ require 'rubocop/rake_task'
|
||||
require 'foodcritic'
|
||||
require 'kitchen'
|
||||
|
||||
require_relative 'tasks/maintainers'
|
||||
|
||||
# Style tests. Rubocop and Foodcritic
|
||||
namespace :style do
|
||||
desc 'Run Ruby style checks'
|
2
cookbooks/database/TESTING.md
Normal file
2
cookbooks/database/TESTING.md
Normal file
@ -0,0 +1,2 @@
|
||||
Please refer to
|
||||
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/TESTING.MD
|
@ -103,11 +103,11 @@ class Chef
|
||||
require 'mysql2'
|
||||
@test_client ||=
|
||||
Mysql2::Client.new(
|
||||
host: new_resource.connection[:host],
|
||||
socket: new_resource.connection[:socket],
|
||||
username: new_resource.connection[:username],
|
||||
password: new_resource.connection[:password],
|
||||
port: new_resource.connection[:port]
|
||||
host: new_resource.connection[:host],
|
||||
socket: new_resource.connection[:socket],
|
||||
username: new_resource.connection[:username],
|
||||
password: new_resource.connection[:password],
|
||||
port: new_resource.connection[:port]
|
||||
)
|
||||
end
|
||||
|
||||
@ -121,11 +121,11 @@ class Chef
|
||||
require 'mysql2'
|
||||
@repair_client ||=
|
||||
Mysql2::Client.new(
|
||||
host: new_resource.connection[:host],
|
||||
socket: new_resource.connection[:socket],
|
||||
username: new_resource.connection[:username],
|
||||
password: new_resource.connection[:password],
|
||||
port: new_resource.connection[:port]
|
||||
host: new_resource.connection[:host],
|
||||
socket: new_resource.connection[:socket],
|
||||
username: new_resource.connection[:username],
|
||||
password: new_resource.connection[:password],
|
||||
port: new_resource.connection[:port]
|
||||
)
|
||||
end
|
||||
|
||||
@ -139,11 +139,13 @@ class Chef
|
||||
require 'mysql2'
|
||||
@query_client ||=
|
||||
Mysql2::Client.new(
|
||||
host: new_resource.connection[:host],
|
||||
socket: new_resource.connection[:socket],
|
||||
username: new_resource.connection[:username],
|
||||
password: new_resource.connection[:password],
|
||||
port: new_resource.connection[:port]
|
||||
host: new_resource.connection[:host],
|
||||
socket: new_resource.connection[:socket],
|
||||
username: new_resource.connection[:username],
|
||||
password: new_resource.connection[:password],
|
||||
port: new_resource.connection[:port],
|
||||
flags: new_resource.connection[:flags],
|
||||
database: new_resource.database_name
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -94,21 +94,84 @@ class Chef
|
||||
|
||||
db_name = new_resource.database_name ? "`#{new_resource.database_name}`" : '*'
|
||||
tbl_name = new_resource.table ? new_resource.table : '*'
|
||||
test_table = new_resource.database_name ? 'mysql.db' : 'mysql.user'
|
||||
possible_global_privs = [
|
||||
:select,
|
||||
:insert,
|
||||
:update,
|
||||
:delete,
|
||||
:create,
|
||||
:drop,
|
||||
:references,
|
||||
:index,
|
||||
:alter,
|
||||
:create_tmp_table,
|
||||
:lock_tables,
|
||||
:create_view,
|
||||
:show_view,
|
||||
:create_routine,
|
||||
:alter_routine,
|
||||
:execute,
|
||||
:event,
|
||||
:trigger,
|
||||
:reload,
|
||||
:shutdown,
|
||||
:process,
|
||||
:file,
|
||||
:show_db,
|
||||
:super,
|
||||
:repl_slave,
|
||||
:repl_client,
|
||||
:create_user
|
||||
]
|
||||
possible_db_privs = [
|
||||
:select,
|
||||
:insert,
|
||||
:update,
|
||||
:delete,
|
||||
:create,
|
||||
:drop,
|
||||
:references,
|
||||
:index,
|
||||
:alter,
|
||||
:create_tmp_table,
|
||||
:lock_tables,
|
||||
:create_view,
|
||||
:show_view,
|
||||
:create_routine,
|
||||
:alter_routine,
|
||||
:execute,
|
||||
:event,
|
||||
:trigger
|
||||
]
|
||||
|
||||
if new_resource.privileges == [:all] && new_resource.database_name
|
||||
desired_privs = possible_db_privs
|
||||
elsif new_resource.privileges == [:all]
|
||||
desired_privs = possible_global_privs
|
||||
else
|
||||
desired_privs = new_resource.privileges
|
||||
end
|
||||
|
||||
# Test
|
||||
incorrect_privs = nil
|
||||
begin
|
||||
test_sql = 'SELECT * from mysql.db'
|
||||
test_sql = "SELECT * from #{test_table}"
|
||||
test_sql += " WHERE User='#{new_resource.username}'"
|
||||
test_sql += " AND Host='#{new_resource.host}'"
|
||||
test_sql += " AND Db='#{new_resource.database_name}'"
|
||||
test_sql += " AND Db='#{new_resource.database_name}'" if new_resource.database_name
|
||||
test_sql_results = test_client.query test_sql
|
||||
|
||||
incorrect_privs = true if test_sql_results.size == 0
|
||||
# These should all by 'Y'
|
||||
test_sql_results.each do |r|
|
||||
new_resource.privileges.each do |p|
|
||||
key = "#{p.capitalize}_priv"
|
||||
desired_privs.each do |p|
|
||||
key = "#{p.capitalize}"
|
||||
.gsub(' ', '_')
|
||||
.gsub('Replication_', 'Repl_')
|
||||
|
||||
key = "#{key}_priv"
|
||||
|
||||
incorrect_privs = true if r[key] != 'Y'
|
||||
end
|
||||
end
|
||||
@ -156,11 +219,11 @@ class Chef
|
||||
require 'mysql2'
|
||||
@test_client ||=
|
||||
Mysql2::Client.new(
|
||||
host: new_resource.connection[:host],
|
||||
socket: new_resource.connection[:socket],
|
||||
username: new_resource.connection[:username],
|
||||
password: new_resource.connection[:password],
|
||||
port: new_resource.connection[:port]
|
||||
host: new_resource.connection[:host],
|
||||
socket: new_resource.connection[:socket],
|
||||
username: new_resource.connection[:username],
|
||||
password: new_resource.connection[:password],
|
||||
port: new_resource.connection[:port]
|
||||
)
|
||||
end
|
||||
|
||||
@ -174,11 +237,11 @@ class Chef
|
||||
require 'mysql2'
|
||||
@repair_client ||=
|
||||
Mysql2::Client.new(
|
||||
host: new_resource.connection[:host],
|
||||
socket: new_resource.connection[:socket],
|
||||
username: new_resource.connection[:username],
|
||||
password: new_resource.connection[:password],
|
||||
port: new_resource.connection[:port]
|
||||
host: new_resource.connection[:host],
|
||||
socket: new_resource.connection[:socket],
|
||||
username: new_resource.connection[:username],
|
||||
password: new_resource.connection[:password],
|
||||
port: new_resource.connection[:port]
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -41,9 +41,7 @@ class Chef
|
||||
unless exists?
|
||||
begin
|
||||
encoding = @new_resource.encoding
|
||||
if encoding != 'DEFAULT'
|
||||
encoding = "'#{@new_resource.encoding}'"
|
||||
end
|
||||
encoding = "'#{@new_resource.encoding}'" if encoding != 'DEFAULT'
|
||||
Chef::Log.debug("#{@new_resource}: Creating database #{new_resource.database_name}")
|
||||
create_sql = "CREATE DATABASE \"#{new_resource.database_name}\""
|
||||
create_sql += " TEMPLATE = #{new_resource.template}" if new_resource.template
|
||||
@ -100,14 +98,15 @@ class Chef
|
||||
ret
|
||||
end
|
||||
|
||||
# Test if text is psql keyword
|
||||
def keyword?(text)
|
||||
# Verify the postgres server's version number is greater than the integer passed in
|
||||
def version_greater_than?(desired_version_int)
|
||||
begin
|
||||
result = db('template1').exec_params('select * from pg_get_keywords() where word = $1', [text.downcase]).num_tuples != 0
|
||||
ret = db('template1').exec('SHOW server_version_num;')
|
||||
server_version_int = ret.getvalue(0, 0).to_i
|
||||
ensure
|
||||
close
|
||||
end
|
||||
result
|
||||
server_version_int > desired_version_int
|
||||
end
|
||||
|
||||
#
|
||||
@ -124,7 +123,7 @@ class Chef
|
||||
port = @new_resource.connection[:port] || 5432
|
||||
user = @new_resource.connection[:username] || 'postgres'
|
||||
Chef::Log.debug("#{@new_resource}: connecting to database #{dbname} on #{host}:#{port} as #{user}")
|
||||
password = @new_resource.connection[:password] || node[:postgresql][:password][:postgres]
|
||||
password = @new_resource.connection[:password] || node['postgresql']['password']['postgres']
|
||||
@db = ::PGconn.new(
|
||||
host: host,
|
||||
port: port,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user