1 Commits

Author SHA1 Message Date
26db8597fd Configure Vagrant for dirsrv 2020-12-08 13:24:54 +01:00
503 changed files with 4537 additions and 18163 deletions

View File

@@ -26,5 +26,5 @@ knife[:automatic_attribute_whitelist] = %w[
chef_packages
]
knife[:default_attribute_whitelist] = []
knife[:normal_attribute_whitelist] = ['knife_zero','kosmos-ejabberd']
knife[:normal_attribute_whitelist] = ['knife_zero']
knife[:override_attribute_whitelist] = []

2
.gitignore vendored
View File

@@ -1,6 +1,4 @@
/.chef/encrypted_data_bag_secret
.chef/chef_guid
/.bundle/
/.vagrant/
/.kitchen
/nodes/vagrant-node.json

View File

@@ -1 +0,0 @@
chef-workstation

View File

@@ -8,7 +8,6 @@ cookbook 'mediawiki',
cookbook 'redis',
git: 'https://github.com/phlipper/chef-redis.git',
ref: 'v0.5.6'
cookbook 'redisio', '= 5.0.0' # TODO upgrade to 6.x when we use Chef 16
cookbook 'postfix', '= 5.0.2'
cookbook 'php', '~> 8.0.0'
cookbook 'composer', '~> 2.7.0'
@@ -33,9 +32,9 @@ cookbook 'mysql', '~> 8.7.3'
# cookbook 'postgresql', '= 7.1.8'
cookbook 'apt', '~> 7.3.0'
cookbook 'git', '~> 10.0.0'
cookbook 'hostsfile', '~> 3.0.1'
cookbook 'hostsfile', '= 2.4.5'
cookbook 'ohai', '~> 5.2.5'
cookbook 'nodejs', '~> 7.3.1'
cookbook 'nodejs', '~> 5.0.0'
cookbook 'timezone_iii', '= 1.0.4'
cookbook 'ark', '>= 5.0.0'
cookbook 'logrotate', '= 2.2.0'
@@ -52,5 +51,4 @@ cookbook 'ipfs',
cookbook 'elasticsearch', '= 4.2.0'
cookbook 'java', '~> 4.3.0'
cookbook 'ulimit', '~> 1.0.0'
cookbook 'golang', '~> 5.3.1'
cookbook 'zerotier', '~> 1.0.7'
cookbook 'golang', '~> 4.1.0'

View File

@@ -12,10 +12,10 @@ DEPENDENCIES
elasticsearch (= 4.2.0)
firewall (~> 2.6.3)
git (~> 10.0.0)
golang (~> 5.3.1)
golang (~> 4.1.0)
homebrew (= 3.0.0)
hostname (= 0.4.2)
hostsfile (~> 3.0.1)
hostsfile (= 2.4.5)
ipfs
git: https://gitea.kosmos.org/kosmos/ipfs-cookbook.git
revision: d7c25b6ce5fa490b6de3529fdc163fb64f1ece8a
@@ -29,7 +29,7 @@ DEPENDENCIES
ref: nginx
mysql (~> 8.7.3)
nginx (= 9.0.0)
nodejs (~> 7.3.1)
nodejs (~> 5.0.0)
ntp (= 3.4.0)
ohai (~> 5.2.5)
openssl (~> 8.5.5)
@@ -48,11 +48,9 @@ DEPENDENCIES
git: https://github.com/phlipper/chef-redis.git
revision: 7476279fc9c8727f082b8d77b5e1922dc2ef437b
ref: v0.5.6
redisio (= 5.0.0)
timezone_iii (= 1.0.4)
ulimit (~> 1.0.0)
users (~> 5.3.1)
zerotier (~> 1.0.7)
GRAPH
apache2 (3.3.0)
@@ -69,13 +67,12 @@ GRAPH
poise-javascript (~> 1.0)
poise-service (~> 1.0)
apt (7.3.0)
ark (6.0.3)
seven_zip (>= 3.1)
ark (5.0.0)
seven_zip (>= 0.0.0)
build-essential (8.2.1)
mingw (>= 1.1)
seven_zip (>= 0.0.0)
chef-sugar (3.3.0)
chocolatey (3.0.0)
compat_resource (12.19.0)
composer (2.7.0)
apt (>= 0.0.0)
@@ -89,12 +86,12 @@ GRAPH
firewall (2.6.5)
chef-sugar (>= 0.0.0)
git (10.0.0)
golang (5.3.1)
ark (>= 6.0)
golang (4.1.0)
ark (~> 5.0)
homebrew (3.0.0)
hostname (0.4.2)
hostsfile (>= 0.0.0)
hostsfile (3.0.1)
hostsfile (2.4.5)
ipfs (0.7.0)
ark (>= 0.0.0)
java (4.3.0)
@@ -109,20 +106,20 @@ GRAPH
apache2 (>= 0.0.0)
nginx (>= 0.0.0)
php (>= 0.0.0)
mingw (2.1.3)
mingw (2.1.0)
seven_zip (>= 0.0.0)
mysql (8.7.4)
mysql (8.7.3)
nginx (9.0.0)
build-essential (>= 5.0)
ohai (>= 4.1.0)
yum-epel (>= 0.0.0)
nodejs (7.3.3)
nodejs (5.0.0)
ark (>= 2.0.2)
chocolatey (>= 3.0)
build-essential (>= 0.0.0)
ntp (3.4.0)
ohai (5.2.5)
openssl (8.5.5)
php (8.0.1)
php (8.0.0)
yum-epel (>= 0.0.0)
poise (2.8.2)
poise-archive (1.5.0)
@@ -151,16 +148,11 @@ GRAPH
postfix (5.0.2)
redis (0.5.6)
apt (>= 0.0.0)
redisio (5.0.0)
selinux_policy (>= 2.2.0)
ulimit (>= 0.1.2)
selinux_policy (2.4.3)
seven_zip (4.2.2)
seven_zip (3.1.1)
windows (>= 0.0.0)
timezone_iii (1.0.4)
ulimit (1.0.0)
users (5.3.1)
windows (7.0.2)
yum (7.2.0)
yum-epel (4.2.3)
zerotier (1.0.7)
ohai (>= 0.0.0)
windows (6.0.0)
yum (5.1.0)
yum-epel (3.3.0)

View File

@@ -1,3 +1,7 @@
source 'https://rubygems.org'
gem 'knife-zero', '>= 2.4.2'
gem 'chef', '~> 15.3.14'
gem 'berkshelf', '~> 7.0'
gem 'knife-zero'
gem 'cookstyle'
gem 'test-kitchen'

View File

@@ -1,315 +1,255 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.0)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
aws-eventstream (1.2.0)
aws-partitions (1.551.0)
aws-sdk-core (3.125.6)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.525.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.53.0)
aws-sdk-core (~> 3, >= 3.125.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.111.3)
aws-sdk-core (~> 3, >= 3.125.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
aws-sdk-secretsmanager (1.56.0)
aws-sdk-core (~> 3, >= 3.125.0)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.4.0)
aws-eventstream (~> 1, >= 1.0.2)
bcrypt_pbkdf (1.1.0)
builder (3.2.4)
chef (17.9.42)
addressable
aws-sdk-s3 (~> 1.91)
aws-sdk-secretsmanager (~> 1.46)
chef-config (= 17.9.42)
chef-utils (= 17.9.42)
chef-vault
chef-zero (>= 14.0.11)
corefoundation (~> 0.3.4)
diff-lcs (>= 1.2.4, < 1.4.0)
erubis (~> 2.7)
ffi (>= 1.5.0)
ffi-libarchive (~> 1.0, >= 1.0.3)
ffi-yajl (~> 2.2)
iniparse (~> 1.4)
inspec-core (~> 4.23)
license-acceptance (>= 1.0.5, < 3)
ast (2.4.0)
bcrypt_pbkdf (1.0.1)
berkshelf (7.0.8)
chef (>= 13.6.52)
chef-config
cleanroom (~> 1.0)
concurrent-ruby (~> 1.0)
minitar (>= 0.6)
mixlib-archive (>= 0.4, < 2.0)
mixlib-authentication (>= 2.1, < 4)
mixlib-config (>= 2.2.5)
mixlib-shellout (>= 2.0, < 4.0)
octokit (~> 4.0)
retryable (>= 2.0, < 4.0)
solve (~> 4.0)
thor (>= 0.20)
builder (3.2.3)
chef (15.3.14)
addressable
bcrypt_pbkdf (~> 1.0)
bundler (>= 1.10)
chef-config (= 15.3.14)
chef-zero (>= 14.0.11)
diff-lcs (~> 1.2, >= 1.2.4)
ed25519 (~> 1.2)
erubis (~> 2.7)
ffi (~> 1.9, >= 1.9.25)
ffi-libarchive
ffi-yajl (~> 2.2)
highline (>= 1.6.9, < 2)
iniparse (~> 1.4)
license-acceptance (~> 1.0, >= 1.0.5)
mixlib-archive (>= 0.4, < 2.0)
mixlib-authentication (~> 2.1)
mixlib-cli (>= 2.1.1, < 3.0)
mixlib-log (>= 2.0.3, < 4.0)
mixlib-shellout (>= 3.1.1, < 4.0)
net-sftp (>= 2.1.2, < 4.0)
ohai (~> 17.0)
mixlib-shellout (>= 3.0.3, < 4.0)
net-sftp (~> 2.1, >= 2.1.2)
net-ssh (>= 4.2, < 6)
net-ssh-multi (~> 1.2, >= 1.2.1)
ohai (~> 15.0)
plist (~> 3.2)
proxifier (~> 1.0)
syslog-logger (~> 1.6)
train-core (~> 3.2, >= 3.2.28)
train-winrm (>= 0.2.5)
uuidtools (>= 2.1.5, < 3.0)
vault (~> 0.16)
chef-config (17.9.42)
train-core (~> 3.0)
train-winrm
tty-screen (~> 0.6)
uuidtools (~> 2.1.5)
chef-config (15.3.14)
addressable
chef-utils (= 17.9.42)
fuzzyurl
mixlib-config (>= 2.2.12, < 4.0)
mixlib-shellout (>= 2.0, < 4.0)
tomlrb (~> 1.2)
chef-telemetry (1.1.1)
chef-config
concurrent-ruby (~> 1.0)
chef-utils (17.9.42)
concurrent-ruby
chef-vault (4.1.5)
chef-zero (15.0.11)
chef-zero (14.0.13)
ffi-yajl (~> 2.2)
hashie (>= 2.0, < 5.0)
hashie (>= 2.0, < 4.0)
mixlib-log (>= 2.0, < 4.0)
rack (~> 2.0, >= 2.0.6)
uuidtools (~> 2.1)
webrick
coderay (1.1.3)
concurrent-ruby (1.1.9)
corefoundation (0.3.10)
ffi (>= 1.15.0)
cleanroom (1.0.0)
concurrent-ruby (1.1.5)
cookstyle (5.7.0)
rubocop (= 0.72.0)
diff-lcs (1.3)
erubi (1.10.0)
ed25519 (1.2.4)
equatable (0.6.1)
erubis (2.7.0)
faraday (1.4.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.1)
faraday (0.17.0)
multipart-post (>= 1.2, < 3)
ruby2_keywords (>= 0.0.4)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday_middleware (1.2.0)
faraday (~> 1.0)
ffi (1.15.5)
ffi-libarchive (1.1.3)
ffi (1.11.1)
ffi-libarchive (0.4.10)
ffi (~> 1.0)
ffi-yajl (2.4.0)
libyajl2 (>= 1.2)
ffi-yajl (2.3.1)
libyajl2 (~> 1.2)
fuzzyurl (0.9.0)
gssapi (1.3.1)
gssapi (1.3.0)
ffi (>= 1.0.1)
gyoku (1.3.1)
builder (>= 2.1.2)
hashie (4.1.0)
highline (2.0.3)
hashie (3.6.0)
highline (1.7.10)
httpclient (2.8.3)
iniparse (1.5.0)
inspec-core (4.52.9)
addressable (~> 2.4)
chef-telemetry (~> 1.0, >= 1.0.8)
faraday (>= 0.9.0, < 1.5)
faraday_middleware (~> 1.0)
hashie (>= 3.4, < 5.0)
license-acceptance (>= 0.2.13, < 3.0)
method_source (>= 0.8, < 2.0)
mixlib-log (~> 3.0)
multipart-post (~> 2.0)
parallel (~> 1.9)
parslet (>= 1.5, < 2.0)
pry (~> 0.13)
rspec (>= 3.9, < 3.11)
rspec-its (~> 1.2)
rubyzip (>= 1.2.2, < 3.0)
semverse (~> 3.0)
sslshake (~> 1.2)
thor (>= 0.20, < 2.0)
tomlrb (>= 1.2, < 2.1)
train-core (~> 3.0)
tty-prompt (~> 0.17)
tty-table (~> 0.10)
iniparse (1.4.4)
ipaddress (0.8.3)
jmespath (1.5.0)
json (2.6.1)
knife (17.9.26)
bcrypt_pbkdf (~> 1.1)
chef (>= 17)
chef-config (>= 17)
chef-utils (>= 17)
chef-vault
erubis (~> 2.7)
ffi (>= 1.15)
ffi-yajl (~> 2.2)
highline (>= 1.6.9, < 3)
license-acceptance (>= 1.0.5, < 3)
mixlib-archive (>= 0.4, < 2.0)
mixlib-cli (>= 2.1.1, < 3.0)
net-ssh (>= 5.1, < 7)
net-ssh-multi (~> 1.2, >= 1.2.1)
ohai (~> 17.0)
pastel
train-core (~> 3.2, >= 3.2.28)
train-winrm (>= 0.2.5)
tty-prompt (~> 0.21)
tty-screen (~> 0.6)
tty-table (~> 0.11)
knife-zero (2.4.2)
jaro_winkler (1.5.3)
json (2.2.0)
knife-zero (2.1.0)
chef (>= 15.0)
knife (>= 17.0)
libyajl2 (2.1.0)
license-acceptance (2.1.13)
libyajl2 (1.2.0)
license-acceptance (1.0.13)
pastel (~> 0.7)
tomlrb (>= 1.2, < 3.0)
tty-box (~> 0.6)
tty-prompt (~> 0.20)
tomlrb (~> 1.2)
tty-box (~> 0.3)
tty-prompt (~> 0.18)
little-plugger (1.1.4)
logging (2.3.0)
logging (2.2.2)
little-plugger (~> 1.1)
multi_json (~> 1.14)
method_source (1.0.0)
mixlib-archive (1.1.7)
multi_json (~> 1.10)
minitar (0.9)
mixlib-archive (1.0.1)
mixlib-log
mixlib-authentication (3.0.10)
mixlib-cli (2.1.8)
mixlib-config (3.0.9)
mixlib-authentication (2.1.1)
mixlib-cli (2.1.1)
mixlib-config (3.0.1)
tomlrb
mixlib-log (3.0.9)
mixlib-shellout (3.2.5)
chef-utils
multi_json (1.15.0)
mixlib-install (3.11.21)
mixlib-shellout
mixlib-versioning
thor
mixlib-log (3.0.1)
mixlib-shellout (3.0.7)
mixlib-versioning (1.2.7)
molinillo (0.6.6)
multi_json (1.13.1)
multipart-post (2.1.1)
net-scp (3.0.0)
net-ssh (>= 2.6.5, < 7.0.0)
net-sftp (3.0.0)
net-ssh (>= 5.0.0, < 7.0.0)
net-ssh (6.1.0)
necromancer (0.5.0)
net-scp (2.0.0)
net-ssh (>= 2.6.5, < 6.0.0)
net-sftp (2.1.2)
net-ssh (>= 2.6.5)
net-ssh (5.2.0)
net-ssh-gateway (2.0.0)
net-ssh (>= 4.0.0)
net-ssh-multi (1.2.1)
net-ssh (>= 2.6.5)
net-ssh-gateway (>= 1.2.0)
nori (2.6.0)
ohai (17.9.0)
chef-config (>= 14.12, < 18)
chef-utils (>= 16.0, < 18)
octokit (4.14.0)
sawyer (~> 0.8.0, >= 0.5.3)
ohai (15.3.1)
chef-config (>= 12.8, < 16)
ffi (~> 1.9)
ffi-yajl (~> 2.2)
ipaddress
mixlib-cli (>= 1.7.0)
mixlib-config (>= 2.0, < 4.0)
mixlib-log (>= 2.0.1, < 4.0)
mixlib-shellout (~> 3.2, >= 3.2.5)
mixlib-shellout (>= 2.0, < 4.0)
plist (~> 3.1)
train-core
systemu (~> 2.6.4)
wmi-lite (~> 1.0)
parallel (1.21.0)
parslet (1.8.2)
pastel (0.8.0)
parallel (1.18.0)
parser (2.6.5.0)
ast (~> 2.4.0)
pastel (0.7.3)
equatable (~> 0.6)
tty-color (~> 0.5)
plist (3.6.0)
plist (3.5.0)
proxifier (1.0.3)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (4.0.6)
rack (2.2.3)
rspec (3.10.0)
rspec-core (~> 3.10.0)
rspec-expectations (~> 3.10.0)
rspec-mocks (~> 3.10.0)
rspec-core (3.10.2)
rspec-support (~> 3.10.0)
rspec-expectations (3.10.2)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-its (1.3.0)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
rspec-mocks (3.10.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.10.0)
rspec-support (3.10.3)
ruby2_keywords (0.0.5)
rubyntlm (0.6.3)
rubyzip (2.3.2)
public_suffix (4.0.1)
rack (2.0.7)
rainbow (3.0.0)
retryable (3.0.4)
rubocop (0.72.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.6)
rainbow (>= 2.2.2, < 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 1.7)
ruby-progressbar (1.10.1)
rubyntlm (0.6.2)
rubyzip (1.3.0)
sawyer (0.8.2)
addressable (>= 2.3.5)
faraday (> 0.8, < 2.0)
semverse (3.0.0)
sslshake (1.3.1)
strings (0.2.1)
strings-ansi (~> 0.2)
unicode-display_width (>= 1.5, < 3.0)
solve (4.0.2)
molinillo (~> 0.6)
semverse (>= 1.1, < 4.0)
strings (0.1.6)
strings-ansi (~> 0.1)
unicode-display_width (~> 1.5)
unicode_utils (~> 1.4)
strings-ansi (0.2.0)
strings-ansi (0.1.0)
syslog-logger (1.6.8)
thor (1.2.1)
tomlrb (1.3.0)
train-core (3.8.7)
addressable (~> 2.5)
ffi (!= 1.13.0)
systemu (2.6.5)
test-kitchen (2.3.3)
bcrypt_pbkdf (~> 1.0)
ed25519 (~> 1.2)
license-acceptance (~> 1.0, >= 1.0.11)
mixlib-install (~> 3.6)
mixlib-shellout (>= 1.2, < 4.0)
net-scp (>= 1.1, < 3.0)
net-ssh (>= 2.9, < 6.0)
net-ssh-gateway (>= 1.2, < 3.0)
thor (~> 0.19)
winrm (~> 2.0)
winrm-elevated (~> 1.0)
winrm-fs (~> 1.1)
thor (0.20.3)
tomlrb (1.2.8)
train-core (3.1.3)
json (>= 1.8, < 3.0)
mixlib-shellout (>= 2.0, < 4.0)
net-scp (>= 1.2, < 4.0)
net-ssh (>= 2.9, < 7.0)
train-winrm (0.2.12)
winrm (>= 2.3.6, < 3.0)
winrm-elevated (~> 1.2.2)
net-scp (>= 1.2, < 3.0)
net-ssh (>= 2.9, < 6.0)
train-winrm (0.2.5)
winrm (~> 2.0)
winrm-fs (~> 1.0)
tty-box (0.7.0)
pastel (~> 0.8)
strings (~> 0.2.0)
tty-box (0.4.1)
pastel (~> 0.7.2)
strings (~> 0.1.6)
tty-cursor (~> 0.7)
tty-color (0.6.0)
tty-cursor (0.7.1)
tty-prompt (0.23.1)
pastel (~> 0.8)
tty-reader (~> 0.8)
tty-reader (0.9.0)
tty-color (0.5.0)
tty-cursor (0.7.0)
tty-prompt (0.19.0)
necromancer (~> 0.5.0)
pastel (~> 0.7.0)
tty-reader (~> 0.6.0)
tty-reader (0.6.0)
tty-cursor (~> 0.7)
tty-screen (~> 0.8)
wisper (~> 2.0)
tty-screen (0.8.1)
tty-table (0.12.0)
pastel (~> 0.8)
strings (~> 0.2.0)
tty-screen (~> 0.8)
unicode-display_width (2.1.0)
tty-screen (~> 0.7)
wisper (~> 2.0.0)
tty-screen (0.7.0)
unicode-display_width (1.6.0)
unicode_utils (1.4.0)
uuidtools (2.2.0)
vault (0.16.0)
aws-sigv4
webrick (1.7.0)
winrm (2.3.6)
uuidtools (2.1.5)
winrm (2.3.2)
builder (>= 2.1.2)
erubi (~> 1.8)
erubis (~> 2.7)
gssapi (~> 1.2)
gyoku (~> 1.0)
httpclient (~> 2.2, >= 2.2.0.2)
logging (>= 1.6.1, < 3.0)
nori (~> 2.0)
rubyntlm (~> 0.6.0, >= 0.6.3)
winrm-elevated (1.2.3)
erubi (~> 1.8)
rubyntlm (~> 0.6.0, >= 0.6.1)
winrm-elevated (1.1.1)
winrm (~> 2.0)
winrm-fs (~> 1.0)
winrm-fs (1.3.5)
erubi (~> 1.8)
winrm-fs (1.3.2)
erubis (~> 2.7)
logging (>= 1.6.1, < 3.0)
rubyzip (~> 2.0)
rubyzip (~> 1.1)
winrm (~> 2.0)
wisper (2.0.1)
wmi-lite (1.0.5)
wisper (2.0.0)
wmi-lite (1.0.2)
PLATFORMS
x86_64-darwin-18
x86_64-linux
ruby
DEPENDENCIES
knife-zero (>= 2.4.2)
berkshelf (~> 7.0)
chef (~> 15.3.14)
cookstyle
knife-zero
test-kitchen
BUNDLED WITH
2.2.15
1.17.3

View File

@@ -1,38 +1,19 @@
### Install Chef Workstation
* macOS, Windows, RHEL, Ubuntu: https://docs.chef.io/workstation/install_workstation/
* Arch Linux: https://aur.archlinux.org/packages/chef-workstation
#### rbenv
If you use rbenv to manage Ruby versions on your system, install the
(rbenv-chef-workstation)[https://github.com/docwhat/rbenv-chef-workstation]
plugin.
### Install gem dependencies
### Install dependencies
bundle install
### Bootstrap a new server
knife zero bootstrap root@dev.kosmos.org --run-list "recipe[kosmos-base],..." -j '{"example_cookbook":{"memory_max":"256M"}}' --secret-file .chef/encrypted_data_bag_secret
### Bootstrap a new VM
knife zero bootstrap ubuntu@zerotier-ip-address -x ubuntu --sudo --run-list "recipe[kosmos-base]" --secret-file .chef/encrypted_data_bag_secret
### Run Chef Zero
### Run Chef Solo
knife zero converge name:dev.kosmos.org
### Run Chef Zero on a VM
knife zero converge -a knife_zero.host name:vm-name-23
### Update Chef Client on a server:
knife zero converge name:dev.kosmos.org --client-version 15.3.14
### Bootstrap a new server
knife zero bootstrap root@dev.kosmos.org --run-list "recipe[kosmos-base],..." -j '{"example_cookbook":{"memory_max":"256M"}}' --secret-file .chef/encrypted_data_bag_secret
### Managing cookbooks
Cookbooks are managed via Berkshelf. Run `berks --help` for command help.
@@ -44,14 +25,3 @@ Install cookbooks listed in Berksfile:
Vendor installed cookbooks to the `cookbooks/` dir:
berks vendor cookbooks/ --delete
### "Expired" TLS certificates
If you encounter expired TLS certificates during a Chef run (e.g. for remote
files), the issue is likely that the certificate has been issued by Let's
Encrypt and Chef is still using its own, outdated CA cert store (see
[here](https://github.com/chef/chef/issues/12126#issuecomment-932067530) for
example).
As a hotfix, you can manually remove the "DST Root CA X3" cert from
`/opt/chef/embedded/ssl/cert.pem` on the machine you're trying to converge.

2
Vagrantfile vendored
View File

@@ -39,7 +39,7 @@ Vagrant.configure(2) do |config|
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network "private_network", ip: "192.168.56.5"
config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on

View File

@@ -0,0 +1,4 @@
{
"name": "andromeda.kosmos.org",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuAI/4XcdJQ4rL3JtQ86Q\nUtdFSBdMnSPxUoHbhXXTaFEB2D0hqyCjfGmt8JqoBaRmj0zNHQvOMixe+SeyfyDs\nDPHQZ5E45f0eBYPchvOjNOZTP6RYhfa1pBRW6D6JJ+2bYW1jfnTur1Tkeg0ZL6zg\nybmcsYeDYeNXEsAGQIz+zqgNHPsTLL7U+eY9u3AYhOPaBXSnaqxPxvYx9fBRWbrx\ntFz/oXjurvLS5rMhts0s6AyMKEs+5bLhSreqGsh+1CfAt2qGNPPY7J5VL1B+cAfk\nFWYD5uWo2NvYKm94UpKsmZgFKFQBglFYpMidYdbl/NNJFq3EJDRyRlzDB8VliOuG\nnwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "discourse-1",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxJBhKUtTcmjP8eG4aLNF\n9UfNU9lRIFhfywjFJjtXoYdNaUatZHE3s1HKND0SjJs5BRQbZBEKLxTHCgnPZD4U\nlRgZ65JtHwi+JNM6ac4TQm5JYKA++KxX7FtOiJV6oGX6foNoFVHrGi+fhTlLE9hL\npHRQWTpM8ErpUEj3VHez+k6KT1Mr3QO5T9L5kqu1BdTYwtyfXJE0VfyDKz/rwrvc\ngPvZd167p8YCTu/rWLG9X8tag+ySUR9cmlEn5sCsBLmq56Zurf0VIe/0tuGPI8DP\nAVc4dIXHsfGuKLwBfFPSDy9YbI7F8gbaD05UnUVn60IWPmWsE19K/iIc/OnJZwRO\nkQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "discourse-2",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwinJNGMUzUdrZwx/ZCkU\nxZRnuWqZHXHdZtkEG6beMY1sB/PpGknLgcfTjhh4FR/5hIXqBcVdUj3DZiTmhd8o\n0QpEkJPNKd08PN12CyShPwCcIA1KTqsCsNys+bp6Wff84JClAe/Oza6DonoRmhqO\ncFxSQcscuv8a6Gc/1X/aySmS01hwL+r9p0VZBEPNKEObgJXHsGIIbajlxgq037X/\n2/IsIk2etXTUSWPJLxNKSXzxC3l4Izw4NfvUgipByPTeJQ2YAVxbvrDEqquBGk5S\nll/mlF+fKX0QvUhm7sdLiSy++rHc8R1ny+4LnR1gAOscYMuLbDbpJnW0Rc0GEJOL\nVwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "drone-1",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0DLEt7jfKPH7X7pBknG3\nWoB6Q6Vffl6Q0GRxQiMJ1uRC79dulKH097CYfLzIXFZD9gRRP4K78vW5BA2spXVV\nn3qrak9JT6BGgdFrkBEdMNGZyz814aMiyhPZrQUrmIzyH8R04xZgv7UH86qdNQ5p\nPeIXS7gU7/0PmwRgEBiM1KLq+Kba6pYdGefKqxx5D59xweH+yE+rbd5ac9xn2GP7\nyOiZoG2sMuksq7d3O4SeTS2lBAmG5IeiP2iWvHWpZD48PTr78ItkTgIbaqZU2PXV\ng+2OcJPTel5xISooe5FvW8gdpC9SYoBPvgJuJ6czc1+LdUSK7pE7577eAJNDlh+H\nRwIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/ejabberd-1.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "ejabberd-1",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtoVmQAEmmAWjjzi5X8Ia\n9sl2aH8Lh0AsckM0aE3hvw9lGfbNCPpYWrr0uh7R6/+13Z0OghrT3yDAZ+XfH39Y\nuGomazTzSMMOEofjepo+nXSgq4meFfX5vobYG7rpBdz1EsIT1bElHduItA2zsw9J\nFpXtGd4BjumMq1VykSTA+QaEE8byes/+groQTtXPqXf5gJMxyGlh4SU0MzmkGHaW\n8c9BPCQrV0CMiuGOGJ5mZ28HajbvSg3+bpgwThh3M5uQaQ6on1N2pvJuBypUySS6\nyc4TauocUcUsULYXq9wM8/rqDYsUah0PR0WSiOi90m5thGeBchFAmhdCvrS34FlR\nVQIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/ejabberd-2.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "ejabberd-2",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAudueTsPYnRXRu/rmMGZe\nI7LdyrWKdY9FJaRhkXR5J9Yb8QnIcDS7ZXDJsVhyQW8pZ2DuaIs5dmGYvRtmx0ol\nqHTEel01Q3/xI1blJoq4uRm639PB5M9dSJ0w+s6P5zj7rbFKpvMBYxBSK6z+gXIc\n/L1ayJ6JOssX5/tEvcvx/d4GIxof/Q+puACAXawx7W88Wl7yYWdBQ78uTPHzuMyB\n8BRYz24tki/O1fa9JijW32d3EELD0EccI3iJ+/CR4BFEEM2QdDczY/Q6Ny7h7inH\n/TdU246nvtJIx7bAZHmDIDva8YPtL27RIOQ3JqBBe7prQP5Q9MBGPyCXWAglj99a\n6QIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "ejabberd-4",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6FuI13W2sft83OIWe59/\nYTfpTfKcYTCq5zAQEu87OYHHQeBAYo0W/g/qICh3qw0ie2QMPyggAezoeR5VQdLt\nkJq1X9AHqyX59YThzj7dLCCEKq+mAdriuKzNGu8eml4DRM3m+xw7jFzcwwrD8ECZ\nY+Kn7bcOtozx0mXpEm+cO2cOKmRQn0VJwAQSe6eW301iGmpR9et4hDqMjhiUiwaU\nWAqpsmP/JQMLAX2gLzwilD63VCQlcQCDq/D1m/N6bWb1L47zNAzwOCSYV92bGNDe\nRe+4gCVVLpfGWKbkjQFDraCmME7+O50WpbfowylF8gOzgl3AvnpC/LOSzT8VtMPr\nZQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "ejabberd-6",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqvGOanDqJOhf0xl/TYcs\nqYhhGz4ptFzxmfxiCMWbnbDcICBLHni28dJHhP2ggfUKOGcp+OIqiy783eRUrPsf\nnH9VmvTnz4NdXIB5J45FgBtfYiF9ZseaPL+ufTSCbZj7Ih3lzTAbO5Ug+UOj852B\nnnqH2Ht2jXMp2v3NW4gAG9QyRpr6P5cyVWBrMFExjuhNWg119tJv+33oGnflrNRi\njV3yGbRFRpqAomAVCr6DAA9SX/R8J3yKTky6MdRGrXKH/7eXH0ehDi33Y9Pyy9Ci\nkQX/JRHffuJeBF3Tndiojqdx81C6oIh2s/H3JMew/DdRxjzlPP4nemYWXv1/YVcS\nCwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "ejabberd-7",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzHfqcI/6w58gLwDFCKxw\n0TeKFOf4MFBnmUGsWyi8BEskkjh4QEDc4pUFeiVuEADFyBfCnALWh004nKhiwamc\nECybfAKlJryoQQEcYZC6H4rZf3SW7xPLk12X00YySNroYM50PM5Ly/G7MI9a669g\n6HNOgn1MYIEh8unpsAHjfKpx72bNutRYKKvBDaHXNvlJ459Jr8HNpERFk8IeaGcF\n4BKqf/MNxkQHOfy7R4ETXeLUBrgD13SmLbs6mM3lXS6IgkoeFyAvAPP4ZgwgiJ6w\nqIKsX4cRt8xnJJ+MTNBX4oc0f9+Gu8bUpr2JZ8tcwq3GUgDjv+JSJpk/uDzzbQUe\nIwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "ejabberd-8",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2r+emfhx7bl7MxEeIDGY\nKnj3xEyFvVgXL7GwOsbKszFVgZ17yuPwa6vuiJsZsbcFC/nXgGNH2WF5FEv7XhOi\nwE8KMeNrR4xQ9BEANRlRgUTfrkhZG1NCy7PpVBb7L2r36STBuFSdQJmruJAfvTHm\na4hhmfaSIJ0Wa+Q24gL1GNwkSRdOhXRYxB4OvNIJzzuC3XqgugQVG5xzZh0kULQs\nkZVvkL5dM0FEZzBn8aK2sohTFDivvYJy7PAogC9Z5M1nPatZBowruUZvCym3Wh1J\nRtBwsS9SsTcsUqaT9FpEa7vYUney1/R8G2FAFufTyztjgBQzh78GhU+dek+ycIf1\nVQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "gitea-1",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0bp4I/f5dLL22GRHanLV\nw57sNBEWT3Vx32B24hScKNP5nYDW0dIRkt1c7SLEpe+diNgyIwk7JlI20Vl+oaVo\njdCpmHSB18yXxQT2Ub6aI8ApwFLECVA6SckekcwxLJc/oGRMB52PonI8opJOVbPa\nF+heZ5NNDiMvn3E8qODdMWSjDiJNSVLJgsCPFHAt32aJgLaXQTqG5lrmltaamscW\njGlFqiBJw/5saCkKBPdPwdX4RcDqvGX1FdE1LVB42cskv8CrnvEVFLBxKXAhAr6s\nNhOhenzLGHpy58tNoUoUw3v4WiPRtcnlNxeSVG5LKkjaK04f2oxeZx3SiSU/1naY\nkwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "gitea-2",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7MKbO2vvX7TD1cFKjITh\ntvsf6hgAQRcu7F0kiekx15aC3VLnRgsB9A6SXySVrqvhq/vOSTXZsIC62IQi4Oks\nhhtAA/uvwcOmZ7JkMi0vJ3Ary94dTsg/L8i/0/k2V/D4FRKTV4414wSkpglFGLhl\nvbZ6P17LrqfyAzNJwIDzwd9d6cvt4a0qxvuxbTOHkBuY8tpyGdNzhg6fATadxbBa\nRASEVFb+xqxG3K+8zRmaCFyYqmSPS/8liVVbLPAeUlK6pDyQ5g4T37E5o+CpWfPF\nkBgYw/hHQe6zt1Z4wNJ6mb8YIN/l9kFF3EE99laYxp9Ua7ffrZkRgw12C5Yrn3N6\noQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "ldap-2.kosmos.org",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAycyHso4sCJ/RLkuQl1Qp\nBaAJsWw8NilZyoZwuaYAC4IGJ1Pn4p+6Ly4vWveGCPbDf18VNFHwNMSjtH94EWOo\nrF8Qiamcn8/NlT6NbbN77fjOFDvwITW9+7zgJz9QNsAT7lbdv9eWlWijnslVvqtk\njx9IuqAF1tEKEfnhj8wAHLT8WPABHzmp3PdfZXKN4fjCL9VcPNruXJiCIuNPnWIo\nUxY9IRa9DiZ1jXIcWrTLLHCzq07jeo+MWpC5Uuz3U6+zfevFBHM0xpGMsouIfvLf\nF+MeckT5OhwujUL4IvfZ0Wl6/5wsvHbLFFW7KsmiBK0Su04OnKnZUSaAmtEDU2w4\nSQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "mastodon-2",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA27a8h17CCQLP8JY59n+M\nURsrbeVvRi3yIUe1IklOlRSTy0L3Z37rFuSNC3dC9rKl/pHDKtorgeukxbFADXQx\nkta2LNX8gf09jCWsUdga5lWIbfOdtlCLRDG1MVEUSA0f6Sxdqr8RbjM2ch31T6Me\n5Z6DYdggwBujcPHwZC1AugI1wJ0T5XHY9f2MDs/XjNEdw3ThYbAdbl1e09ql6Gtg\nSVCa4RlLg/KICdLJtVOLkX6049/XRxi41I6xvu9tXsqgV3+bs8dYbeGLsTWmpPIv\naAUMcf/A5t4B2DVpnlXDytPqfvZQPD3aBVyfEJRGI1yD6Vi9zL3RyIhDQ/I7PMNI\naQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "mastodon-3",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArBsrwKV1RtDfw/5y/L2N\n/x7UL2q6G4JypcD5Q8/aDQOTaGuTR+4RCup+Zcn2wzpdGnX6IzS7cy4/LqMoR2pB\nq8K1FZOXvcCtwsBqsyGWiFdy5aLXy2CkHhTRbkwOLPyb1rBy+qPCBdr055BPZUWm\nTfJaxTmph+Z1J+INz0YndYxz3iKET2V99OP27D7tUdZ7yPgMDbDJWqVxPdYrmAUr\n3QLpmYWsYlmPKhpTAXlvbvzE5vgh5EC8RGfhfYRpacc6QdwbahtxMQAV9+1S2+Vj\nntHfB6PSnYwewUHs9MMn8e33KmNlOZdMAVlyJymBZ4pNceC44vxvZYElp077A6tN\nFwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "nodejs-1",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA9L4BQgLEpQSSbSLwXOab\nfFey5VSk8ynDmj2I9sOpPMIXkXpmbONkyXqZ4CqKrMRtesXAg1F1lIwzE/WJy0wP\n9CRhEgnclHRHE3TVqWt8dC6+u5kx5o48EF8X9UWgV1098c21gcn68NZ7+l/janws\ntLYrgMynikcadaGtAkRszGG0dX+qdeRx9hRzhTNUIG4AYe6bUA6/LfOEPyRyuo3Q\ncaN5fAJSK+RRMWr1d7Mzd8k+l3xXzcUTMUL2To+Zh0Fw2SIEocM4NS1W9nAm4+Cq\nhlQUhsoHDwk7bDsIQtRNfy3bX59PSIVMcWLNkWilLzZW1yRtFGPTJfPlR4Y1XJb5\nuwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "nodejs-2",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuWyrBQXathrKzRO7HbX7\nZXqkeGo7X0q3qckO/Uh4Ht67bFb6iQDRo/gRkaVA0PM++2AhtW7wV2NYXR/3qowc\n1gGtO0zuQq56crcL7k9nVuFJ1IbYDyasEq+5nUKzEUVT0hK1/Vzh12gLFhDkBOX+\nCvISLTTQgEGljwNQLf1kZTraJcdDSN0R2k2jl+idJkeAuK5cjMEJa7Fog8scM2rR\nzGhB8gDRp+iq4HQ+yE3R1yXW9rBfWoConnXiNxholt3e2aAte2V1KnEmVLO/8ceo\nvqIp5xEcDKIAIrSqsmopRFXJ0PjS/nbS0Z2ynxpyh1BV4sqr/y4oOryrnwO+LqBB\nHwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "nodejs-3",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyqP7aGx+S9Mdt6xmaGnJ\nfNWWQsg4BvLiP1qtVt3VRrcXF2cy1bhgfnmqoBqnDk4bGlRoTzF+rSOw284+O2UQ\ntUlsBRos4TOyGfbYHehF12Re6NX51K9LHwaprr3eN5h08wLI8pjVrRJlbce8pHST\nXQ/CZvU+CBg43LE08cXr5kRmhnZrgh70g7zTO8+1E6y74r1LEh77Ar4uaaB5jXw7\n6o9TyfaA1HgyqvfYbH+9KPrJfMX/DeLrYPMI3IG/j3fzDUQQ8o9Pb5B+G1Apl+I+\nsTcgWRei5u06aZHLMMd8MMo4O1yUhbt05kxfVhlDGUDWBdi3cvsMf95t6MNdz/eq\niwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "nodejs-4",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwIlB6swdT/Z7tRx/Sm24\n/ro3Jotpsi0DiNS6i7BA1fH0OdbX5CRel62jGC1Nja9QCY8aBd00E8u7KPCuK3iY\n5aA7v91sxWZ7nbXdSwBawaNsTZAe4rMaEkA74INpq7TOvLzHcmDcgRbo+MC2Nw3T\nl0mCOaWkUWFaukTLN8zBldzEbYxztKsaL+b2TbevnSCaPkdD9WmDbmjrUiWTlnpE\nDidMjZ9rp+PcODyjlvwka1yJCoPFoN/+ZL4yXxo49tJ2kbrxSh4tdDZqiZwnajRb\n4SAuRCaHTASDSmZ1Dj0ET/miXuvy6Jgvt06eSMPDKvb+84Dk8zLf4CW6DaE2TfX4\nzwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "postgres-2",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoQmrHoW5X6jpN6cJnafW\nWKz1LpT2DvOFPeRmrlSPOPIUSVPUMZI8ojdxzmri/dzC8C4quCIYaL5ssARhe17L\no16LG3z/wdPENYONBj/oH5GRvmG1/uCgzL5+QQENk3kAWVAUb7EL3EgHNx90b2oC\nDNoHcjuoi3ZkCUXxkX7BESvw1jII4hP+HyoIqGh8TZLIAQ25/mS9aNL3TbcLYp5d\npqoM0Ruc4DHVuZTamN+zBZwNRCBz6uxMmaEBD+piYTEPJOnf7yUT7d2l/QzLftfE\nkSo80KOyrPOFdIPCpqKJyPOJZgg7fSgpR0YC6BH7I/JgIsIwUsQcMS8/ELUC5+Zg\nfwIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "postgres-4",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu6fPxOZeKloF/EgYvU0k\nOwv8bJjsCQcWaMTPle5//mRTszA6PM2z9RI+Mfr45qxTlsL9pQY8WJOWF6QOK31x\nszuqcr7oOjtAhrLI8f/oNDEDjcx325FqG9gNKQEAD7d4zodh+PhDe6x7GIyIS7lG\nIcD5Zre9iDwv8FGLR+5GLqS8SJOPL/wJkQ8w+N0f8YDFw81kiTta5NLhAx3fMDs0\n2kmoNlbmKlNZTtLjCfCV+/pa9oY6wycjck3GvobiFE/4cWaNkeGlPc+uAwlfmrOv\nHy0tq1XBX/BCvE5kMXmhnMT23JXjm2s2PgCLgEVGAXilXk/T597KDm+z4oBpAQma\nnQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "rsk-mainnet-1",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtavs6RQW6af9fWuEuhI1\nQa4Ff7Z1CfZ0fHz152UqUeUKatQ/psKVs5ULWDV/b69fSuNsUzkCny9OwtwyQB/F\n2U+vbv3/3As3z6i3V3q8q4ahCHd7tkMmxMLaWcdkfWbpupWTRkCEX+PSDKS0hdfp\n3EQKVA2FrqR0sSnnT+Q66kZw4/WJrNwtSLcps4D5OubG7xr/uUn3Vyv5qXvS/7kx\nGvMONs55qh64Gtc3FSFPEdVyZXasCMEWwXyadqzf+/qJtEYlK0Uy5E/u7CTsnmcH\n9TEiYVw0/6PomQ2HJfSlZVUUO007OliBHO9bWOwZ6qI5c53pt5KES0dyy6SQ4m+8\nawIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "rsk-mainnet-2",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu1cuvB3l7sBKJXqjhTih\nQloXteYOr/cQ24R5xUDnHZpCzM75khBjf9ZIX5fskManQ7MI4oFHAaKF6sCWT9QQ\nnL3ON0rCX8wDwBJpKY3iFisAK7f86GO5qkG2ovwG4wO1x69eKX52w33xGpPLPrmw\nBhFv+KfT56KZ3NCvDIQ6tew9VJ3g2V2zUtlL7xZIcdkgTXB06Ec8gbtoCAD3MVUQ\noxMCn+CK6QIAHGxpLIFEv5Y4hNRJ3+0RSuQikhhFzd7P2swnUgDSxDpbfoShroCC\neDw29sapOkQ+PwiHo2Zy8Qtr5m1ToGIhh8l1f/k2vi0Vf2xWVaTjbaeePEDMy9Fd\nKQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "rsk-testnet-1",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0JU46rCyLGOi5OdeeE2M\nobUUxO+Jqd9t9bP75Pyj0uH8WaxNv1PIdWZJiR+fcE+draBV86/YLxHzOFvsnMi+\nE/qgeXLKErGtTSb12mWq0gYv/wz9uqRbtcsv40gpu2BtNv9ycdXYACB/s0ipnuUO\nX/os4YHDvWV1cshwzgsQ87ad7OdT/Nldggtp4go60TkBi49VaftiJzYqVm1ey3xz\nd7+EsQWqhQHAac6POEuPjwNuM2valf/8+nI4Uday/CiFrDDV1SffRG30sd4rJF15\nh1S1Kxyetr72EmQwIGbJuDJL7eUU7blXjg6UtTxDDsl6rYUO5s/j7wZLoFhmC854\npQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "rsk-testnet-2",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzG2bgL0n5Q7bTR4WYHOB\nZNOuRem/jjarU/bL0VKKn0JqD3PPDAnhq9gRn7H8SwyGoVFN60YGzu45O4c+SqN3\nCXN+FeFabigH2tKLxBz3kNDYTT/F1ErLLi/6ydrCV3tpddR5KTqLSOntojG8KNzc\nyG4rMV9ebCE1wDVxAFdEA+YDZS8YjP0nO5sLWFacA0ZTx27t5ugqZP1acjSvKzWs\nZ+ekX5Pbws/oUHyaqEEPdz7er4MTBm0bdkCHZbM7132oBcH/huJZhmTXFEdoy4ML\nhP4MWWSvwo66HDYjnaID82a8W1RJZZu2irbPHrfVlaFAh8VQk1T1kkUu0bMovT3V\nYQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "rsk-testnet-3",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxbo3GccgPZp8UWhb9l2w\n+o6Qe5s4Tf/1TMOw3ppLw+IGCZhq9LEe8s8kngbBX7dMywbyDuf8vLXwvAHFKvC+\nx4XOXq0r9xDX8ujTCfqJxiSYk1KTyqM4lmi7qno7F9/Nwo7h3HuVbpkT752ojf+/\nDCSXwHL+uHlF6z3jKZ8iYBRHFrWmudh8bOm6lVsp/Iv4pQ/btZf8W5zULlk/Z6lT\nb6GS538Lnaoeu7wPCf/awL5GBg9findY3oS1lsEE+PfAu6SAHmbJcItMkrON7Esd\ng9xtwsjX1VICpJhOSkVS1nmRfYohELVJMdiKSLq+b5UskscbCjkRGY6GAPH8cVGg\nSQIDAQAB\n-----END PUBLIC KEY-----\n"
}

4
clients/test-2.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "test-2",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyU+Pg4svFeiLc4/OogiZ\n45MgXWMT7/S28R5lDQ3QwCc4c3mGEfkoiOzBmPpf/JuTIRO6W8hsXQNm5Wr3jGYa\nIKHtfSqNufLievLxymR781Grkzxsy8GefeUajNn0Nypjs4ACso2rdX3KmQ/xJr4n\nFKk6Jj08Fp/7i7kzgC8WA6ZeuVPRw9PODTof7x1BMoTfUXaGPPEIVxtv7cZBdkp1\nQK3F2A8nokqDo3630iOq/P29h80STGmeH8hjpICTGxYDOR/vvp7Zs7z8aueZ6iUT\n3oit8w+gAI4RTgu4bgPbwsh5nfIXZaJeSVrV6zpPO5usMbWWDJgdbhwbAGGYVSFp\nEQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "zerotier-2",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsild7NcktO5yVR3Uw0yA\negHFToXHaJMIR1z0WrfHgklHf27lRnWRHOiNjnR6SbsvKIT1MBntg4/mQgotah+n\npo6cKF+0pvUih+hOSBZ6+WwjRf5LxJTaj/R0e2j0Gig6PlDV3yWz8+2AB6gObVcb\nKOQT1w6p+T+S9t6Hv/E0Z8CJW+7ZXDZBvjKTg4kYb47P0J5704wATf38EcVAOuoa\nJsUJoE+dTygx2QUG78eiEYqVDgBak00MA7MpFI/yPrzfn4tjSO1aY2/vy1PyG0Zq\nfgAhuFNZPWQwxMvYsK68gFxfmfwsEn0iJOFh0rPCKYWgOCxzkMLk2z7ppCmNd+H6\nNQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -1,4 +0,0 @@
{
"name": "zerotier-3",
"public_key": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA70y96zXq3XiMlJhLM5Tm\nCzRiZjwqCBN1fKOoihZpsgXHtqDfYd+5BTyafAKTpzVpAZ7HJp+X4da8T/rb+Pym\nu0PrREXJSXGdWjKIgvsTVUtT51ZFYWtqbpu2l43wh57KCt7Q57JRgKTPyNbHJS0Z\ngrB6fifvQMfzFMf+WKK4X7Z6VXFP1r2cwzRvywC4/d3ZSbJ4fP3g+nnl1623Pxfc\n/BkqyaDeRt2dBEa5I8+OvFkKC8muU99fWR/gPZkkWD4pFNwLPLnPfgdk3bUd7tjN\n/0ardVX9lRJog1CjXCHaUG9aq+WFrtr/tfW+kLff/P7k00E5zplqq9Oz6VUvRMmu\nNQIDAQAB\n-----END PUBLIC KEY-----\n"
}

View File

@@ -2,40 +2,6 @@
This file is used to list changes made in each version of the ark cookbook.
## 6.0.3 - *2021-08-30*
- Standardise files with files in sous-chefs/repo-management
## 6.0.2 - *2021-06-18*
- Update location of test archive fixtures
## 6.0.1 - *2021-06-01*
- Standardise files with files in sous-chefs/repo-management
## 6.0.0 - *2021-05-22*
- Chef 17 updates: enable `unified_mode` on all resources
- Bump required Chef Infra Client to >= 15.3
- Migrate to using `seven_zip_tool` resource directly and require `seven_zip` >= 3.1
- Various ChefSpec fixes
## 5.1.1 - *2021-04-29*
- Added a version pin on seven_zip
## 5.1.0 - *2021-01-24*
- Sous Chefs Adoption
- Standardise files with files in sous-chefs/repo-management
- Cookstyle fixes
- Add integration testing for Windows and MacOS
- Remove testing for Amazon Linux 201x, CentOS 6 and Ubuntu 16.04
- Fix ChefSpec tests
- Fix issues with `--strip-components` with the `:cherry_pick` action on MacOS
- Ensure `/etc/profile.d` exists on MacOS if `append_env_path` is used
## 5.0.0 (2020-01-02)
- Require Chef Infra Client 14+ and remove the need for the build_essential dependency - [@tas50](https://github.com/tas50)
@@ -67,9 +33,8 @@ This file is used to list changes made in each version of the ark cookbook.
- Rewrite of resource to custom resources.
- Remove EOL platforms from testing.
- Update zlib URL
-
## 2.2.1 (2016-12-16)
- Use Ohai root_group attribute to avoid trying to set the group to root on BSD/macOS.
- Add missing accessor for owner property

View File

@@ -0,0 +1,2 @@
Please refer to
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD

View File

@@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1,10 +1,6 @@
# ark cookbook
[![Cookbook Version](https://img.shields.io/cookbook/v/ark.svg)](https://supermarket.chef.io/cookbooks/ark)
[![CI State](https://github.com/sous-chefs/ark/workflows/ci/badge.svg)](https://github.com/sous-chefs/ark/actions?query=workflow%3Aci)
[![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors)
[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0)
[![Build Status](https://travis-ci.org/chef-cookbooks/ark.svg?branch=master)](https://travis-ci.org/chef-cookbooks/ark) [![Cookbook Version](https://img.shields.io/cookbook/v/ark.svg)](https://supermarket.chef.io/cookbooks/ark)
## Overview
@@ -31,10 +27,6 @@ By default, the ark will not run again if the `:path` is not empty. Ark provides
For remote files ark supports URLs using the [remote_file](http://docs.chef.io/resource_remote_file.html) resource. Local files are accessed with the `file://` syntax.
## Maintainers
This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If youd like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF).
## Requirements
### Platforms
@@ -277,27 +269,29 @@ You can also supply the file extension in case the file extension can not be det
end
```
## Contributors
## License & Authors
This project exists thanks to all the people who [contribute.](https://opencollective.com/sous-chefs/contributors.svg?width=890&button=false)
- 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-2017, Chef Software, Inc
- Copyright: 2014, Bloomberg L.P.
### Backers
```
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
Thank you to all our backers!
http://www.apache.org/licenses/LICENSE-2.0
![https://opencollective.com/sous-chefs#backers](https://opencollective.com/sous-chefs/backers.svg?width=600&avatarHeight=40)
### Sponsors
Support this project by becoming a sponsor. Your logo will show up here with a link to your website.
![https://opencollective.com/sous-chefs/sponsor/0/website](https://opencollective.com/sous-chefs/sponsor/0/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/1/website](https://opencollective.com/sous-chefs/sponsor/1/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/2/website](https://opencollective.com/sous-chefs/sponsor/2/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/3/website](https://opencollective.com/sous-chefs/sponsor/3/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/4/website](https://opencollective.com/sous-chefs/sponsor/4/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/5/website](https://opencollective.com/sous-chefs/sponsor/5/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/6/website](https://opencollective.com/sous-chefs/sponsor/6/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/7/website](https://opencollective.com/sous-chefs/sponsor/7/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/8/website](https://opencollective.com/sous-chefs/sponsor/8/avatar.svg?avatarHeight=100)
![https://opencollective.com/sous-chefs/sponsor/9/website](https://opencollective.com/sous-chefs/sponsor/9/avatar.svg?avatarHeight=100)
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```

View File

@@ -31,7 +31,7 @@ pkgs = %w(libtool autoconf) unless platform_family?('mac_os_x')
pkgs += %w(make) unless platform_family?('mac_os_x', 'freebsd')
pkgs += %w(unzip rsync gcc) unless platform_family?('mac_os_x')
pkgs += %w(autogen) unless platform_family?('rhel', 'fedora', 'mac_os_x', 'suse', 'amazon')
pkgs += %w(gtar) if platform?('freebsd', 'smartos')
pkgs += %w(gtar) if platform?('freebsd') || platform?('smartos')
pkgs += %w(gmake) if platform?('freebsd')
if platform_family?('rhel', 'suse', 'amazon')
if node['platform_version'].to_i >= 7

View File

@@ -1,115 +0,0 @@
# Put files/directories that should be ignored in this file when uploading
# to a Chef Infra Server or Supermarket.
# Lines that start with '# ' are comments.
# OS generated files #
######################
.DS_Store
ehthumbs.db
Icon?
nohup.out
Thumbs.db
.envrc
# EDITORS #
###########
.#*
.project
.settings
*_flymake
*_flymake.*
*.bak
*.sw[a-z]
*.tmproj
*~
\#*
REVISION
TAGS*
tmtags
.vscode
.editorconfig
## COMPILED ##
##############
*.class
*.com
*.dll
*.exe
*.o
*.pyc
*.so
*/rdoc/
a.out
mkmf.log
# Testing #
###########
.circleci/*
.codeclimate.yml
.delivery/*
.foodcritic
.kitchen*
.mdlrc
.overcommit.yml
.rspec
.rubocop.yml
.travis.yml
.watchr
.yamllint
azure-pipelines.yml
Dangerfile
examples/*
features/*
Guardfile
kitchen.yml*
mlc_config.json
Procfile
Rakefile
spec/*
test/*
# SCM #
#######
.git
.gitattributes
.gitconfig
.github/*
.gitignore
.gitkeep
.gitmodules
.svn
*/.bzr/*
*/.git
*/.hg/*
*/.svn/*
# Berkshelf #
#############
Berksfile
Berksfile.lock
cookbooks/*
tmp
# Bundler #
###########
vendor/*
Gemfile
Gemfile.lock
# Policyfile #
##############
Policyfile.rb
Policyfile.lock.json
# Documentation #
#############
CODE_OF_CONDUCT*
CONTRIBUTING*
documentation/*
TESTING*
UPGRADING*
# Vagrant #
###########
.vagrant
Vagrantfile

View File

@@ -1,65 +0,0 @@
driver:
name: dokken
privileged: true # because Docker and SystemD
chef_version: <%= ENV['CHEF_VERSION'] || 'current' %>
chef_license: accept-no-persist
transport:
name: dokken
provisioner:
name: dokken
platforms:
- name: amazonlinux-2
driver:
image: dokken/amazonlinux-2
pid_one_command: /usr/lib/systemd/systemd
- name: debian-9
driver:
image: dokken/debian-9
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: debian-10
driver:
image: dokken/debian-10
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: centos-7
driver:
image: dokken/centos-7
pid_one_command: /usr/lib/systemd/systemd
- name: centos-8
driver:
image: dokken/centos-8
pid_one_command: /usr/lib/systemd/systemd
- name: fedora-latest
driver:
image: dokken/fedora-latest
pid_one_command: /usr/lib/systemd/systemd
- name: ubuntu-18.04
driver:
image: dokken/ubuntu-18.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: ubuntu-20.04
driver:
image: dokken/ubuntu-20.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: opensuse-leap-15
driver:
image: dokken/opensuse-leap-15
pid_one_command: /bin/systemd

View File

@@ -1,14 +0,0 @@
---
driver:
name: exec
transport:
name: exec
provisioner:
name: chef_zero
deprecations_as_errors: true
platforms:
- name: windows-latest
- name: macos-latest

View File

@@ -104,7 +104,7 @@ module Ark
def wmi_property_from_query(wmi_property, wmi_query)
@wmi = ::WIN32OLE.connect('winmgmts://')
result = @wmi.ExecQuery(wmi_query)
return unless result.each.count > 0
return nil unless result.each.count > 0
result.each.next.send(wmi_property)
end

View File

@@ -42,7 +42,7 @@ module Ark
end
def sevenzip_binary
@tar_binary ||= "\"#{node['ark']['sevenzip_binary'] || sevenzip_path_from_registry}\""
@tar_binary ||= "\"#{(node['ark']['sevenzip_binary'] || sevenzip_path_from_registry)}\""
end
def sevenzip_path_from_registry

View File

@@ -9,7 +9,7 @@ module Ark
end
def cherry_pick
"#{tar_binary} #{args} #{resource.release_file} -C #{resource.path}#{strip_args} #{resource.creates}"
"#{tar_binary} #{args} #{resource.release_file} -C #{resource.path} #{resource.creates}#{strip_args}"
end
def initialize(resource)

View File

@@ -1,49 +1 @@
{
"name": "ark",
"description": "Provides a custom resource for installing runtime artifacts in a predictable fashion",
"long_description": "",
"maintainer": "Sous Chefs",
"maintainer_email": "help@sous-chefs.org",
"license": "Apache-2.0",
"platforms": {
"amazon": ">= 0.0.0",
"centos": ">= 0.0.0",
"debian": ">= 0.0.0",
"freebsd": ">= 0.0.0",
"mac_os_x": ">= 0.0.0",
"opensuse": ">= 0.0.0",
"opensuseleap": ">= 0.0.0",
"oracle": ">= 0.0.0",
"redhat": ">= 0.0.0",
"scientific": ">= 0.0.0",
"smartos": ">= 0.0.0",
"suse": ">= 0.0.0",
"ubuntu": ">= 0.0.0",
"windows": ">= 0.0.0"
},
"dependencies": {
"seven_zip": ">= 3.1"
},
"providing": {
},
"recipes": {
},
"version": "6.0.3",
"source_url": "https://github.com/sous-chefs/ark",
"issues_url": "https://github.com/sous-chefs/ark/issues",
"privacy": false,
"chef_versions": [
[
">= 15.3"
]
],
"ohai_versions": [
],
"gems": [
],
"eager_load_libraries": true
}
{"name":"ark","version":"5.0.0","description":"Provides a custom resource for installing runtime artifacts in a predictable fashion","long_description":"","maintainer":"Chef Software, Inc.","maintainer_email":"cookbooks@chef.io","license":"Apache-2.0","platforms":{"ubuntu":">= 0.0.0","debian":">= 0.0.0","redhat":">= 0.0.0","centos":">= 0.0.0","suse":">= 0.0.0","opensuse":">= 0.0.0","opensuseleap":">= 0.0.0","scientific":">= 0.0.0","oracle":">= 0.0.0","amazon":">= 0.0.0","windows":">= 0.0.0","mac_os_x":">= 0.0.0","smartos":">= 0.0.0","freebsd":">= 0.0.0"},"dependencies":{"seven_zip":">= 0.0.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/chef-cookbooks/ark","issues_url":"https://github.com/chef-cookbooks/ark/issues","chef_version":[[">= 14.0"]],"ohai_version":[]}

View File

@@ -1,26 +1,16 @@
name 'ark'
maintainer 'Sous Chefs'
maintainer_email 'help@sous-chefs.org'
license 'Apache-2.0'
description 'Provides a custom resource for installing runtime artifacts in a predictable fashion'
version '6.0.3'
source_url 'https://github.com/sous-chefs/ark'
issues_url 'https://github.com/sous-chefs/ark/issues'
chef_version '>= 15.3'
name 'ark'
maintainer 'Chef Software, Inc.'
maintainer_email 'cookbooks@chef.io'
license 'Apache-2.0'
description 'Provides a custom resource for installing runtime artifacts in a predictable fashion'
version '5.0.0'
supports 'amazon'
supports 'centos'
supports 'debian'
supports 'freebsd'
supports 'mac_os_x'
supports 'opensuse'
supports 'opensuseleap'
supports 'oracle'
supports 'redhat'
supports 'scientific'
supports 'smartos'
supports 'suse'
supports 'ubuntu'
supports 'windows'
%w(ubuntu debian redhat centos suse opensuse opensuseleap scientific oracle amazon windows mac_os_x smartos freebsd).each do |os|
supports os
end
depends 'seven_zip', '>= 3.1' # for windows os
depends 'seven_zip' # for windows os
source_url 'https://github.com/chef-cookbooks/ark'
issues_url 'https://github.com/chef-cookbooks/ark/issues'
chef_version '>= 14.0'

View File

@@ -20,4 +20,4 @@
package node['ark']['package_dependencies'] unless platform_family?('windows', 'mac_os_x')
seven_zip_tool 'ark' if platform_family?('windows')
include_recipe 'seven_zip' if platform_family?('windows')

View File

@@ -25,7 +25,7 @@ property :url, String, required: true
property :path, String
property :full_path, String
property :append_env_path, [true, false], default: false
property :checksum, String, regex: /^[a-zA-Z0-9]{64}$/
property :checksum, regex: /^[a-zA-Z0-9]{64}$/, default: nil
property :has_binaries, Array, default: []
property :creates, String
property :release_file, String, default: ''
@@ -46,8 +46,6 @@ property :autoconf_opts, Array, default: []
property :extension, String
property :backup, [FalseClass, Integer], default: 5
unified_mode true
#################
# action :install
#################
@@ -107,9 +105,6 @@ action :install do
to new_resource.path
end
# This directory doesn't exist by default on MacOS
directory '/etc/profile.d' if platform_family?('mac_os_x')
# Add to path for interactive bash sessions
template "/etc/profile.d/#{new_resource.name}.sh" do
cookbook 'ark'

View File

@@ -1,118 +0,0 @@
# Changelog for Chocolatey cookbook
## v3.0.0 (2019-07-11)
- Add `node['chocolatey']['sensitive']` attribute (default: false) to give users the option to suppress output spam when the install.ps1 file is pushed to the machine.
- Require Chef Infra Client 12.15 or later
- Resolve minor Cookstyle warnings
- Fix `node['chocolatey']['upgrade']` to properly upgrade the `chocolatey` package
- Upgrade to the latest and greatest Chocolatey install script
## v2.0.1 (2018-07-03)
- Remove mentions of the package provider from the readme and metadata
## v2.0.0 (2018-05-01)
### Breaking Change
The package LWRP has been removed from this cookbook. chocolatey_package was integrated into Chef 12.7, which was released in Feb 2016\. This cookbook now requires Chef 12.7 or later.
### Other Changes
- This cookbook no longer requires the Windows cookbook
- The install script has been updated to the latest Chocolatey install script
- Converted testing to use Delivery Local Mode from within ChefDK
## v1.2.1 (2017-08-20)
- Explicitly use the double-dash long option names for `--source` and `--installargs`
## v1.2.0 (2017-05-04)
- Change the default `['chocolatey']['upgrade']` attribute value to `false`. Preventing chocolatey from reinstalling every chef run
## v1.1.1 (2017-04-22)
- Fix chef 13 converges renaming conflicting `env_path` method
## v1.1.0 (2017-01-09)
- Update the chocolatey install script to match chocolatey.org.
## v1.0.3 (2016-09-12)
- Loosen windows-cookbook constraint
## v1.0.2 (2016-08-29)
- Ensure `chocolateyVersion` attribute is used and the correct version of chocolatey is installed.
## v1.0.1 (2016-07-15)
- Always execute chocolatey installer unless guard is satisfied to allow the install to retry on subsequent attempts if it fails.
## v1.0.0 (2016-03-07)
- No longer dependent on chocolatey.org for install script
- Removed deprecated overwriting of the current_resource and fixed visibility problem with `env_path`
## v0.6.2 (2016-01-07)
- Fix Chocolatey detection on chef clients older than 12.4.0
## v0.6.1 (2015-11-24)
- Fix LocalJumpError on existing chocolatey package
## v0.6.0 (2015-11-17)
- Path Tracking. Tracking additions to the user and machine %PATH% environment and merging them into the current process.
- Downcase package name results from choco upgrade.
## v0.5.1 (2015-11-10)
- Prepend library include with :: in provder to fix 12.3.0 and likely other versions older than 12.5.1.
- Add backward compatibiliy to new metadata.rb attributes `source_url` and `issues_url`.
## v0.5.0 (2015-11-09)
- Refactored install script (and .kitchen.yml) to support installing Chocolatey in test-kitchen behind a proxy.
- Download `node['chocolatey']['Uri']` via `remote_file` resource instead of .net web client
- Set `chocolateyProxyLocation` environment variable to `Chef::Config['https_proxy']` if one is set before chocolatey install
- Changed helpers module namespacing from: `ChocolateyHelpers` to `Chocolatey::Helpers`
- Add ChefSpec unit tests
- Add ServerSpec integration tests
- Gemfile: bump foodcritic to 5.0 and Berkshelf to 4.0
- Add ChefSpec matchers
## v0.4.1 (2015-10-15)
- Adds example how to install package with version
- use the vanilla script resource to bypass 64bit interpreter builder introduced in Chef 12.5
## v0.4.0 (2015-06-30)
- Refactor script to download Chocolatey install script
- Chocolatey install: add proxy support
- fix for 64-bit chocolatey installs
## v0.3.0 (2015-04-20)
- Support for chocolatey >= 0.9.9
- Make package name case insensitive
## v0.2.0 (2014-09-24)
- Allow spaces in the path to the "choco" command.
- Update tests to use Rakefile
- Support Chocolatey version 0.9.8.24+
- Support custom command line options when installing packages
## v0.1.0 (2014-02-20)
- Fix and tests
## v0.0.5 (2013-04-30)
- Initial release

View File

@@ -1,46 +0,0 @@
# chocolatey Cookbook
[![Cookbook Version](https://img.shields.io/cookbook/v/chocolatey.svg)](https://supermarket.getchef.com/cookbooks/chocolatey) ![delivery](https://github.com/chocolatey-community/chocolatey-cookbook/workflows/delivery/badge.svg)
Install Chocolatey with the default recipe.
## Requirements
### Platform
- Windows
### Chef Infra Client
- 12.15 or greater
## Notes
As of Chocolatey version [0.9.8.24](https://github.com/chocolatey/chocolatey/blob/master/CHANGELOG.md#09824-july-3-2014) the install directory for Chocolatey has changed from `C:\Chocolatey` to `C:\ProgramData\Chocolatey`.
More information can be gotten from the [Chocolateywiki](https://github.com/chocolatey/chocolatey/wiki/DefaultChocolateyInstallReasoning).
## Attributes
All attributes below are pre-pended with `node['chocolatey']`
Attribute | Description | Type | Default
---------------------------------------------------- | ----------------------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------
`['upgrade']` | Whether to upgrade Chocolatey if it's already installed | Boolean | false
`['install_vars']['chocolateyProxyLocation']` | HTTPS proxy for Chocolatey install script | String | Chef::Config['https_proxy'] or ENV['https_proxy']
`['install_vars']['chocolateyProxyUser']` | Proxy user for authenticating proxies | String | nil
`['install_vars']['chocolateyProxyPassword']` | Proxy user password | String | nil
`['install_vars']['chocolateyVersion']` | Version of Chocolatey to install, e.g. '0.9.9.11' | String | nil (download latest version)
`['install_vars']['chocolateyDownloadUrl']` | Chocolatey .nupkg file URL. Use this if you host an internal copy of the chocolatey.nupkg | String | <https://chocolatey.org/api/v2/package/chocolatey> (download from chocolatey.org)
`['install_vars']['chocolateyUseWindowsCompression']`| To use built-in compression instead of 7zip (requires additional download) set to `true` | String | nil (use 7zip)
`['sensitive']` | When true, will suppress writing the contents of install.ps1 to the console | Boolean | false
## Recipes
- `chocolatey::default` - installs Chocolatey
## License and Maintainer
Maintainer:: Guilhem Lettron ([guilhem@lettron.fr](mailto:guilhem@lettron.fr))
License:: Apache 2.0

View File

@@ -1,12 +0,0 @@
default['chocolatey']['upgrade'] = false
default['chocolatey']['sensitive'] = false
# Chocolatey install.ps1 env vars. See https://chocolatey.org/install.ps1
default['chocolatey']['install_vars'].tap do |env|
env['chocolateyProxyLocation'] = Chef::Config['https_proxy'] || ENV['https_proxy']
env['chocolateyProxyUser'] = nil
env['chocolateyProxyPassword'] = nil
env['chocolateyVersion'] = nil
env['chocolateyDownloadUrl'] = 'https://chocolatey.org/api/v2/package/chocolatey'
env['chocolateyUseWindowsCompression'] = nil
end

View File

@@ -1,421 +0,0 @@
# =====================================================================
# Copyright 2017 - 2020 Chocolatey Software, Inc, and the
# original authors/contributors from ChocolateyGallery
# Copyright 2011 - 2017 RealDimensions Software, LLC, and the
# original authors/contributors from ChocolateyGallery
# at https://github.com/chocolatey/chocolatey.org
#
# 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.
# =====================================================================
# For organizational deployments of Chocolatey, please see https://chocolatey.org/docs/how-to-setup-offline-installation
# Environment Variables, specified as $env:NAME in PowerShell.exe and %NAME% in cmd.exe.
# For explicit proxy, please set $env:chocolateyProxyLocation and optionally $env:chocolateyProxyUser and $env:chocolateyProxyPassword
# For an explicit version of Chocolatey, please set $env:chocolateyVersion = 'versionnumber'
# To target a different url for chocolatey.nupkg, please set $env:chocolateyDownloadUrl = 'full url to nupkg file'
# NOTE: $env:chocolateyDownloadUrl does not work with $env:chocolateyVersion.
# To use built-in compression instead of 7zip (requires additional download), please set $env:chocolateyUseWindowsCompression = 'true'
# To bypass the use of any proxy, please set $env:chocolateyIgnoreProxy = 'true'
#specifically use the API to get the latest version (below)
$url = ''
$chocolateyVersion = $env:chocolateyVersion
if (![string]::IsNullOrEmpty($chocolateyVersion)){
Write-Output "Downloading specific version of Chocolatey: $chocolateyVersion"
$url = "https://chocolatey.org/api/v2/package/chocolatey/$chocolateyVersion"
}
$chocolateyDownloadUrl = $env:chocolateyDownloadUrl
if (![string]::IsNullOrEmpty($chocolateyDownloadUrl)){
Write-Output "Downloading Chocolatey from : $chocolateyDownloadUrl"
$url = "$chocolateyDownloadUrl"
}
if ($env:TEMP -eq $null) {
$env:TEMP = Join-Path $env:SystemDrive 'temp'
}
$chocTempDir = Join-Path $env:TEMP "chocolatey"
$tempDir = Join-Path $chocTempDir "chocInstall"
if (![System.IO.Directory]::Exists($tempDir)) {[void][System.IO.Directory]::CreateDirectory($tempDir)}
$file = Join-Path $tempDir "chocolatey.zip"
# PowerShell v2/3 caches the output stream. Then it throws errors due
# to the FileStream not being what is expected. Fixes "The OS handle's
# position is not what FileStream expected. Do not use a handle
# simultaneously in one FileStream and in Win32 code or another
# FileStream."
function Fix-PowerShellOutputRedirectionBug {
$poshMajorVerion = $PSVersionTable.PSVersion.Major
if ($poshMajorVerion -lt 4) {
try{
# http://www.leeholmes.com/blog/2008/07/30/workaround-the-os-handles-position-is-not-what-filestream-expected/ plus comments
$bindingFlags = [Reflection.BindingFlags] "Instance,NonPublic,GetField"
$objectRef = $host.GetType().GetField("externalHostRef", $bindingFlags).GetValue($host)
$bindingFlags = [Reflection.BindingFlags] "Instance,NonPublic,GetProperty"
$consoleHost = $objectRef.GetType().GetProperty("Value", $bindingFlags).GetValue($objectRef, @())
[void] $consoleHost.GetType().GetProperty("IsStandardOutputRedirected", $bindingFlags).GetValue($consoleHost, @())
$bindingFlags = [Reflection.BindingFlags] "Instance,NonPublic,GetField"
$field = $consoleHost.GetType().GetField("standardOutputWriter", $bindingFlags)
$field.SetValue($consoleHost, [Console]::Out)
[void] $consoleHost.GetType().GetProperty("IsStandardErrorRedirected", $bindingFlags).GetValue($consoleHost, @())
$field2 = $consoleHost.GetType().GetField("standardErrorWriter", $bindingFlags)
$field2.SetValue($consoleHost, [Console]::Error)
} catch {
Write-Output "Unable to apply redirection fix."
}
}
}
Fix-PowerShellOutputRedirectionBug
# Attempt to set highest encryption available for SecurityProtocol.
# PowerShell will not set this by default (until maybe .NET 4.6.x). This
# will typically produce a message for PowerShell v2 (just an info
# message though)
try {
# Set TLS 1.2 (3072) as that is the minimum required by Chocolatey.org.
# Use integers because the enumeration value for TLS 1.2 won't exist
# in .NET 4.0, even though they are addressable if .NET 4.5+ is
# installed (.NET 4.5 is an in-place upgrade).
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
} catch {
Write-Output 'Unable to set PowerShell to use TLS 1.2. This is required for contacting Chocolatey as of 03 FEB 2020. https://chocolatey.org/blog/remove-support-for-old-tls-versions. If you see underlying connection closed or trust errors, you may need to do one or more of the following: (1) upgrade to .NET Framework 4.5+ and PowerShell v3+, (2) Call [System.Net.ServicePointManager]::SecurityProtocol = 3072; in PowerShell prior to attempting installation, (3) specify internal Chocolatey package location (set $env:chocolateyDownloadUrl prior to install or host the package internally), (4) use the Download + PowerShell method of install. See https://chocolatey.org/docs/installation for all install options.'
}
function Get-Downloader {
param (
[string]$url
)
$downloader = new-object System.Net.WebClient
$defaultCreds = [System.Net.CredentialCache]::DefaultCredentials
if ($defaultCreds -ne $null) {
$downloader.Credentials = $defaultCreds
}
$ignoreProxy = $env:chocolateyIgnoreProxy
if ($ignoreProxy -ne $null -and $ignoreProxy -eq 'true') {
Write-Debug "Explicitly bypassing proxy due to user environment variable"
$downloader.Proxy = [System.Net.GlobalProxySelection]::GetEmptyWebProxy()
} else {
# check if a proxy is required
$explicitProxy = $env:chocolateyProxyLocation
$explicitProxyUser = $env:chocolateyProxyUser
$explicitProxyPassword = $env:chocolateyProxyPassword
if ($explicitProxy -ne $null -and $explicitProxy -ne '') {
# explicit proxy
$proxy = New-Object System.Net.WebProxy($explicitProxy, $true)
if ($explicitProxyPassword -ne $null -and $explicitProxyPassword -ne '') {
$passwd = ConvertTo-SecureString $explicitProxyPassword -AsPlainText -Force
$proxy.Credentials = New-Object System.Management.Automation.PSCredential ($explicitProxyUser, $passwd)
}
Write-Debug "Using explicit proxy server '$explicitProxy'."
$downloader.Proxy = $proxy
} elseif (!$downloader.Proxy.IsBypassed($url)) {
# system proxy (pass through)
$creds = $defaultCreds
if ($creds -eq $null) {
Write-Debug "Default credentials were null. Attempting backup method"
$cred = get-credential
$creds = $cred.GetNetworkCredential();
}
$proxyaddress = $downloader.Proxy.GetProxy($url).Authority
Write-Debug "Using system proxy server '$proxyaddress'."
$proxy = New-Object System.Net.WebProxy($proxyaddress)
$proxy.Credentials = $creds
$downloader.Proxy = $proxy
}
}
return $downloader
}
function Download-String {
param (
[string]$url
)
$downloader = Get-Downloader $url
return $downloader.DownloadString($url)
}
function Download-File {
param (
[string]$url,
[string]$file
)
#Write-Output "Downloading $url to $file"
$downloader = Get-Downloader $url
$downloader.DownloadFile($url, $file)
}
if ($url -eq $null -or $url -eq '') {
Write-Output "Getting latest version of the Chocolatey package for download."
$url = 'https://chocolatey.org/api/v2/Packages()?$filter=((Id%20eq%20%27chocolatey%27)%20and%20(not%20IsPrerelease))%20and%20IsLatestVersion'
[xml]$result = Download-String $url
$url = $result.feed.entry.content.src
}
# Download the Chocolatey package
Write-Output "Getting Chocolatey from $url."
Download-File $url $file
# Determine unzipping method
# 7zip is the most compatible so use it by default
$7zaExe = Join-Path $tempDir '7za.exe'
$unzipMethod = '7zip'
$useWindowsCompression = $env:chocolateyUseWindowsCompression
if ($useWindowsCompression -ne $null -and $useWindowsCompression -eq 'true') {
Write-Output 'Using built-in compression to unzip'
$unzipMethod = 'builtin'
} elseif (-Not (Test-Path ($7zaExe))) {
Write-Output "Downloading 7-Zip commandline tool prior to extraction."
# download 7zip
Download-File 'https://chocolatey.org/7za.exe' "$7zaExe"
}
# unzip the package
Write-Output "Extracting $file to $tempDir..."
if ($unzipMethod -eq '7zip') {
$params = "x -o`"$tempDir`" -bd -y `"$file`""
# use more robust Process as compared to Start-Process -Wait (which doesn't
# wait for the process to finish in PowerShell v3)
$process = New-Object System.Diagnostics.Process
$process.StartInfo = New-Object System.Diagnostics.ProcessStartInfo($7zaExe, $params)
$process.StartInfo.RedirectStandardOutput = $true
$process.StartInfo.UseShellExecute = $false
$process.StartInfo.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden
$process.Start() | Out-Null
$process.BeginOutputReadLine()
$process.WaitForExit()
$exitCode = $process.ExitCode
$process.Dispose()
$errorMessage = "Unable to unzip package using 7zip. Perhaps try setting `$env:chocolateyUseWindowsCompression = 'true' and call install again. Error:"
switch ($exitCode) {
0 { break }
1 { throw "$errorMessage Some files could not be extracted" }
2 { throw "$errorMessage 7-Zip encountered a fatal error while extracting the files" }
7 { throw "$errorMessage 7-Zip command line error" }
8 { throw "$errorMessage 7-Zip out of memory" }
255 { throw "$errorMessage Extraction cancelled by the user" }
default { throw "$errorMessage 7-Zip signalled an unknown error (code $exitCode)" }
}
} else {
if ($PSVersionTable.PSVersion.Major -lt 5) {
try {
$shellApplication = new-object -com shell.application
$zipPackage = $shellApplication.NameSpace($file)
$destinationFolder = $shellApplication.NameSpace($tempDir)
$destinationFolder.CopyHere($zipPackage.Items(),0x10)
} catch {
throw "Unable to unzip package using built-in compression. Set `$env:chocolateyUseWindowsCompression = 'false' and call install again to use 7zip to unzip. Error: `n $_"
}
} else {
Expand-Archive -Path "$file" -DestinationPath "$tempDir" -Force
}
}
# Call chocolatey install
Write-Output "Installing chocolatey on this machine"
$toolsFolder = Join-Path $tempDir "tools"
$chocInstallPS1 = Join-Path $toolsFolder "chocolateyInstall.ps1"
& $chocInstallPS1
Write-Output 'Ensuring chocolatey commands are on the path'
$chocInstallVariableName = "ChocolateyInstall"
$chocoPath = [Environment]::GetEnvironmentVariable($chocInstallVariableName)
if ($chocoPath -eq $null -or $chocoPath -eq '') {
$chocoPath = "$env:ALLUSERSPROFILE\Chocolatey"
}
if (!(Test-Path ($chocoPath))) {
$chocoPath = "$env:SYSTEMDRIVE\ProgramData\Chocolatey"
}
$chocoExePath = Join-Path $chocoPath 'bin'
if ($($env:Path).ToLower().Contains($($chocoExePath).ToLower()) -eq $false) {
$env:Path = [Environment]::GetEnvironmentVariable('Path',[System.EnvironmentVariableTarget]::Machine);
}
Write-Output 'Ensuring chocolatey.nupkg is in the lib folder'
$chocoPkgDir = Join-Path $chocoPath 'lib\chocolatey'
$nupkg = Join-Path $chocoPkgDir 'chocolatey.nupkg'
if (![System.IO.Directory]::Exists($chocoPkgDir)) { [System.IO.Directory]::CreateDirectory($chocoPkgDir); }
Copy-Item "$file" "$nupkg" -Force -ErrorAction SilentlyContinue
# SIG # Begin signature block
# MIIcpwYJKoZIhvcNAQcCoIIcmDCCHJQCAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEo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JKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0B
# CQUxDxcNMjAwNDE2MDA1MDU0WjAjBgkqhkiG9w0BCQQxFgQUSnVQXFG9NidxPlpR
# Zbf9t65cx2kwDQYJKoZIhvcNAQEBBQAEggEAlpX/WR+PI6eEsARfNpjEQAdcOOG6
# Kp1TyXOaikIUh0BI7IjCiGRr7LbXQdkZIMcl3UD8TN+GQ59RsHSsYaAQJozUW9uo
# pj3NaQJaKwHB15zHzcD1TMi18zCCPlebPmUTDsbICWBWangCST0zqU849+3tlx7E
# LLjYjs/ybeS7aQffy1Dv87ElCYWsVuoQ0n9U/7hqJ3pv88SM52xmg9IlexfOanCz
# tTAM+ke9OcXuPhoZJuDL3c8gaWxELpkokMoqX0UCgCgY4RTmJ44mC9GcYKSnpMQZ
# qFot8MXA8t5cdxN2EL8j0ASufyE0oucys4cs+yiN65GWds7YbjYC/ihG6A==
# SIG # End signature block

View File

@@ -1,55 +0,0 @@
module Chocolatey
module Helpers
# include the PowershellOut module from the windows cookbook
# in case we are running an older chef client
include Chef::Mixin::PowershellOut
# Get the ChocolateyInstall directory from the environment.
def chocolatey_install
ENV.fetch('ChocolateyInstall') { |env_var| machine_env_var(env_var) }
end
# The Chocolatey command.
#
# Reference: https://github.com/chocolatey/chocolatey-cookbook/pull/16#issuecomment-47975896
def chocolatey_executable
"\"#{::File.join(chocolatey_install, 'bin', 'choco')}\""
end
def chocolatey_lib_dir
File.join(chocolatey_install, 'lib', 'chocolatey')
end
# Check if Chocolatey is installed
def chocolatey_installed?
return @is_chocolatey_installed if @is_chocolatey_installed
return false if chocolatey_install.nil?
# choco /? returns an exit status of -1 with chocolatey 0.9.9 => use list
cmd = Mixlib::ShellOut.new("#{chocolatey_executable} list -l chocolatey")
cmd.run_command
@is_chocolatey_installed = cmd.exitstatus == 0
end
# combine the local path with the user and machine paths
def environment_path(local_path)
machine = env_var('PATH', 'MACHINE').split(';')
user = env_var('PATH', 'USER').split(';')
local = local_path.split(';')
combined = local.concat(machine).concat(user).uniq.compact
combined.join(';')
end
private
def machine_env_var(env_var)
env_var(env_var, 'MACHINE')
end
def env_var(env_var, scope)
env_var = powershell_out!(
"[System.Environment]::GetEnvironmentVariable('#{env_var}', '#{scope}')"
)
env_var.stdout.chomp
end
end
end

View File

@@ -1 +0,0 @@
{"name":"chocolatey","version":"3.0.0","description":"Install Chocolatey on Windows","long_description":"","maintainer":"Guilhem Lettron","maintainer_email":"guilhem.lettron@youscribe.com","license":"Apache-2.0","platforms":{"windows":">= 0.0.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/chocolatey/chocolatey-cookbook","issues_url":"https://github.com/chocolatey/chocolatey-cookbook/issues","chef_version":[[">= 12.15"]],"ohai_version":[]}

View File

@@ -1,13 +0,0 @@
name 'chocolatey'
maintainer 'Guilhem Lettron'
maintainer_email 'guilhem.lettron@youscribe.com'
license 'Apache-2.0'
description 'Install Chocolatey on Windows'
version '3.0.0'
source_url 'https://github.com/chocolatey/chocolatey-cookbook'
issues_url 'https://github.com/chocolatey/chocolatey-cookbook/issues'
supports 'windows'
chef_version '>= 12.15'

View File

@@ -1,48 +0,0 @@
#
# Cookbook:: chocolatey
# recipe:: default
# Author:: Guilhem Lettron <guilhem.lettron@youscribe.com>
#
# Copyright:: 2012, Societe Publica.
# Copyright:: 2015, Doug Ireton
#
# 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.
#
unless platform_family?('windows')
return "Chocolatey install not supported on #{node['platform_family']}"
end
Chef::Resource.include Chocolatey::Helpers
install_ps1 = File.join(Chef::Config['file_cache_path'], 'chocolatey-install.ps1')
cookbook_file install_ps1 do
action :create
backup false
source 'install.ps1'
sensitive node['chocolatey']['sensitive']
end
powershell_script 'Install Chocolatey' do
environment node['chocolatey']['install_vars']
cwd Chef::Config['file_cache_path']
code install_ps1
not_if { chocolatey_installed? }
end
if node['chocolatey']['upgrade']
chocolatey_package 'chocolatey' do
action :upgrade
version node['chocolatey']['install_vars']['chocolateyVersion']
end
end

View File

@@ -2,36 +2,6 @@
This file is used to list changes made in each version of golang.
## 5.3.1 - *2021-08-30*
- Standardise files with files in sous-chefs/repo-management
## 5.3.0 - *2021-07-15*
- Fix `unified_mode` declaration
- Bump `ark` dependency to one with `unified_mode` set
## 5.2.0 - *2021-06-04*
- Update example package to adhere with modern Go standards
## 5.1.0 - *2021-06-03*
- Fix resource to use the correct path in GOPATH profile.d template
## 5.0.1 - *2021-06-01*
- Standardise files with files in sous-chefs/repo-management
## 5.0.0 - *2021-05-21*
- Require chef 15.3 or greater
- Use unified_mode for chef 17 support
## 4.1.1 - *2021-02-03*
- Use `node['golang']['scm']` and `node['golang']['scm_packages']` attributes in default recipe.
## 4.1.0
- Create a custom resource to install Go from source or by downloading a package

View File

@@ -1,201 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1,115 +0,0 @@
# Put files/directories that should be ignored in this file when uploading
# to a Chef Infra Server or Supermarket.
# Lines that start with '# ' are comments.
# OS generated files #
######################
.DS_Store
ehthumbs.db
Icon?
nohup.out
Thumbs.db
.envrc
# EDITORS #
###########
.#*
.project
.settings
*_flymake
*_flymake.*
*.bak
*.sw[a-z]
*.tmproj
*~
\#*
REVISION
TAGS*
tmtags
.vscode
.editorconfig
## COMPILED ##
##############
*.class
*.com
*.dll
*.exe
*.o
*.pyc
*.so
*/rdoc/
a.out
mkmf.log
# Testing #
###########
.circleci/*
.codeclimate.yml
.delivery/*
.foodcritic
.kitchen*
.mdlrc
.overcommit.yml
.rspec
.rubocop.yml
.travis.yml
.watchr
.yamllint
azure-pipelines.yml
Dangerfile
examples/*
features/*
Guardfile
kitchen.yml*
mlc_config.json
Procfile
Rakefile
spec/*
test/*
# SCM #
#######
.git
.gitattributes
.gitconfig
.github/*
.gitignore
.gitkeep
.gitmodules
.svn
*/.bzr/*
*/.git
*/.hg/*
*/.svn/*
# Berkshelf #
#############
Berksfile
Berksfile.lock
cookbooks/*
tmp
# Bundler #
###########
vendor/*
Gemfile
Gemfile.lock
# Policyfile #
##############
Policyfile.rb
Policyfile.lock.json
# Documentation #
#############
CODE_OF_CONDUCT*
CONTRIBUTING*
documentation/*
TESTING*
UPGRADING*
# Vagrant #
###########
.vagrant
Vagrantfile

View File

@@ -1,55 +0,0 @@
---
driver:
name: dokken
privileged: true
transport:
name: dokken
provisioner:
name: dokken
product_name: chef
product_version: <%= ENV['CHEF_VERSION'] || 'latest' %>
chef_license: accept-no-persist
install_strategy: once
platforms:
- name: debian-9
driver:
image: dokken/debian-9
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: debian-10
driver:
image: dokken/debian-10
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: centos-7
driver:
image: dokken/centos-7
platform: rhel
pid_one_command: /usr/lib/systemd/systemd
- name: centos-8
driver:
image: dokken/centos-8
platform: rhel
pid_one_command: /usr/lib/systemd/systemd
- name: ubuntu-18.04
driver:
image: dokken/ubuntu-18.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: ubuntu-20.04
driver:
image: dokken/ubuntu-18.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update

View File

@@ -1,43 +1 @@
{
"name": "golang",
"description": "Installs go programming language",
"long_description": "",
"maintainer": "Sous Chefs",
"maintainer_email": "help@sous-chefs.org",
"license": "Apache-2.0",
"platforms": {
"debian": ">= 0.0.0",
"ubuntu": ">= 0.0.0",
"redhat": ">= 0.0.0",
"centos": ">= 0.0.0",
"fedora": ">= 0.0.0",
"amazon": ">= 0.0.0",
"scientific": ">= 0.0.0",
"oracle": ">= 0.0.0"
},
"dependencies": {
"ark": ">= 6.0"
},
"providing": {
},
"recipes": {
},
"version": "5.3.1",
"source_url": "https://github.com/sous-chefs/golang",
"issues_url": "https://github.com/sous-chefs/golang/issues",
"privacy": false,
"chef_versions": [
[
">= 15.3"
]
],
"ohai_versions": [
],
"gems": [
],
"eager_load_libraries": true
}
{"name":"golang","version":"4.1.0","description":"Installs go programming language","long_description":"","maintainer":"Sous Chefs","maintainer_email":"help@sous-chefs.org","license":"Apache-2.0","platforms":{"debian":">= 0.0.0","ubuntu":">= 0.0.0","redhat":">= 0.0.0","centos":">= 0.0.0","fedora":">= 0.0.0","amazon":">= 0.0.0","scientific":">= 0.0.0","oracle":">= 0.0.0"},"dependencies":{"ark":"~> 5.0"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/sous-chefs/golang","issues_url":"https://github.com/sous-chefs/golang/issues","chef_version":[[">= 14.0"]],"ohai_version":[]}

View File

@@ -5,8 +5,8 @@ license 'Apache-2.0'
description 'Installs go programming language'
source_url 'https://github.com/sous-chefs/golang'
issues_url 'https://github.com/sous-chefs/golang/issues'
chef_version '>= 15.3'
version '5.3.1'
chef_version '>= 14.0'
version '4.1.0'
supports 'debian'
supports 'ubuntu'
@@ -17,4 +17,4 @@ supports 'amazon'
supports 'scientific'
supports 'oracle'
depends 'ark', '>= 6.0'
depends 'ark', '~> 5.0'

View File

@@ -2,7 +2,7 @@
# Cookbook:: golang
# Recipe:: default
#
# Copyright:: 2013-2021, Alexander Rozhnov
# Copyright:: 2013, Alexander Rozhnov
#
# 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
@@ -21,8 +21,6 @@ golang 'Install go' do
from_source node['golang']['from_source']
version node['golang']['version'] if node['golang']['version'] # go version
source_version node['golang']['source_version'] if node['golang']['source_version'] # go version from source
scm node['golang']['scm']
scm_packages node['golang']['scm_packages']
owner node['golang']['owner'] if node['golang']['owner']
group node['golang']['group'] if node['golang']['group']
end

View File

@@ -2,7 +2,7 @@
# Cookbook:: golang
# Resource:: default
#
# Copyright:: 2020-2021, Sous-chefs
# Copyright:: 2020, Sous-chefs
#
# 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
@@ -17,8 +17,6 @@
# under the License.
#
unified_mode true
# Install golang by compiling from source
property :from_source, [true, false], default: false
@@ -101,7 +99,7 @@ action :install do
source 'golang.sh.erb'
mode new_resource.directory_mode
variables gobin: new_resource.gobin,
gopath: new_resource.gopath,
gopath: new_resource.gobin,
install_dir: new_resource.install_dir
end

View File

@@ -2,22 +2,6 @@
# Cookbook:: golang
# Resource:: default
#
# Copyright:: 2020-2021, Sous-chefs
#
# 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.
#
unified_mode true
default_action :install

View File

@@ -1,53 +1,42 @@
# hostsfile Cookbook CHANGELOG
hostsfile Cookbook CHANGELOG
=======================
This file is used to list changes made in each version of the hostsfile cookbook.
## v3.0.1 (2017-08-22)
- Add TESTING.md and CONTRIBUTING.md files
- Fix the readme to properly specify Chef 12.7+ as the Chef requirement
- Add a local delivery configuration and remove the existing rakefile
- Resolve _most_ of the ChefSpec failures
## v3.0.0 (2017-08-22)
- Converted the LWRP to a custom resource which increases the required Chef release to 12.7
- Namespaced the helper libraries under the HostsFile module to prevent method collisions with other resources or the chef-client itself
## v2.4.6 (2017-08-15)
- use openssl for FIPS compatibility
- Expand priority documentation in README
- Add ::1 loopback to test cases and priority settings
## v2.4.5 (2014-06-24)
v2.4.5 (2014-06-24)
-------------------
- Fix notifications and why-run mode
## v2.4.4 (2014-02-25)
v2.4.4 (2014-02-25)
-------------------
- Bump Berkshelf version
- Remove scope pieces from IPv6 addresses
## v2.4.3 (2014-02-01)
v2.4.3 (2014-02-01)
-------------------
- Package custom ChefSpec matchers
- Update testing harness
- Avoid using `Chef::Application.fatal!`
- Use Chef::Resource::File for atomic updates
## v2.4.2
v2.4.2
------
- Fix Travis CI integration
- Remove newline characters
- Allow specifying a custom hostsfile path
## v2.4.1
v2.4.1
------
- Force a new upload to the community site
## v2.4.0
v2.4.0
------
- Convert everything to Ruby 1.9 syntax because I'm tired of people removing trailing commas despite the **massive** warning in the README: ([#29](https://github.com/customink-webops/hostsfile/issues/29), [#30](https://github.com/customink-webops/hostsfile/issues/30), [#32](https://github.com/customink-webops/hostsfile/issues/32), [#33](https://github.com/customink-webops/hostsfile/issues/33), [#34](https://github.com/customink-webops/hostsfile/issues/34), [#35](https://github.com/customink-webops/hostsfile/issues/35), [#36](https://github.com/customink-webops/hostsfile/issues/36), [#38](https://github.com/customink-webops/hostsfile/issues/38), [#39](https://github.com/customink-webops/hostsfile/issues/39))
- Update to the latest and greatest testing gems and practices
- Remove strainer in favor of a purer solution
@@ -55,30 +44,30 @@ This file is used to list changes made in each version of the hostsfile cookbook
- Add more platforms to the `.kitchen.yml`
- Use `converge_by` and support whyruny mode
## v2.0.0
v2.0.0
------
- Completely manage the hostsfile, ensuring no duplicate entries
## v1.0.2
v1.0.2
------
- Support Windows (thanks @igantt-daptiv)
- Specs + Travis support
- Throw fatal error if hostsfile does not exist (@jkerzner)
- Write priorities in hostsfile so they are read on subsequent Chef runs
## v0.2.0
v0.2.0
------
- Updated README to require Ruby 1.9
- Allow hypens in hostnames
- Ensure newline at end of file
- Allow priority ordering in hostsfile
## v0.1.1
v0.1.1
------
- Fixed issue #1
- Better unique object filtering
- Better handing of aliases
## v0.1.0
v0.1.0
------
- Initial release

View File

@@ -1,6 +0,0 @@
# Contributing
1. Fork the project
2. Create a feature branch corresponding to you change
3. Commit and test thoroughly
4. Create a Pull Request on GitHub

View File

@@ -1,31 +1,71 @@
# hostsfile cookbook
hostsfile LWRP
==============
[![Build Status](https://travis-ci.org/customink-webops/hostsfile.png?branch=master)](https://travis-ci.org/customink-webops/hostsfile)
[![Build Status](https://travis-ci.org/customink-webops/hostsfile.svg?branch=master)](https://travis-ci.org/customink-webops/hostsfile)
`hostsfile` provides an LWRP for managing your `/etc/hosts` (or Windows equivalent) file using Chef.
`hostsfile` provides a resource for managing your `/etc/hosts` (or Windows equivalent) file using Chef.
## Requirements
Requirements
------------
- Chef 11 or higher
- **Ruby 1.9.3 or higher**
- Chef 12.7 or higher
**Please stop opening Pull Requests to restore Ruby 1.8 support!** Any of the `1.x.y` series of this cookbook will work with Chef 10 and Ruby 1.8. You can use Opscode's [Omnibus installer](http://www.opscode.com/blog/2012/06/29/omnibus-chef-packaging/) to install Ruby 1.9+ and Seth Chisamore's [Vagrant Omnibus plugin](https://github.com/schisamo/vagrant-omnibus) to get Ruby 1.9+ on your Vagrant box.
## Attributes
Attribute | Description | Example | Default
---------- | ------------------------------------------------------- | -------------------- | ------------------------------------
ip_address | (name attribute) the IP address for the entry | 1.2.3.4 |
hostname | (required) the hostname associated with the entry | example.com |
unique | remove any existing entries that have the same hostname | true | false
aliases | array of aliases for the entry | ['www.example.com'] | []
comment | a comment to append to the end of the entry | 'interal DNS server' | nil
priority | the relative position of this entry | 20 | (varies, see **Priorities** section)
Attributes
----------
<table>
<tr>
<th>Attribute</th>
<th>Description</th>
<th>Example</th>
<th>Default</th>
</tr>
<tr>
<td>ip_address</td>
<td>(name attribute) the IP address for the entry</td>
<td><tt>1.2.3.4</tt></td>
<td></td>
</tr>
<tr>
<td>hostname</td>
<td>(required) the hostname associated with the entry</td>
<td><tt>example.com</tt></td>
<td></td>
</tr>
<tr>
<td>unique</td>
<td>remove any existing entries that have the same <tt>hostname</tt></td>
<td><tt>true</tt></td>
<td><tt>false</tt></td>
</tr>
<tr>
<td>aliases</td>
<td>array of aliases for the entry</td>
<td><tt>['www.example.com']</tt></td>
<td><tt>[]</tt></td>
</tr>
<tr>
<td>comment</td>
<td>a comment to append to the end of the entry</td>
<td><tt>'interal DNS server'</tt></td>
<td><tt>nil</tt></td>
</tr>
<tr>
<td>priority</td>
<td>the relative position of this entry</td>
<td><tt>20</tt></td>
<td>(varies, see **Priorities** section)</td>
</tr>
</table>
## Actions
Actions
-------
**Please note**: In `v0.1.2`, specifying a hostname or alias that existed in another automatically removed that hostname from the other entry before. In `v2.1.0`, the `unique` option was added to give the user case-by-case control of this behavior. For example, given an `/etc/hosts` file that contains:
```
1.2.3.4 example.com www.example.com
```
1.2.3.4 example.com www.example.com
when the Chef recipe below is converged:
@@ -38,15 +78,12 @@ end
then the `/etc/hosts` file will look like this:
```
1.2.3.4 example.com
2.3.4.5 www.example.com
```
1.2.3.4 example.com
2.3.4.5 www.example.com
Not specifying the `unique` parameter will result in duplicate hostsfile entries.
### `create`
#### `create`
Creates a new hosts file entry. If an entry already exists, it will be overwritten by this one.
```ruby
@@ -58,12 +95,9 @@ end
This will create an entry like this:
```
1.2.3.4 example.com
```
### `create_if_missing`
1.2.3.4 example.com
#### `create_if_missing`
Create a new hosts file entry, only if one does not already exist for the given IP address. If one exists, this does nothing.
```ruby
@@ -73,13 +107,10 @@ hostsfile_entry '1.2.3.4' do
end
```
### `append`
#### `append`
Append a hostname or alias to an existing record. If the given IP address doesn't already exist in the hostsfile, this method behaves the same as create. Otherwise, it will append the additional hostname and aliases to the existing entry.
```
1.2.3.4 example.com www.example.com # Created by Chef
```
1.2.3.4 example.com www.example.com # Created by Chef
```ruby
hostsfile_entry '1.2.3.4' do
@@ -92,12 +123,10 @@ end
would yield:
```
1.2.3.4 example.com www.example.com www2.example.com foo.com foobar.com # Created by Chef, Appended by Recipe X
```
1.2.3.4 example.com www.example.com www2.example.com foo.com foobar.com # Created by Chef, Appended by Recipe X
### `update`
#### `update`
Updates the given hosts file entry. Does nothing if the entry does not exist.
```ruby
@@ -110,13 +139,11 @@ end
This will create an entry like this:
```
1.2.3.4 example # Updated by Chef
```
1.2.3.4 example # Updated by Chef
### `remove`
Removes an entry from the hosts file. Does nothing if the entry does not exist.
#### `remove`
Removes an entry from the hosts file. Does nothing if the entry does not
exist.
```ruby
hostsfile_entry '1.2.3.4' do
@@ -126,8 +153,9 @@ end
This will remove the entry for `1.2.3.4`.
## Usage
Usage
-----
If you're using [Berkshelf](http://berkshelf.com/), just add `hostsfile` to your `Berksfile`:
```ruby
@@ -136,11 +164,9 @@ cookbook 'hostsfile'
Otherwise, install the cookbook from the community site:
```
knife cookbook site install hostsfile
```
knife cookbook site install hostsfile
Have any other cookbooks _depend_ on hostsfile by editing editing the `metadata.rb` for your cookbook.
Have any other cookbooks *depend* on hostsfile by editing editing the `metadata.rb` for your cookbook.
```ruby
# metadata.rb
@@ -150,8 +176,7 @@ depends 'hostsfile'
Note that you can specify a custom path to your hosts file in the `['hostsfile']['path']` node attribute. Otherwise, it defaults to sensible paths depending on your OS.
### Testing
If you are using [ChefSpec](https://github.com/sethvargo/chefspec) to unit test a cookbook that implements the `hostsfile_entry` resource, this cookbook packages customer matchers that you can use in your unit tests:
If you are using [ChefSpec](https://github.com/sethvargo/chefspec) to unit test a cookbook that implements the `hostsfile_entry` LWRP, this cookbook packages customer matchers that you can use in your unit tests:
- `append_hostsfile_entry`
- `create_hostsfile_entry`
@@ -168,21 +193,27 @@ it 'creates a hostsfile entry for the DNS server' do
end
```
## Priority
Priority
--------
Priority is a relatively new addition to the cookbook. It gives you the ability to (somewhat) specify the relative order of entries. By default, the priority is calculated for you as follows:
82. 127.0.0.1
81. ::1
80. 127.0.0.0/8
60. IPV4
20. IPV6
00. default
1. Local, loopback
2. IPV4
3. IPV6
However, you can override it using the `priority` option.
## License & Authors
Contributing
------------
1. Fork the project
2. Create a feature branch corresponding to you change
3. Commit and test thoroughly
4. Create a Pull Request on github
License & Authors
-----------------
- Author:: Seth Vargo (sethvargo@gmail.com)
```text

View File

@@ -3,8 +3,8 @@
# Cookbook:: hostsfile
# Attribute:: default
#
# Copyright:: 2012-2013, Seth Vargo
# Copyright:: 2012, CustomInk, LCC
# Copyright 2012-2013, Seth Vargo
# Copyright 2012, CustomInk, LCC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.

View File

@@ -3,8 +3,8 @@
# Cookbook:: hostsfile
# Library:: entry
#
# Copyright:: 2012-2013, Seth Vargo
# Copyright:: 2012, CustomInk, LCC
# Copyright 2012-2013, Seth Vargo
# Copyright 2012, CustomInk, LCC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -24,163 +24,160 @@ require 'ipaddr'
# An object representation of a single line in a hostsfile.
#
# @author Seth Vargo <sethvargo@gmail.com>
module HostsFile
class Entry
class << self
# Creates a new Hostsfile::Entry object by parsing a text line. The
# `line` attribute will be in the following format:
#
# 1.2.3.4 hostname [alias[, alias[, alias]]] [# comment [@priority]]
#
# @param [String] line
# the line to parse
# @return [Entry]
# a new entry object
def parse(line)
entry, comment = extract_comment(line)
comment, priority = extract_priority(comment)
entries = extract_entries(entry)
# Return nil if the line is empty
return nil if entries.nil? || entries.empty?
# If /etc/hosts has a broken content we throw a descriptive exception
if entries[0].nil?
raise ArgumentError, "/etc/hosts has a line without IP address: #{line}"
end
if entries[1].nil?
raise ArgumentError, "/etc/hosts has a line without hostname: #{line}"
end
new(
ip_address: entries[0],
hostname: entries[1],
aliases: entries[2..-1],
comment: comment,
priority: priority
)
end
private
def extract_comment(line)
return nil if presence(line).nil?
line.split('#', 2).collect { |part| presence(part) }
end
def extract_priority(comment)
return nil if comment.nil?
if comment.include?('@')
comment.split('@', 2).collect { |part| presence(part) }
else
[comment, nil]
end
end
def extract_entries(entry)
return nil if entry.nil?
entry.split(/\s+/).collect { |entry| presence(entry) }.compact
end
def presence(string)
return nil if string.nil?
return nil if string.strip.empty?
string.strip
end
end
# @return [String]
attr_accessor :ip_address, :hostname, :aliases, :comment, :priority
# Creates a new entry from the given options.
class Entry
class << self
# Creates a new Hostsfile::Entry object by parsing a text line. The
# `line` attribute will be in the following format:
#
# @param [Hash] options
# a list of options to create the entry with
# @option options [String] :ip_address
# the IP Address for this entry
# @option options [String] :hostname
# the hostname for this entry
# @option options [String, Array<String>] :aliases
# a alias or array of aliases for this entry
# @option options[String] :comment
# an optional comment for this entry
# @option options [Integer] :priority
# the relative priority of this entry (compared to others)
# 1.2.3.4 hostname [alias[, alias[, alias]]] [# comment [@priority]]
#
# @raise [ArgumentError]
# if neither :ip_address nor :hostname are supplied
def initialize(options = {})
if options[:ip_address].nil? || options[:hostname].nil?
raise ArgumentError, ':ip_address and :hostname are both required options'
# @param [String] line
# the line to parse
# @return [Entry]
# a new entry object
def parse(line)
entry, comment = extract_comment(line)
comment, priority = extract_priority(comment)
entries = extract_entries(entry)
# Return nil if the line is empty
return nil if entries.nil? || entries.empty?
# If /etc/hosts has a broken content we throw a descriptive exception
if entries[0].nil?
raise ArgumentError, "/etc/hosts has a line without IP address: #{line}"
end
if entries[1].nil?
raise ArgumentError, "/etc/hosts has a line without hostname: #{line}"
end
@ip_address = IPAddr.new(remove_ip_scope(options[:ip_address]))
@hostname = options[:hostname]
@aliases = [options[:aliases]].flatten.compact
@comment = options[:comment]
@priority = options[:priority] || calculated_priority
end
# Set a the new priority for an entry.
#
# @param [Integer] new_priority
# the new priority to set
def priority=(new_priority)
@calculated_priority = false
@priority = new_priority
end
# The line representation of this entry.
#
# @return [String]
# the string representation of this entry
def to_line
hosts = [hostname, aliases].flatten.join(' ')
comments = "# #{comment}".strip
comments << " @#{priority}" unless priority.nil? || @calculated_priority
comments = comments.strip
comments = nil if comments == '#'
[ip_address, hosts, comments].compact.join("\t").strip
end
# Returns true if priority is calculated
#
# @return [Boolean]
# true if priority is calculated and false otherwise
def calculated_priority?
@calculated_priority
return self.new(
ip_address: entries[0],
hostname: entries[1],
aliases: entries[2..-1],
comment: comment,
priority: priority,
)
end
private
# Calculates the relative priority of this entry.
#
# @return [Integer]
# the relative priority of this item
def calculated_priority
@calculated_priority = true
return 82 if ip_address == IPAddr.new('127.0.0.1')
return 81 if ip_address == IPAddr.new('::1')
return 80 if IPAddr.new('127.0.0.0/8').include?(ip_address) # local
return 60 if ip_address.ipv4? # ipv4
return 20 if ip_address.ipv6? # ipv6
00
def extract_comment(line)
return nil if presence(line).nil?
line.split('#', 2).collect { |part| presence(part) }
end
# Removes the scopes pieces of the address, because reasons.
#
# @see https://bugs.ruby-lang.org/issues/8464
# @see https://github.com/customink-webops/hostsfile/issues/51
#
# @return [String, nil]
#
def remove_ip_scope(address)
return nil if address.nil?
address.to_s.sub(/%.*/, '')
def extract_priority(comment)
return nil if comment.nil?
if comment.include?('@')
comment.split('@', 2).collect { |part| presence(part) }
else
[comment, nil]
end
end
def extract_entries(entry)
return nil if entry.nil?
entry.split(/\s+/).collect { |entry| presence(entry) }.compact
end
def presence(string)
return nil if string.nil?
return nil if string.strip.empty?
string.strip
end
end
# @return [String]
attr_accessor :ip_address, :hostname, :aliases, :comment, :priority
# Creates a new entry from the given options.
#
# @param [Hash] options
# a list of options to create the entry with
# @option options [String] :ip_address
# the IP Address for this entry
# @option options [String] :hostname
# the hostname for this entry
# @option options [String, Array<String>] :aliases
# a alias or array of aliases for this entry
# @option options[String] :comment
# an optional comment for this entry
# @option options [Fixnum] :priority
# the relative priority of this entry (compared to others)
#
# @raise [ArgumentError]
# if neither :ip_address nor :hostname are supplied
def initialize(options = {})
if options[:ip_address].nil? || options[:hostname].nil?
raise ArgumentError, ':ip_address and :hostname are both required options'
end
@ip_address = IPAddr.new(remove_ip_scope(options[:ip_address]))
@hostname = options[:hostname]
@aliases = [options[:aliases]].flatten.compact
@comment = options[:comment]
@priority = options[:priority] || calculated_priority
end
# Set a the new priority for an entry.
#
# @param [Fixnum] new_priority
# the new priority to set
def priority=(new_priority)
@calculated_priority = false
@priority = new_priority
end
# The line representation of this entry.
#
# @return [String]
# the string representation of this entry
def to_line
hosts = [hostname, aliases].flatten.join(' ')
comments = "# #{comment.to_s}".strip
comments << " @#{priority}" unless priority.nil? || @calculated_priority
comments = comments.strip
comments = nil if comments == '#'
[ip_address, hosts, comments].compact.join("\t").strip
end
# Returns true if priority is calculated
#
# @return [Boolean]
# true if priority is calculated and false otherwise
def calculated_priority?
@calculated_priority
end
private
# Calculates the relative priority of this entry.
#
# @return [Fixnum]
# the relative priority of this item
def calculated_priority
@calculated_priority = true
return 81 if ip_address == IPAddr.new('127.0.0.1')
return 80 if IPAddr.new('127.0.0.0/8').include?(ip_address) # local
return 60 if ip_address.ipv4? # ipv4
return 20 if ip_address.ipv6? # ipv6
return 00
end
# Removes the scopes pieces of the address, because reasons.
#
# @see https://bugs.ruby-lang.org/issues/8464
# @see https://github.com/customink-webops/hostsfile/issues/51
#
# @return [String, nil]
#
def remove_ip_scope(address)
return nil if address.nil?
address.to_s.sub(/%.*/, '')
end
end

View File

@@ -3,8 +3,8 @@
# Cookbook:: hostsfile
# Library:: manipulator
#
# Copyright:: 2012-2013, Seth Vargo
# Copyright:: 2012, CustomInk, LCC
# Copyright 2012-2013, Seth Vargo
# Copyright 2012, CustomInk, LCC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -20,283 +20,274 @@
#
require 'chef/application'
require 'openssl'
require 'digest/sha2'
module HostsFile
class Manipulator
attr_reader :node
attr_reader :entries
class Manipulator
attr_reader :node
attr_reader :entries
# Create a new Manipulator object (aka an /etc/hosts manipulator). If a
# hostsfile is not found, an exception is raised.
#
# @param [Chef::node] node
# the current Chef node
# @return [Manipulator]
# a class designed to manipulate the node's /etc/hosts file
def initialize(node)
@node = node
# Create a new Manipulator object (aka an /etc/hosts manipulator). If a
# hostsfile is not found, an exception is raised.
#
# @param [Chef::node] node
# the current Chef node
# @return [Manipulator]
# a class designed to manipulate the node's /etc/hosts file
def initialize(node)
@node = node
# Fail if no hostsfile is found
unless ::File.exist?(hostsfile_path)
raise "No hostsfile exists at `#{hostsfile_path}'!"
end
@entries = []
collect_and_flatten(::File.readlines(hostsfile_path))
# Fail if no hostsfile is found
unless ::File.exists?(hostsfile_path)
raise RuntimeError, "No hostsfile exists at `#{hostsfile_path}'!"
end
# Return a list of all IP Addresses for this hostsfile.
#
# @return [Array<IPAddr>]
# the list of IP Addresses
def ip_addresses
@entries.collect(&:ip_address).compact || []
end
@entries = []
collect_and_flatten(::File.readlines(hostsfile_path))
end
# Add a new record to the hostsfile.
#
# @param [Hash] options
# a list of options to create the entry with
# @option options [String] :ip_address
# the IP Address for this entry
# @option options [String] :hostname
# the hostname for this entry
# @option options [String, Array<String>] :aliases
# a alias or array of aliases for this entry
# @option options[String] :comment
# an optional comment for this entry
# @option options [Integer] :priority
# the relative priority of this entry (compared to others)
def add(options = {})
entry = HostsFile::Entry.new(
ip_address: options[:ip_address],
hostname: options[:hostname],
aliases: options[:aliases],
comment: options[:comment],
priority: options[:priority]
)
# Return a list of all IP Addresses for this hostsfile.
#
# @return [Array<IPAddr>]
# the list of IP Addresses
def ip_addresses
@entries.collect do |entry|
entry.ip_address
end.compact || []
end
# Add a new record to the hostsfile.
#
# @param [Hash] options
# a list of options to create the entry with
# @option options [String] :ip_address
# the IP Address for this entry
# @option options [String] :hostname
# the hostname for this entry
# @option options [String, Array<String>] :aliases
# a alias or array of aliases for this entry
# @option options[String] :comment
# an optional comment for this entry
# @option options [Fixnum] :priority
# the relative priority of this entry (compared to others)
def add(options = {})
entry = Entry.new(
ip_address: options[:ip_address],
hostname: options[:hostname],
aliases: options[:aliases],
comment: options[:comment],
priority: options[:priority],
)
@entries << entry
remove_existing_hostnames(entry) if options[:unique]
end
# Update an existing entry. This method will do nothing if the entry
# does not exist.
#
# @param (see #add)
def update(options = {})
if entry = find_entry_by_ip_address(options[:ip_address])
entry.hostname = options[:hostname]
entry.aliases = options[:aliases]
entry.comment = options[:comment]
entry.priority = options[:priority]
@entries << entry
remove_existing_hostnames(entry) if options[:unique]
end
end
# Update an existing entry. This method will do nothing if the entry
# does not exist.
#
# @param (see #add)
def update(options = {})
if entry = find_entry_by_ip_address(options[:ip_address])
entry.hostname = options[:hostname]
entry.aliases = options[:aliases]
entry.comment = options[:comment]
entry.priority = options[:priority]
# Append content to an existing entry. This method will add a new entry
# if one does not already exist.
#
# @param (see #add)
def append(options = {})
if entry = find_entry_by_ip_address(options[:ip_address])
hosts = normalize(entry.hostname, entry.aliases, options[:hostname], options[:aliases])
entry.hostname = hosts.shift
entry.aliases = hosts
remove_existing_hostnames(entry) if options[:unique]
unless entry.comment && options[:comment] && entry.comment.include?(options[:comment])
entry.comment = normalize(entry.comment, options[:comment]).join(', ')
end
end
# Append content to an existing entry. This method will add a new entry
# if one does not already exist.
#
# @param (see #add)
def append(options = {})
if entry = find_entry_by_ip_address(options[:ip_address])
hosts = normalize(entry.hostname, entry.aliases, options[:hostname], options[:aliases])
entry.hostname = hosts.shift
entry.aliases = hosts
unless entry.comment && options[:comment] && entry.comment.include?(options[:comment])
entry.comment = normalize(entry.comment, options[:comment]).join(', ')
end
remove_existing_hostnames(entry) if options[:unique]
else
add(options)
end
end
# Remove an entry by it's IP Address
#
# @param [String] ip_address
# the IP Address of the entry to remove
def remove(ip_address)
if entry = find_entry_by_ip_address(ip_address)
@entries.delete(entry)
end
end
# Save the new hostsfile to the target machine. This method will only write the
# hostsfile if the current version has changed. In other words, it is convergent.
def save
file = Chef::Resource::File.new(hostsfile_path, node.run_context)
file.content(new_content)
file.atomic_update false if docker_guest?
file.run_action(:create)
end
# Determine if the content of the hostfile has changed by comparing sha
# values of existing file and new content
#
# @return [Boolean]
def content_changed?
new_sha = OpenSSL::Digest::SHA512.hexdigest(new_content)
new_sha != current_sha
end
# Find an entry by the given IP Address.
#
# @param [String] ip_address
# the IP Address of the entry to find
# @return [Entry, nil]
# the corresponding entry object, or nil if it does not exist
def find_entry_by_ip_address(ip_address)
@entries.find do |entry|
!entry.ip_address.nil? && entry.ip_address == ip_address
end
end
# Determine if the current hostsfile contains the given resource. This
# is really just a proxy to {find_resource_by_ip_address} /
#
# @param [Chef::Resource] resource
#
# @return [Boolean]
def contains?(resource)
!!find_entry_by_ip_address(resource.ip_address)
end
private
# Determine if we are running inside a Docker container
#
# @return [Boolean]
def docker_guest?
node['virtualization'] && node['virtualization']['systems'] &&
node['virtualization']['systems']['docker'] && node['virtualization']['systems']['docker'] == 'guest'
end
# The path to the current hostsfile.
#
# @return [String]
# the full path to the hostsfile, depending on the operating system
# can also be overriden in the node attributes
def hostsfile_path
return @hostsfile_path if @hostsfile_path
@hostsfile_path = node['hostsfile']['path'] || case node['platform_family']
when 'windows'
"#{node['kernel']['os_info']['system_directory']}\\drivers\\etc\\hosts"
else
'/etc/hosts'
end
end
# The header of the new hostsfile
#
# @return [Array]
# an array of header comments
def hostsfile_header
lines = []
lines << '#'
lines << '# This file is managed by Chef, using the hostsfile cookbook.'
lines << '# Editing this file by hand is highly discouraged!'
lines << '#'
lines << '# Comments containing an @ sign should not be modified or else'
lines << '# hostsfile will be unable to guarantee relative priority in'
lines << '# future Chef runs!'
lines << '#'
lines << ''
end
# The content that will be written to the hostfile
#
# @return [String]
# the full contents of the hostfile to be written
def new_content
entries = hostsfile_header
entries += unique_entries.map(&:to_line)
entries << ''
entries.join("\n")
end
# The current sha of the system hostsfile.
#
# @return [String]
# the sha of the current hostsfile
def current_sha
@current_sha ||= OpenSSL::Digest::SHA512.hexdigest(File.read(hostsfile_path))
end
# Normalize the given list of elements into a single array with no nil
# values and no duplicate values.
#
# @param [Object] things
#
# @return [Array]
# a normalized array of things
def normalize(*things)
things.flatten.compact.uniq
end
# This is a crazy way of ensuring unique objects in an array using a Hash.
#
# @return [Array]
# the sorted list of entires that are unique
def unique_entries
entries = Hash[*@entries.map { |entry| [entry.ip_address, entry] }.flatten].values
entries.sort_by { |e| [-e.priority.to_i, e.hostname.to_s] }
end
# Takes /etc/hosts file contents and builds a flattened entries
# array so that each IP address has only one line and multiple hostnames
# are flattened into a list of aliases.
#
# @param [Array] contents
# Array of lines from /etc/hosts file
def collect_and_flatten(contents)
contents.each do |line|
entry = HostsFile::Entry.parse(line)
next if entry.nil?
append(
ip_address: entry.ip_address,
hostname: entry.hostname,
aliases: entry.aliases,
comment: entry.comment,
priority: !entry.calculated_priority? && entry.priority
)
end
end
# Removes duplicate hostnames in other files ensuring they are unique
#
# @param [Entry] entry
# the entry to keep the hostname and aliases from
#
# @return [nil]
def remove_existing_hostnames(entry)
@entries.delete(entry)
changed_hostnames = [entry.hostname, entry.aliases].flatten.uniq
@entries = @entries.collect do |entry|
entry.hostname = nil if changed_hostnames.include?(entry.hostname)
entry.aliases = entry.aliases - changed_hostnames
if entry.hostname.nil?
if entry.aliases.empty?
nil
else
entry.hostname = entry.aliases.shift
entry
end
else
entry
end
end.compact
@entries << entry
nil
remove_existing_hostnames(entry) if options[:unique]
else
add(options)
end
end
# Remove an entry by it's IP Address
#
# @param [String] ip_address
# the IP Address of the entry to remove
def remove(ip_address)
if entry = find_entry_by_ip_address(ip_address)
@entries.delete(entry)
end
end
# Save the new hostsfile to the target machine. This method will only write the
# hostsfile if the current version has changed. In other words, it is convergent.
def save
file = Chef::Resource::File.new(hostsfile_path, node.run_context)
file.content(new_content)
file.run_action(:create)
end
# Determine if the content of the hostfile has changed by comparing sha
# values of existing file and new content
#
# @return [Boolean]
def content_changed?
new_sha = Digest::SHA512.hexdigest(new_content)
new_sha != current_sha
end
# Find an entry by the given IP Address.
#
# @param [String] ip_address
# the IP Address of the entry to find
# @return [Entry, nil]
# the corresponding entry object, or nil if it does not exist
def find_entry_by_ip_address(ip_address)
@entries.find do |entry|
!entry.ip_address.nil? && entry.ip_address == ip_address
end
end
# Determine if the current hostsfile contains the given resource. This
# is really just a proxy to {find_resource_by_ip_address} /
#
# @param [Chef::Resource] resource
#
# @return [Boolean]
def contains?(resource)
!!find_entry_by_ip_address(resource.ip_address)
end
private
# The path to the current hostsfile.
#
# @return [String]
# the full path to the hostsfile, depending on the operating system
# can also be overriden in the node attributes
def hostsfile_path
return @hostsfile_path if @hostsfile_path
@hostsfile_path = node['hostsfile']['path'] || case node['platform_family']
when 'windows'
"#{node['kernel']['os_info']['system_directory']}\\drivers\\etc\\hosts"
else
'/etc/hosts'
end
end
# The header of the new hostsfile
#
# @return [Array]
# an array of header comments
def hostsfile_header
lines = []
lines << '#'
lines << '# This file is managed by Chef, using the hostsfile cookbook.'
lines << '# Editing this file by hand is highly discouraged!'
lines << '#'
lines << '# Comments containing an @ sign should not be modified or else'
lines << '# hostsfile will be unable to guarantee relative priority in'
lines << '# future Chef runs!'
lines << '#'
lines << ''
end
# The content that will be written to the hostfile
#
# @return [String]
# the full contents of the hostfile to be written
def new_content
entries = hostsfile_header
entries += unique_entries.map(&:to_line)
entries << ''
entries.join("\n")
end
# The current sha of the system hostsfile.
#
# @return [String]
# the sha of the current hostsfile
def current_sha
@current_sha ||= Digest::SHA512.hexdigest(File.read(hostsfile_path))
end
# Normalize the given list of elements into a single array with no nil
# values and no duplicate values.
#
# @param [Object] things
#
# @return [Array]
# a normalized array of things
def normalize(*things)
things.flatten.compact.uniq
end
# This is a crazy way of ensuring unique objects in an array using a Hash.
#
# @return [Array]
# the sorted list of entires that are unique
def unique_entries
entries = Hash[*@entries.map { |entry| [entry.ip_address, entry] }.flatten].values
entries.sort_by { |e| [-e.priority.to_i, e.hostname.to_s] }
end
# Takes /etc/hosts file contents and builds a flattened entries
# array so that each IP address has only one line and multiple hostnames
# are flattened into a list of aliases.
#
# @param [Array] contents
# Array of lines from /etc/hosts file
def collect_and_flatten(contents)
contents.each do |line|
entry = Entry.parse(line)
next if entry.nil?
append(
ip_address: entry.ip_address,
hostname: entry.hostname,
aliases: entry.aliases,
comment: entry.comment,
priority: !entry.calculated_priority? && entry.priority,
)
end
end
# Removes duplicate hostnames in other files ensuring they are unique
#
# @param [Entry] entry
# the entry to keep the hostname and aliases from
#
# @return [nil]
def remove_existing_hostnames(entry)
@entries.delete(entry)
changed_hostnames = [entry.hostname, entry.aliases].flatten.uniq
@entries = @entries.collect do |entry|
entry.hostname = nil if changed_hostnames.include?(entry.hostname)
entry.aliases = entry.aliases - changed_hostnames
if entry.hostname.nil?
if entry.aliases.empty?
nil
else
entry.hostname = entry.aliases.shift
entry
end
else
entry
end
end.compact
@entries << entry
nil
end
end

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
name 'hostsfile'
maintainer 'Seth Vargo'
maintainer_email 'sethvargo@gmail.com'
license 'Apache 2.0'
description 'Provides an LWRP for managing the /etc/hosts file'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '2.4.5'

View File

@@ -0,0 +1,138 @@
#
# Author:: Seth Vargo <sethvargo@gmail.com>
# Cookbook:: hostsfile
# Provider:: entry
#
# Copyright 2012-2013, Seth Vargo
# Copyright 2012, CustomInk, LCC
#
# 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.
#
# Support whyrun
def whyrun_supported?
true
end
# Creates a new hosts file entry. If an entry already exists, it will be
# overwritten by this one.
action :create do
if hostsfile.contains?(new_resource)
Chef::Log.debug "#{new_resource} already exists - overwriting."
end
hostsfile.add(
ip_address: new_resource.ip_address,
hostname: new_resource.hostname,
aliases: new_resource.aliases,
comment: new_resource.comment,
priority: new_resource.priority,
unique: new_resource.unique,
)
if hostsfile.content_changed?
converge_by("Create #{new_resource}") { hostsfile.save }
else
Chef::Log.info "#{new_resource} content already matches - nothing to do."
end
end
# Create a new hosts file entry, only if one does not already exist for
# the given IP address. If one exists, this does nothing.
action :create_if_missing do
if hostsfile.contains?(new_resource)
Chef::Log.info "#{new_resource} already exists - skipping create_if_missing."
else
converge_by("Create #{new_resource} if missing") do
hostsfile.add(
ip_address: new_resource.ip_address,
hostname: new_resource.hostname,
aliases: new_resource.aliases,
comment: new_resource.comment,
priority: new_resource.priority,
unique: new_resource.unique,
)
hostsfile.save
end
end
end
# Appends the given data to an existing entry. If an entry does not exist,
# one will be created
action :append do
unless hostsfile.contains?(new_resource)
Chef::Log.info "#{new_resource} does not exist - creating instead."
end
hostsfile.append(
ip_address: new_resource.ip_address,
hostname: new_resource.hostname,
aliases: new_resource.aliases,
comment: new_resource.comment,
priority: new_resource.priority,
unique: new_resource.unique,
)
if hostsfile.content_changed?
converge_by("Append #{new_resource}") { hostsfile.save }
else
Chef::Log.info "#{new_resource} content already matches - nothing to do."
end
end
# Updates the given hosts file entry. Does nothing if the entry does not
# exist.
action :update do
if hostsfile.contains?(new_resource)
hostsfile.update(
ip_address: new_resource.ip_address,
hostname: new_resource.hostname,
aliases: new_resource.aliases,
comment: new_resource.comment,
priority: new_resource.priority,
unique: new_resource.unique,
)
if hostsfile.content_changed?
converge_by("Update #{new_resource}") { hostsfile.save }
else
Chef::Log.info "#{new_resource} content already matches - nothing to do."
end
else
Chef::Log.info "#{new_resource} does not exist - skipping update."
end
end
# Removes an entry from the hosts file. Does nothing if the entry does
# not exist.
action :remove do
if hostsfile.contains?(new_resource)
converge_by("Remove #{new_resource}") do
hostsfile.remove(new_resource.ip_address)
hostsfile.save
end
else
Chef::Log.info "#{new_resource} does not exist - skipping remove."
end
end
private
# The hostsfile object
#
# @return [Manipulator]
# the manipulator for this hostsfile
def hostsfile
@hostsfile ||= Manipulator.new(node)
end

View File

@@ -3,8 +3,8 @@
# Cookbook:: hostsfile
# Resource:: entry
#
# Copyright:: 2012-2013, Seth Vargo
# Copyright:: 2012, CustomInk, LCC
# Copyright 2012-2013, Seth Vargo
# Copyright 2012, CustomInk, LCC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -19,125 +19,18 @@
# limitations under the License.
#
# List of all actions supported by the provider
actions :create, :create_if_missing, :append, :update, :remove
# Make create the default action
default_action :create
# Required attributes
property :ip_address, String, name_property: true
property :hostname, String
attribute :ip_address, kind_of: String, name_attribute: true
attribute :hostname, kind_of: String
# Optional attributes
property :aliases, Array
property :comment, String
property :priority, Integer
property :unique, [TrueClass, FalseClass]
# Creates a new hosts file entry. If an entry already exists, it will be
# overwritten by this one.
action :create do
if hostsfile.contains?(new_resource)
Chef::Log.debug "#{new_resource} already exists - overwriting."
end
hostsfile.add(
ip_address: new_resource.ip_address,
hostname: new_resource.hostname,
aliases: new_resource.aliases,
comment: new_resource.comment,
priority: new_resource.priority,
unique: new_resource.unique
)
if hostsfile.content_changed?
converge_by("Create #{new_resource}") { hostsfile.save }
else
Chef::Log.info "#{new_resource} content already matches - nothing to do."
end
end
# Create a new hosts file entry, only if one does not already exist for
# the given IP address. If one exists, this does nothing.
action :create_if_missing do
if hostsfile.contains?(new_resource)
Chef::Log.info "#{new_resource} already exists - skipping create_if_missing."
else
converge_by("Create #{new_resource} if missing") do
hostsfile.add(
ip_address: new_resource.ip_address,
hostname: new_resource.hostname,
aliases: new_resource.aliases,
comment: new_resource.comment,
priority: new_resource.priority,
unique: new_resource.unique
)
hostsfile.save
end
end
end
# Appends the given data to an existing entry. If an entry does not exist,
# one will be created
action :append do
unless hostsfile.contains?(new_resource)
Chef::Log.info "#{new_resource} does not exist - creating instead."
end
hostsfile.append(
ip_address: new_resource.ip_address,
hostname: new_resource.hostname,
aliases: new_resource.aliases,
comment: new_resource.comment,
priority: new_resource.priority,
unique: new_resource.unique
)
if hostsfile.content_changed?
converge_by("Append #{new_resource}") { hostsfile.save }
else
Chef::Log.info "#{new_resource} content already matches - nothing to do."
end
end
# Updates the given hosts file entry. Does nothing if the entry does not
# exist.
action :update do
if hostsfile.contains?(new_resource)
hostsfile.update(
ip_address: new_resource.ip_address,
hostname: new_resource.hostname,
aliases: new_resource.aliases,
comment: new_resource.comment,
priority: new_resource.priority,
unique: new_resource.unique
)
if hostsfile.content_changed?
converge_by("Update #{new_resource}") { hostsfile.save }
else
Chef::Log.info "#{new_resource} content already matches - nothing to do."
end
else
Chef::Log.info "#{new_resource} does not exist - skipping update."
end
end
# Removes an entry from the hosts file. Does nothing if the entry does
# not exist.
action :remove do
if hostsfile.contains?(new_resource)
converge_by("Remove #{new_resource}") do
hostsfile.remove(new_resource.ip_address)
hostsfile.save
end
else
Chef::Log.info "#{new_resource} does not exist - skipping remove."
end
end
action_class do
# The hostsfile object
#
# @return [Manipulator]
# the manipulator for this hostsfile
def hostsfile
@hostsfile ||= HostsFile::Manipulator.new(node)
end
end
attribute :aliases, kind_of: Array
attribute :comment, kind_of: String
attribute :priority, kind_of: Fixnum
attribute :unique, kind_of: [TrueClass, FalseClass]

View File

@@ -31,6 +31,5 @@
],
"gems": [
],
"eager_load_libraries": true
]
}

View File

@@ -32,6 +32,5 @@
],
"gems": [
],
"eager_load_libraries": true
]
}

View File

@@ -2,19 +2,6 @@
This file is used to list changes made in each version of the mingw cookbook.
## 2.1.3 - *2021-08-31*
- Standardise files with files in sous-chefs/repo-management
## 2.1.1 (2020-06-02)
- Resolve cookstyle 5.8 warnings - [@tas50](https://github.com/tas50)
- Require Chef 12.15+ - [@tas50](https://github.com/tas50)
- Fix compatibility with Chef Infra Client 16 - [@xorimabot](https://github.com/xorimabot)
- resolved cookstyle error: resources/get.rb:26:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName`
- resolved cookstyle error: resources/msys2_package.rb:31:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName`
- resolved cookstyle error: resources/tdm_gcc.rb:26:1 warning: `ChefDeprecations/ResourceUsesOnlyResourceName`
## 2.1.0 (2018-07-24)
- refactor msys2 package source and checksum to attributes

View File

@@ -0,0 +1,2 @@
Please refer to
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD

View File

@@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -12,7 +12,7 @@ Installs a mingw/msys based compiler tools chain on windows. This is required fo
### Chef
- Chef 12.15+
- Chef 12.5+
### Cookbooks

View File

@@ -1,115 +0,0 @@
# Put files/directories that should be ignored in this file when uploading
# to a Chef Infra Server or Supermarket.
# Lines that start with '# ' are comments.
# OS generated files #
######################
.DS_Store
ehthumbs.db
Icon?
nohup.out
Thumbs.db
.envrc
# EDITORS #
###########
.#*
.project
.settings
*_flymake
*_flymake.*
*.bak
*.sw[a-z]
*.tmproj
*~
\#*
REVISION
TAGS*
tmtags
.vscode
.editorconfig
## COMPILED ##
##############
*.class
*.com
*.dll
*.exe
*.o
*.pyc
*.so
*/rdoc/
a.out
mkmf.log
# Testing #
###########
.circleci/*
.codeclimate.yml
.delivery/*
.foodcritic
.kitchen*
.mdlrc
.overcommit.yml
.rspec
.rubocop.yml
.travis.yml
.watchr
.yamllint
azure-pipelines.yml
Dangerfile
examples/*
features/*
Guardfile
kitchen.yml*
mlc_config.json
Procfile
Rakefile
spec/*
test/*
# SCM #
#######
.git
.gitattributes
.gitconfig
.github/*
.gitignore
.gitkeep
.gitmodules
.svn
*/.bzr/*
*/.git
*/.hg/*
*/.svn/*
# Berkshelf #
#############
Berksfile
Berksfile.lock
cookbooks/*
tmp
# Bundler #
###########
vendor/*
Gemfile
Gemfile.lock
# Policyfile #
##############
Policyfile.rb
Policyfile.lock.json
# Documentation #
#############
CODE_OF_CONDUCT*
CONTRIBUTING*
documentation/*
TESTING*
UPGRADING*
# Vagrant #
###########
.vagrant
Vagrantfile

View File

@@ -2,7 +2,7 @@
# Cookbook:: mingw
# Library:: _helper
#
# Copyright:: 2016-2019, Chef Software, Inc.
# Copyright:: 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.
@@ -35,4 +35,4 @@ module Mingw
end
end
Chef::Resource.include Mingw::Helper
Chef::Resource.send(:include, Mingw::Helper)

File diff suppressed because one or more lines are too long

View File

@@ -1,14 +0,0 @@
name 'mingw'
maintainer 'Chef Software, Inc.'
maintainer_email 'cookbooks@chef.io'
license 'Apache-2.0'
description 'Installs a mingw/msys based toolchain on windows'
version '2.1.3'
supports 'windows'
depends 'seven_zip'
source_url 'https://github.com/chef-cookbooks/mingw'
issues_url 'https://github.com/chef-cookbooks/mingw/issues'
chef_version '>= 12.15'

View File

@@ -2,7 +2,7 @@
# Cookbook:: mingw
# Recipe:: default
#
# Copyright:: 2016-2019, Chef Software, Inc.
# Copyright:: 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.

View File

@@ -2,7 +2,7 @@
# Cookbook:: mingw
# Resource:: get
#
# Copyright:: 2016-2019, Chef Software, Inc.
# Copyright:: 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.
@@ -23,6 +23,8 @@
property :package, String, name_property: true
property :root, String, required: true
resource_name :mingw_get
action_class do
def mingw_do_action(action_cmd)
seven_zip_archive "fetching mingw-get to #{win_friendly_path(root)}" do

View File

@@ -2,7 +2,7 @@
# Cookbook:: mingw
# Resource:: msys2_package
#
# Copyright:: 2016-2019, Chef Software, Inc.
# Copyright:: 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,16 +19,16 @@
# Installs msys2 base system and installs/upgrades packages within in.
#
# Where's the version flag? Where's idempotence you say? Well f*** you
# for trying to version your product. This is arch. They live on the edge.
# You never get anything but the latest version. And if that's broken...
# well that's your problem isn't it? And they don't believe in preserving
# older versions. Good luck!
# Where's the version flag? Where's idempotence you say? Well f*** you
# for trying to version your product. This is arch. They live on the edge.
# You never get anything but the latest version. And if that's broken...
# well that's your problem isn't it? And they don't believe in preserving
# older versions. Good luck!
property :package, String, name_property: true
property :root, String, required: true
provides :msys2_package
resource_name :msys2_package
action_class do
#
@@ -97,7 +97,7 @@ action_class do
cookbook 'mingw'
end
# $HOME is using files from /etc/skel. The home-directory creation step
# $HOME is using files from /etc/skel. The home-directory creation step
# will automatically be performed if other users log in - so if you wish
# to globally modify user first time setup, edit /etc/skel or add
# "post-setup" steps to /etc/post-install/
@@ -125,10 +125,10 @@ action :install do
msys2_do_action("installing #{package}", "pacman -S --needed --noconfirm #{package}")
end
# Package name is ignored. This is arch. Why would you ever upgrade a single
# package and its deps? That'll just break everything else that ever depended
# on a different version of that dep. Because arch is wonderful like that.
# So you only get the choice to move everything to latest or not... it's the
# Package name is ignored. This is arch. Why would you ever upgrade a single
# package and its deps? That'll just break everything else that ever depended
# on a different version of that dep. Because arch is wonderful like that.
# So you only get the choice to move everything to latest or not... it's the
# most agile development possible!
action :upgrade do
msys2_do_action("upgrading #{package}", "pacman -Syu --noconfirm #{package}")

View File

@@ -2,7 +2,7 @@
# Cookbook:: mingw
# Resource:: tdm_gcc
#
# Copyright:: 2016-2019, Chef Software, Inc.
# Copyright:: 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.
@@ -23,6 +23,8 @@ property :flavor, Symbol, is: [:sjlj_32, :seh_sjlj_64], default: :seh_sjlj_64
property :root, String, required: true
property :version, String, is: ['5.1.0'], name_property: true
resource_name :mingw_tdm_gcc
tdm_gcc_64 = {
'http://iweb.dl.sourceforge.net/project/tdm-gcc/TDM-GCC%205%20series/5.1.0-tdm64-1/gcc-5.1.0-tdm64-1-core.tar.lzma' =>
'29393aac890847089ad1e93f81a28f6744b1609c00b25afca818f3903e42e4bd',

View File

@@ -2,13 +2,6 @@
All notable changes to this project will be documented in this file.
## 8.7.4 - 2020-09-16
- resolved cookstyle error: spec/mysql_client_installation_package_spec.rb:4:48 warning: `ChefDeprecations/DeprecatedChefSpecPlatform`
- resolved cookstyle error: spec/mysql_server_installation_package_spec.rb:4:48 warning: `ChefDeprecations/DeprecatedChefSpecPlatform`
- Use mysql_test cookbook attributes for testing
- Cookstyle Bot Auto Corrections with Cookstyle 6.17.6
## 8.7.3 - 2020-07-22
- restore resource_name in mysql_service for Chef Infra Client < 16

View File

@@ -3,48 +3,48 @@ module MysqlCookbook
require 'shellwords'
def el6?
return true if platform_family?('rhel') && node['platform_version'].to_i == 6
return true if node['platform_family'] == 'rhel' && node['platform_version'].to_i == 6
false
end
def el7?
return true if platform_family?('rhel') && node['platform_version'].to_i == 7
return true if node['platform_family'] == 'rhel' && node['platform_version'].to_i == 7
false
end
def fedora?
return true if platform_family?('fedora')
return true if node['platform_family'] == 'fedora'
false
end
def suse?
return true if platform_family?('suse')
return true if node['platform_family'] == 'suse'
false
end
def jessie?
return true if platform?('debian') && node['platform_version'].to_i == 8
return true if node['platform'] == 'debian' && node['platform_version'].to_i == 8
false
end
def stretch?
return true if platform?('debian') && node['platform_version'].to_i == 9
return true if node['platform'] == 'debian' && node['platform_version'].to_i == 9
false
end
def trusty?
return true if platform?('ubuntu') && node['platform_version'] == '14.04'
return true if platform?('linuxmint') && node['platform_version'] =~ /^17\.[0-9]$/
return true if node['platform'] == 'ubuntu' && node['platform_version'] == '14.04'
return true if node['platform'] == 'linuxmint' && node['platform_version'] =~ /^17\.[0-9]$/
false
end
def xenial?
return true if platform?('ubuntu') && node['platform_version'] == '16.04'
return true if node['platform'] == 'ubuntu' && node['platform_version'] == '16.04'
false
end
def bionic?
return true if platform?('ubuntu') && node['platform_version'] == '18.04'
return true if node['platform'] == 'ubuntu' && node['platform_version'] == '18.04'
false
end
@@ -70,7 +70,7 @@ module MysqlCookbook
# rhelish
return '5.6' if el6?
return '5.6' if el7?
return '5.6' if platform?('amazon')
return '5.6' if node['platform'] == 'amazon'
# debian
return '5.5' if jessie?
@@ -81,7 +81,7 @@ module MysqlCookbook
return '5.7' if bionic?
# misc
return '5.6' if platform?('freebsd')
return '5.6' if node['platform'] == 'freebsd'
return '5.7' if fedora?
return '5.6' if suse?
end
@@ -105,25 +105,25 @@ module MysqlCookbook
def default_client_package_name
return %w(mysql mysql-devel) if major_version == '5.1' && el6?
return %w(mysql mysql-devel) if el7?
return ['mysql55', 'mysql55-devel.x86_64'] if major_version == '5.5' && platform?('amazon')
return ['mysql56', 'mysql56-devel.x86_64'] if major_version == '5.6' && platform?('amazon')
return ['mysql57', 'mysql57-devel.x86_64'] if major_version == '5.7' && platform?('amazon')
return ['mysql-client-5.5', 'libmysqlclient-dev'] if major_version == '5.5' && platform_family?('debian')
return ['mysql-client-5.6', 'libmysqlclient-dev'] if major_version == '5.6' && platform_family?('debian')
return ['mysql-client-5.7', 'libmysqlclient-dev'] if major_version == '5.7' && platform_family?('debian')
return 'mysql-community-server-client' if major_version == '5.6' && platform_family?('suse')
return ['mysql55', 'mysql55-devel.x86_64'] if major_version == '5.5' && node['platform'] == 'amazon'
return ['mysql56', 'mysql56-devel.x86_64'] if major_version == '5.6' && node['platform'] == 'amazon'
return ['mysql57', 'mysql57-devel.x86_64'] if major_version == '5.7' && node['platform'] == 'amazon'
return ['mysql-client-5.5', 'libmysqlclient-dev'] if major_version == '5.5' && node['platform_family'] == 'debian'
return ['mysql-client-5.6', 'libmysqlclient-dev'] if major_version == '5.6' && node['platform_family'] == 'debian'
return ['mysql-client-5.7', 'libmysqlclient-dev'] if major_version == '5.7' && node['platform_family'] == 'debian'
return 'mysql-community-server-client' if major_version == '5.6' && node['platform_family'] == 'suse'
%w(mysql-community-client mysql-community-devel)
end
def default_server_package_name
return 'mysql-server' if major_version == '5.1' && el6?
return 'mysql55-server' if major_version == '5.5' && platform?('amazon')
return 'mysql56-server' if major_version == '5.6' && platform?('amazon')
return 'mysql57-server' if major_version == '5.7' && platform?('amazon')
return 'mysql-server-5.5' if major_version == '5.5' && platform_family?('debian')
return 'mysql-server-5.6' if major_version == '5.6' && platform_family?('debian')
return 'mysql-server-5.7' if major_version == '5.7' && platform_family?('debian')
return 'mysql-community-server' if major_version == '5.6' && platform_family?('suse')
return 'mysql55-server' if major_version == '5.5' && node['platform'] == 'amazon'
return 'mysql56-server' if major_version == '5.6' && node['platform'] == 'amazon'
return 'mysql57-server' if major_version == '5.7' && node['platform'] == 'amazon'
return 'mysql-server-5.5' if major_version == '5.5' && node['platform_family'] == 'debian'
return 'mysql-server-5.6' if major_version == '5.6' && node['platform_family'] == 'debian'
return 'mysql-server-5.7' if major_version == '5.7' && node['platform_family'] == 'debian'
return 'mysql-community-server' if major_version == '5.6' && node['platform_family'] == 'suse'
'mysql-community-server'
end
@@ -132,33 +132,33 @@ module MysqlCookbook
end
def run_dir
return "#{prefix_dir}/var/run/#{mysql_name}" if platform_family?('rhel')
return "/run/#{mysql_name}" if platform_family?('debian')
return "#{prefix_dir}/var/run/#{mysql_name}" if node['platform_family'] == 'rhel'
return "/run/#{mysql_name}" if node['platform_family'] == 'debian'
"/var/run/#{mysql_name}"
end
def prefix_dir
return "/opt/mysql#{pkg_ver_string}" if platform_family?('omnios')
return '/opt/local' if platform_family?('smartos')
return "/opt/mysql#{pkg_ver_string}" if node['platform_family'] == 'omnios'
return '/opt/local' if node['platform_family'] == 'smartos'
return "/opt/rh/#{scl_name}/root" if scl_package?
end
def scl_name
return unless platform_family?('rhel')
return unless node['platform_family'] == 'rhel'
return 'mysql51' if version == '5.1' && node['platform_version'].to_i == 5
return 'mysql55' if version == '5.5' && node['platform_version'].to_i == 5
end
def scl_package?
return unless platform_family?('rhel')
return unless node['platform_family'] == 'rhel'
return true if version == '5.1' && node['platform_version'].to_i == 5
return true if version == '5.5' && node['platform_version'].to_i == 5
false
end
def etc_dir
return "/opt/mysql#{pkg_ver_string}/etc/#{mysql_name}" if platform_family?('omnios')
return "#{prefix_dir}/etc/#{mysql_name}" if platform_family?('smartos')
return "/opt/mysql#{pkg_ver_string}/etc/#{mysql_name}" if node['platform_family'] == 'omnios'
return "#{prefix_dir}/etc/#{mysql_name}" if node['platform_family'] == 'smartos'
"#{prefix_dir}/etc/#{mysql_name}"
end
@@ -167,10 +167,10 @@ module MysqlCookbook
end
def system_service_name
return 'mysql51-mysqld' if platform_family?('rhel') && scl_name == 'mysql51'
return 'mysql55-mysqld' if platform_family?('rhel') && scl_name == 'mysql55'
return 'mysqld' if platform_family?('rhel')
return 'mysqld' if platform_family?('fedora')
return 'mysql51-mysqld' if node['platform_family'] == 'rhel' && scl_name == 'mysql51'
return 'mysql55-mysqld' if node['platform_family'] == 'rhel' && scl_name == 'mysql55'
return 'mysqld' if node['platform_family'] == 'rhel'
return 'mysqld' if node['platform_family'] == 'fedora'
'mysql' # not one of the above
end
@@ -191,7 +191,7 @@ module MysqlCookbook
end
def log_dir
return "/var/adm/log/#{mysql_name}" if platform_family?('omnios')
return "/var/adm/log/#{mysql_name}" if node['platform_family'] == 'omnios'
"#{prefix_dir}/var/log/#{mysql_name}"
end
@@ -258,8 +258,8 @@ EOSQL
end
def mysql_install_db_bin
return "#{base_dir}/scripts/mysql_install_db" if platform_family?('omnios')
return "#{prefix_dir}/bin/mysql_install_db" if platform_family?('smartos')
return "#{base_dir}/scripts/mysql_install_db" if node['platform_family'] == 'omnios'
return "#{prefix_dir}/bin/mysql_install_db" if node['platform_family'] == 'smartos'
'mysql_install_db'
end
@@ -273,14 +273,14 @@ EOSQL
end
def mysqladmin_bin
return "#{prefix_dir}/bin/mysqladmin" if platform_family?('smartos')
return "#{prefix_dir}/bin/mysqladmin" if node['platform_family'] == 'smartos'
return 'mysqladmin' if scl_package?
"#{prefix_dir}/usr/bin/mysqladmin"
end
def mysqld_bin
return "#{prefix_dir}/libexec/mysqld" if platform_family?('smartos')
return "#{base_dir}/bin/mysqld" if platform_family?('omnios')
return "#{prefix_dir}/libexec/mysqld" if node['platform_family'] == 'smartos'
return "#{base_dir}/bin/mysqld" if node['platform_family'] == 'omnios'
return '/usr/sbin/mysqld' if fedora? && v56plus
return '/usr/libexec/mysqld' if fedora?
return 'mysqld' if scl_package?
@@ -289,14 +289,14 @@ EOSQL
def mysql_systemd_start_pre
return '/usr/bin/mysqld_pre_systemd' if v57plus && (el7? || fedora?)
return '/usr/bin/mysql-systemd-start pre' if platform_family?('rhel')
return '/usr/bin/mysql-systemd-start pre' if node['platform_family'] == 'rhel'
return '/usr/lib/mysql/mysql-systemd-helper install' if suse?
'/usr/share/mysql/mysql-systemd-start pre'
end
def mysql_systemd
return "/usr/libexec/#{mysql_name}-wait-ready $MAINPID" if v57plus && (el7? || fedora?)
return '/usr/bin/mysql-systemd-start' if platform_family?('rhel')
return '/usr/bin/mysql-systemd-start' if node['platform_family'] == 'rhel'
return '/usr/share/mysql/mysql-systemd-start' if v57plus
"/usr/libexec/#{mysql_name}-wait-ready $MAINPID"
end
@@ -311,8 +311,8 @@ EOSQL
end
def mysqld_safe_bin
return "#{prefix_dir}/bin/mysqld_safe" if platform_family?('smartos')
return "#{base_dir}/bin/mysqld_safe" if platform_family?('omnios')
return "#{prefix_dir}/bin/mysqld_safe" if node['platform_family'] == 'smartos'
return "#{base_dir}/bin/mysqld_safe" if node['platform_family'] == 'omnios'
return 'mysqld_safe' if scl_package?
"#{prefix_dir}/usr/bin/mysqld_safe"
end

View File

@@ -123,7 +123,7 @@ module MysqlCookbook
def configure_apparmor
# Do not add these resource if inside a container
# Only valid on Ubuntu
return if ::File.exist?('/.dockerenv') || ::File.exist?('/.dockerinit') || !platform?('ubuntu')
return if ::File.exist?('/.dockerenv') || ::File.exist?('/.dockerinit') || node['platform'] != 'ubuntu'
# Apparmor
package 'apparmor' do

View File

@@ -1 +1 @@
{"name":"mysql","version":"8.7.4","description":"Provides mysql_service, mysql_config, and mysql_client resources","long_description":"","maintainer":"Sous Chefs","maintainer_email":"help@sous-chefs.org","license":"Apache-2.0","platforms":{"redhat":">= 6.0","centos":">= 6.0","scientific":">= 6.0","oracle":">= 6.0","amazon":">= 0.0.0","fedora":">= 0.0.0","debian":">= 7.0","ubuntu":">= 14.04","opensuseleap":">= 0.0.0","suse":">= 12.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/sous-chefs/mysql","issues_url":"https://github.com/sous-chefs/mysql/issues","chef_version":[[">= 12.7"]],"ohai_version":[]}
{"name":"mysql","version":"8.7.3","description":"Provides mysql_service, mysql_config, and mysql_client resources","long_description":"","maintainer":"Sous Chefs","maintainer_email":"help@sous-chefs.org","license":"Apache-2.0","platforms":{"redhat":">= 6.0","centos":">= 6.0","scientific":">= 6.0","oracle":">= 6.0","amazon":">= 0.0.0","fedora":">= 0.0.0","debian":">= 7.0","ubuntu":">= 14.04","opensuseleap":">= 0.0.0","suse":">= 12.0"},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/sous-chefs/mysql","issues_url":"https://github.com/sous-chefs/mysql/issues","chef_version":[[">= 12.7"]],"ohai_version":[]}

View File

@@ -6,7 +6,7 @@ description 'Provides mysql_service, mysql_config, and mysql_client resour
source_url 'https://github.com/sous-chefs/mysql'
issues_url 'https://github.com/sous-chefs/mysql/issues'
chef_version '>= 12.7'
version '8.7.4'
version '8.7.3'
%w(redhat centos scientific oracle).each do |el|
supports el, '>= 6.0'

Some files were not shown because too many files have changed in this diff Show More