chef 13.11.3 → 13.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +4 -3
- data/README.md +35 -40
- data/Rakefile +18 -22
- data/chef-universal-mingw32.gemspec +1 -1
- data/chef.gemspec +3 -3
- data/lib/chef/client.rb +1 -1
- data/lib/chef/mixin/params_validate.rb +3 -1
- data/lib/chef/provider/script.rb +2 -2
- data/lib/chef/version.rb +1 -1
- data/spec/functional/http/simple_spec.rb +12 -6
- data/spec/functional/resource/remote_file_spec.rb +19 -15
- data/spec/support/platform_helpers.rb +2 -1
- data/tasks/announce.rb +1 -1
- data/tasks/dependencies.rb +5 -39
- data/tasks/maintainers.rb +10 -10
- data/tasks/rspec.rb +2 -2
- data/tasks/templates/prerelease.md.erb +11 -2
- data/tasks/templates/release.md.erb +9 -1
- metadata +6 -248
- data/CONTRIBUTING.md +0 -151
- data/VERSION +0 -1
- data/acceptance/.gitignore +0 -3
- data/acceptance/.shared/kitchen_acceptance/.kitchen.digitalocean.yml +0 -33
- data/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +0 -283
- data/acceptance/.shared/kitchen_acceptance/.kitchen.vagrant.yml +0 -59
- data/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb +0 -68
- data/acceptance/.shared/kitchen_acceptance/metadata.rb +0 -1
- data/acceptance/Gemfile +0 -19
- data/acceptance/Gemfile.lock +0 -266
- data/acceptance/README.md +0 -137
- data/acceptance/basics/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/basics/.acceptance/acceptance-cookbook/metadata.rb +0 -3
- data/acceptance/basics/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
- data/acceptance/basics/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -1
- data/acceptance/basics/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -1
- data/acceptance/basics/.kitchen.yml +0 -4
- data/acceptance/basics/test/integration/chef-current-install/serverspec/chef_client_spec.rb +0 -19
- data/acceptance/basics/test/integration/chef-current-install/serverspec/spec_helper.rb +0 -6
- data/acceptance/basics/test/integration/helpers/serverspec/Gemfile +0 -8
- data/acceptance/data-collector/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/data-collector/.acceptance/acceptance-cookbook/metadata.rb +0 -3
- data/acceptance/data-collector/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -2
- data/acceptance/data-collector/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -2
- data/acceptance/data-collector/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -2
- data/acceptance/data-collector/.acceptance/data-collector-test/.gitignore +0 -16
- data/acceptance/data-collector/.acceptance/data-collector-test/Berksfile +0 -3
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/api.rb +0 -101
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/apigemfile +0 -3
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/client-rb-both-mode.rb +0 -4
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/client-rb-client-mode.rb +0 -4
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/client-rb-no-endpoint.rb +0 -2
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/client-rb-solo-mode.rb +0 -4
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/config.ru +0 -2
- data/acceptance/data-collector/.acceptance/data-collector-test/metadata.rb +0 -7
- data/acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb +0 -44
- data/acceptance/data-collector/.kitchen.yml +0 -9
- data/acceptance/data-collector/Berksfile +0 -3
- data/acceptance/data-collector/test/integration/default/serverspec/default_spec.rb +0 -208
- data/acceptance/data-collector/test/integration/helpers/serverspec/Gemfile +0 -8
- data/acceptance/omnitruck/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/omnitruck/.acceptance/acceptance-cookbook/metadata.rb +0 -1
- data/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
- data/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -1
- data/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -61
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb +0 -43
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb +0 -41
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/metadata.rb +0 -3
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -1
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -1
- data/acceptance/top-cookbooks/.gitignore +0 -1
- data/acceptance/top-cookbooks/.kitchen.chocolatey.yml +0 -6
- data/acceptance/top-cookbooks/.kitchen.iis.yml +0 -4
- data/acceptance/top-cookbooks/.kitchen.learn-the-basics-rhel.yml +0 -7
- data/acceptance/top-cookbooks/.kitchen.learn-the-basics-ubuntu.yml +0 -7
- data/acceptance/top-cookbooks/.kitchen.learn-the-basics-windows.yml +0 -7
- data/acceptance/top-cookbooks/.kitchen.powershell.yml +0 -4
- data/acceptance/top-cookbooks/.kitchen.sql_server.yml +0 -5
- data/acceptance/top-cookbooks/.kitchen.winbox.yml +0 -8
- data/acceptance/top-cookbooks/.kitchen.windows.yml +0 -38
- data/acceptance/trivial/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/trivial/.acceptance/acceptance-cookbook/metadata.rb +0 -2
- data/acceptance/trivial/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
- data/acceptance/trivial/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -1
- data/acceptance/trivial/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -1
- data/acceptance/trivial/.kitchen.yml +0 -7
- data/acceptance/trivial/test/integration/chef-current-install/inspec/chef_client_spec.rb +0 -5
- data/acceptance/windows-service/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/windows-service/.acceptance/acceptance-cookbook/metadata.rb +0 -2
- data/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
- data/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -1
- data/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -1
- data/acceptance/windows-service/.kitchen.yml +0 -7
- data/acceptance/windows-service/test/integration/chef-windows-service/inspec/chef_windows_service_spec.rb +0 -58
- data/distro/common/html/_sources/ctl_chef_client.txt +0 -36
- data/distro/common/html/_sources/ctl_chef_server.txt +0 -341
- data/distro/common/html/_sources/ctl_chef_shell.txt +0 -15
- data/distro/common/html/_sources/ctl_chef_solo.txt +0 -25
- data/distro/common/html/_sources/index.txt +0 -135
- data/distro/common/html/_sources/knife.txt +0 -74
- data/distro/common/html/_sources/knife_bootstrap.txt +0 -56
- data/distro/common/html/_sources/knife_client.txt +0 -151
- data/distro/common/html/_sources/knife_common_options.txt +0 -6
- data/distro/common/html/_sources/knife_configure.txt +0 -29
- data/distro/common/html/_sources/knife_cookbook.txt +0 -236
- data/distro/common/html/_sources/knife_cookbook_site.txt +0 -157
- data/distro/common/html/_sources/knife_data_bag.txt +0 -160
- data/distro/common/html/_sources/knife_delete.txt +0 -26
- data/distro/common/html/_sources/knife_deps.txt +0 -61
- data/distro/common/html/_sources/knife_diff.txt +0 -34
- data/distro/common/html/_sources/knife_download.txt +0 -44
- data/distro/common/html/_sources/knife_edit.txt +0 -26
- data/distro/common/html/_sources/knife_environment.txt +0 -158
- data/distro/common/html/_sources/knife_exec.txt +0 -47
- data/distro/common/html/_sources/knife_index_rebuild.txt +0 -21
- data/distro/common/html/_sources/knife_list.txt +0 -33
- data/distro/common/html/_sources/knife_node.txt +0 -250
- data/distro/common/html/_sources/knife_raw.txt +0 -35
- data/distro/common/html/_sources/knife_recipe_list.txt +0 -23
- data/distro/common/html/_sources/knife_role.txt +0 -157
- data/distro/common/html/_sources/knife_search.txt +0 -53
- data/distro/common/html/_sources/knife_serve.txt +0 -19
- data/distro/common/html/_sources/knife_show.txt +0 -27
- data/distro/common/html/_sources/knife_ssh.txt +0 -43
- data/distro/common/html/_sources/knife_ssl_check.txt +0 -41
- data/distro/common/html/_sources/knife_ssl_fetch.txt +0 -41
- data/distro/common/html/_sources/knife_status.txt +0 -37
- data/distro/common/html/_sources/knife_tag.txt +0 -69
- data/distro/common/html/_sources/knife_upload.txt +0 -49
- data/distro/common/html/_sources/knife_user.txt +0 -127
- data/distro/common/html/_sources/knife_using.txt +0 -43
- data/distro/common/html/_sources/knife_xargs.txt +0 -30
- data/distro/common/html/_static/ajax-loader.gif +0 -0
- data/distro/common/html/_static/basic.css +0 -537
- data/distro/common/html/_static/chef.ico +0 -0
- data/distro/common/html/_static/chef_html_logo.png +0 -0
- data/distro/common/html/_static/comment-bright.png +0 -0
- data/distro/common/html/_static/comment-close.png +0 -0
- data/distro/common/html/_static/comment.png +0 -0
- data/distro/common/html/_static/contents.png +0 -0
- data/distro/common/html/_static/doctools.js +0 -238
- data/distro/common/html/_static/down-pressed.png +0 -0
- data/distro/common/html/_static/down.png +0 -0
- data/distro/common/html/_static/file.png +0 -0
- data/distro/common/html/_static/guide.css +0 -505
- data/distro/common/html/_static/jquery.js +0 -2
- data/distro/common/html/_static/minus.png +0 -0
- data/distro/common/html/_static/navigation.png +0 -0
- data/distro/common/html/_static/plus.png +0 -0
- data/distro/common/html/_static/pygments.css +0 -62
- data/distro/common/html/_static/searchtools.js +0 -622
- data/distro/common/html/_static/underscore.js +0 -31
- data/distro/common/html/_static/up-pressed.png +0 -0
- data/distro/common/html/_static/up.png +0 -0
- data/distro/common/html/_static/websupport.js +0 -808
- data/distro/common/html/ctl_chef_client.html +0 -270
- data/distro/common/html/ctl_chef_server.html +0 -728
- data/distro/common/html/ctl_chef_shell.html +0 -163
- data/distro/common/html/ctl_chef_solo.html +0 -194
- data/distro/common/html/index.html +0 -202
- data/distro/common/html/knife.html +0 -170
- data/distro/common/html/knife_bootstrap.html +0 -285
- data/distro/common/html/knife_client.html +0 -285
- data/distro/common/html/knife_common_options.html +0 -96
- data/distro/common/html/knife_configure.html +0 -105
- data/distro/common/html/knife_cookbook.html +0 -487
- data/distro/common/html/knife_cookbook_site.html +0 -375
- data/distro/common/html/knife_data_bag.html +0 -374
- data/distro/common/html/knife_delete.html +0 -93
- data/distro/common/html/knife_deps.html +0 -143
- data/distro/common/html/knife_diff.html +0 -123
- data/distro/common/html/knife_download.html +0 -145
- data/distro/common/html/knife_edit.html +0 -89
- data/distro/common/html/knife_environment.html +0 -322
- data/distro/common/html/knife_exec.html +0 -220
- data/distro/common/html/knife_index_rebuild.html +0 -83
- data/distro/common/html/knife_list.html +0 -114
- data/distro/common/html/knife_node.html +0 -458
- data/distro/common/html/knife_raw.html +0 -110
- data/distro/common/html/knife_recipe_list.html +0 -91
- data/distro/common/html/knife_role.html +0 -295
- data/distro/common/html/knife_search.html +0 -203
- data/distro/common/html/knife_serve.html +0 -79
- data/distro/common/html/knife_show.html +0 -104
- data/distro/common/html/knife_ssh.html +0 -177
- data/distro/common/html/knife_ssl_check.html +0 -151
- data/distro/common/html/knife_ssl_fetch.html +0 -151
- data/distro/common/html/knife_status.html +0 -144
- data/distro/common/html/knife_tag.html +0 -138
- data/distro/common/html/knife_upload.html +0 -153
- data/distro/common/html/knife_user.html +0 -242
- data/distro/common/html/knife_using.html +0 -210
- data/distro/common/html/knife_xargs.html +0 -122
- data/distro/common/html/objects.inv +0 -0
- data/distro/common/html/search.html +0 -82
- data/distro/common/html/searchindex.js +0 -1
- data/distro/common/man/man1/README.md +0 -58
- data/distro/common/man/man1/chef-shell.1 +0 -194
- data/distro/common/man/man1/knife-bootstrap.1 +0 -215
- data/distro/common/man/man1/knife-client.1 +0 -443
- data/distro/common/man/man1/knife-configure.1 +0 -161
- data/distro/common/man/man1/knife-cookbook-site.1 +0 -552
- data/distro/common/man/man1/knife-cookbook.1 +0 -770
- data/distro/common/man/man1/knife-data-bag.1 +0 -617
- data/distro/common/man/man1/knife-delete.1 +0 -127
- data/distro/common/man/man1/knife-deps.1 +0 -246
- data/distro/common/man/man1/knife-diff.1 +0 -226
- data/distro/common/man/man1/knife-download.1 +0 -258
- data/distro/common/man/man1/knife-edit.1 +0 -121
- data/distro/common/man/man1/knife-environment.1 +0 -496
- data/distro/common/man/man1/knife-exec.1 +0 -362
- data/distro/common/man/man1/knife-index-rebuild.1 +0 -63
- data/distro/common/man/man1/knife-list.1 +0 -174
- data/distro/common/man/man1/knife-node.1 +0 -716
- data/distro/common/man/man1/knife-raw.1 +0 -172
- data/distro/common/man/man1/knife-recipe-list.1 +0 -85
- data/distro/common/man/man1/knife-role.1 +0 -426
- data/distro/common/man/man1/knife-search.1 +0 -359
- data/distro/common/man/man1/knife-serve.1 +0 -109
- data/distro/common/man/man1/knife-show.1 +0 -160
- data/distro/common/man/man1/knife-ssh.1 +0 -284
- data/distro/common/man/man1/knife-ssl-check.1 +0 -207
- data/distro/common/man/man1/knife-ssl-fetch.1 +0 -207
- data/distro/common/man/man1/knife-status.1 +0 -234
- data/distro/common/man/man1/knife-tag.1 +0 -189
- data/distro/common/man/man1/knife-upload.1 +0 -280
- data/distro/common/man/man1/knife-user.1 +0 -356
- data/distro/common/man/man1/knife-xargs.1 +0 -189
- data/distro/common/man/man1/knife.1 +0 -332
- data/distro/common/man/man8/chef-apply.8 +0 -86
- data/distro/common/man/man8/chef-client.8 +0 -398
- data/distro/common/man/man8/chef-solo.8 +0 -260
- data/distro/common/markdown/README +0 -3
- data/distro/common/markdown/man1/chef-shell.mkd +0 -195
- data/distro/common/markdown/man1/knife-bootstrap.mkd +0 -141
- data/distro/common/markdown/man1/knife-client.mkd +0 -103
- data/distro/common/markdown/man1/knife-configure.mkd +0 -71
- data/distro/common/markdown/man1/knife-cookbook-site.mkd +0 -123
- data/distro/common/markdown/man1/knife-cookbook.mkd +0 -263
- data/distro/common/markdown/man1/knife-data-bag.mkd +0 -121
- data/distro/common/markdown/man1/knife-environment.mkd +0 -151
- data/distro/common/markdown/man1/knife-exec.mkd +0 -42
- data/distro/common/markdown/man1/knife-index.mkd +0 -30
- data/distro/common/markdown/man1/knife-node.mkd +0 -130
- data/distro/common/markdown/man1/knife-role.mkd +0 -85
- data/distro/common/markdown/man1/knife-search.mkd +0 -180
- data/distro/common/markdown/man1/knife-ssh.mkd +0 -69
- data/distro/common/markdown/man1/knife-status.mkd +0 -36
- data/distro/common/markdown/man1/knife-tag.mkd +0 -39
- data/distro/common/markdown/man1/knife.mkd +0 -213
- data/distro/common/markdown/man8/chef-client.mkd +0 -75
- data/distro/common/markdown/man8/chef-expander.mkd +0 -81
- data/distro/common/markdown/man8/chef-expanderctl.mkd +0 -57
- data/distro/common/markdown/man8/chef-server-webui.mkd +0 -121
- data/distro/common/markdown/man8/chef-server.mkd +0 -120
- data/distro/common/markdown/man8/chef-solo.mkd +0 -107
- data/distro/common/markdown/man8/chef-solr.mkd +0 -89
- data/distro/powershell/chef/chef.psm1 +0 -459
- data/tasks/cbgb.rb +0 -84
@@ -1 +0,0 @@
|
|
1
|
-
kitchen "destroy"
|
@@ -1 +0,0 @@
|
|
1
|
-
kitchen "converge"
|
@@ -1 +0,0 @@
|
|
1
|
-
kitchen "verify"
|
@@ -1,19 +0,0 @@
|
|
1
|
-
|
2
|
-
require "spec_helper"
|
3
|
-
|
4
|
-
gem_path = "/opt/chef/embedded/bin/gem"
|
5
|
-
white_list = %w{addressable chef-config json minitest rake}
|
6
|
-
|
7
|
-
describe "gem list" do
|
8
|
-
it "should not have non-whitelisted duplicate gems" do
|
9
|
-
gems = command("#{gem_path} list").stdout
|
10
|
-
|
11
|
-
duplicate_gems = gems.lines().select { |l| l.include?(",") }.collect { |l| l.split(" ").first }
|
12
|
-
puts "Duplicate gems found: #{duplicate_gems}" if duplicate_gems.length > 0
|
13
|
-
|
14
|
-
non_whitelisted_duplicates = duplicate_gems.select { |l| !white_list.include?(l) }
|
15
|
-
puts "Non white listed duplicates: #{non_whitelisted_duplicates}" if non_whitelisted_duplicates.length > 0
|
16
|
-
|
17
|
-
(non_whitelisted_duplicates.length).should be == 0
|
18
|
-
end
|
19
|
-
end
|
@@ -1,101 +0,0 @@
|
|
1
|
-
require "json"
|
2
|
-
require "sinatra"
|
3
|
-
|
4
|
-
class Chef
|
5
|
-
class Node
|
6
|
-
# dummy class for JSON parsing
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
module ApiHelpers
|
11
|
-
def self.payload_type(payload)
|
12
|
-
message_type = payload["message_type"]
|
13
|
-
status = payload["status"]
|
14
|
-
|
15
|
-
message_type == "run_converge" ? "#{message_type}.#{status}" : message_type
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class Counter
|
20
|
-
class << self
|
21
|
-
attr_accessor :counters
|
22
|
-
|
23
|
-
def counters
|
24
|
-
@counters ||= Hash.new { |h, k| h[k] = 0 }
|
25
|
-
end
|
26
|
-
|
27
|
-
def reset
|
28
|
-
@counters = nil
|
29
|
-
end
|
30
|
-
|
31
|
-
def increment(payload)
|
32
|
-
counter_name = ApiHelpers.payload_type(payload)
|
33
|
-
counters[counter_name] += 1
|
34
|
-
end
|
35
|
-
|
36
|
-
def to_json
|
37
|
-
counters.to_json
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
class MessageCache
|
43
|
-
include ApiHelpers
|
44
|
-
|
45
|
-
class << self
|
46
|
-
attr_accessor :message_cache
|
47
|
-
|
48
|
-
def message_cache
|
49
|
-
@message_cache ||= {}
|
50
|
-
end
|
51
|
-
|
52
|
-
def reset
|
53
|
-
@message_cache = nil
|
54
|
-
end
|
55
|
-
|
56
|
-
def store(payload)
|
57
|
-
cache_key = ApiHelpers.payload_type(payload)
|
58
|
-
|
59
|
-
message_cache[cache_key] = payload
|
60
|
-
end
|
61
|
-
|
62
|
-
def fetch(cache_key)
|
63
|
-
message_cache[cache_key].to_json
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
Counter.reset
|
69
|
-
|
70
|
-
get "/" do
|
71
|
-
"Data Collector API server"
|
72
|
-
end
|
73
|
-
|
74
|
-
get "/reset-counters" do
|
75
|
-
Counter.reset
|
76
|
-
"counters reset"
|
77
|
-
end
|
78
|
-
|
79
|
-
get "/counters" do
|
80
|
-
Counter.to_json
|
81
|
-
end
|
82
|
-
|
83
|
-
get "/cache/:key" do |cache_key|
|
84
|
-
MessageCache.fetch(cache_key)
|
85
|
-
end
|
86
|
-
|
87
|
-
get "/reset-cache" do
|
88
|
-
MessageCache.reset
|
89
|
-
"cache reset"
|
90
|
-
end
|
91
|
-
|
92
|
-
post "/data-collector/v0" do
|
93
|
-
body = request.body.read
|
94
|
-
payload = JSON.load(body)
|
95
|
-
|
96
|
-
Counter.increment(payload)
|
97
|
-
MessageCache.store(payload)
|
98
|
-
|
99
|
-
status 201
|
100
|
-
"message received"
|
101
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
|
2
|
-
embedded_path = "/opt/chef/embedded/bin:#{ENV["PATH"]}"
|
3
|
-
|
4
|
-
api_root_dir = "/var/opt/data_collector_api"
|
5
|
-
|
6
|
-
directory api_root_dir do
|
7
|
-
recursive true
|
8
|
-
end
|
9
|
-
|
10
|
-
cookbook_file ::File.join(api_root_dir, "Gemfile") do
|
11
|
-
source "apigemfile"
|
12
|
-
end
|
13
|
-
|
14
|
-
cookbook_file ::File.join(api_root_dir, "config.ru")
|
15
|
-
|
16
|
-
cookbook_file ::File.join(api_root_dir, "api.rb")
|
17
|
-
|
18
|
-
execute "bundle install --binstubs" do
|
19
|
-
cwd api_root_dir
|
20
|
-
environment({ "PATH" => embedded_path })
|
21
|
-
end
|
22
|
-
|
23
|
-
pid_file = "/var/run/api.pid"
|
24
|
-
running_pid = ::File.exist?(pid_file) ? ::File.read(pid_file).strip : nil
|
25
|
-
|
26
|
-
execute "kill existing API process" do
|
27
|
-
command "kill #{running_pid}"
|
28
|
-
environment({ "PATH" => embedded_path })
|
29
|
-
not_if { running_pid.nil? }
|
30
|
-
end
|
31
|
-
|
32
|
-
execute "start API" do
|
33
|
-
command "bin/rackup -D -P #{pid_file}"
|
34
|
-
environment({ "PATH" => embedded_path })
|
35
|
-
cwd api_root_dir
|
36
|
-
end
|
37
|
-
|
38
|
-
directory "/etc/chef"
|
39
|
-
|
40
|
-
["both-mode", "client-mode", "no-endpoint", "solo-mode"].each do |config_file|
|
41
|
-
cookbook_file "/etc/chef/#{config_file}.rb" do
|
42
|
-
source "client-rb-#{config_file}.rb"
|
43
|
-
end
|
44
|
-
end
|
@@ -1,208 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Author:: Adam Leff (<adamleff@chef.io)
|
3
|
-
#
|
4
|
-
# Copyright:: Copyright 2012-2016, Chef Software Inc.
|
5
|
-
# License:: Apache License, Version 2.0
|
6
|
-
#
|
7
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
|
-
# you may not use this file except in compliance with the License.
|
9
|
-
# You may obtain a copy of the License at
|
10
|
-
#
|
11
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
13
|
-
# Unless required by applicable law or agreed to in writing, software
|
14
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16
|
-
# See the License for the specific language governing permissions and
|
17
|
-
# limitations under the License.
|
18
|
-
#
|
19
|
-
|
20
|
-
require "json"
|
21
|
-
require "serverspec"
|
22
|
-
|
23
|
-
set :backend, :exec
|
24
|
-
|
25
|
-
class Chef
|
26
|
-
class Node
|
27
|
-
# dummy class for parsing JSON action messages
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
shared_examples_for "reset counters" do
|
32
|
-
it "resets the counters" do
|
33
|
-
expect(command("curl http://localhost:9292/reset-counters").exit_status).to eq(0)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
shared_examples_for "reset cache" do
|
38
|
-
it "resets the message cache" do
|
39
|
-
expect(command("curl http://localhost:9292/reset-cache").exit_status).to eq(0)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
shared_examples_for "successful chef run" do |cmd|
|
44
|
-
include_examples "reset counters"
|
45
|
-
include_examples "reset cache"
|
46
|
-
|
47
|
-
it "runs chef and expects a zero exit status" do
|
48
|
-
expect(command(cmd).exit_status).to eq(0)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
shared_examples_for "unsuccessful chef run" do |cmd|
|
53
|
-
include_examples "reset counters"
|
54
|
-
include_examples "reset cache"
|
55
|
-
|
56
|
-
it "runs chef and expects a non-zero exit status" do
|
57
|
-
expect(command(cmd).exit_status).not_to eq(0)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
shared_examples_for "counter checks" do |counters_to_check|
|
62
|
-
counters_to_check.each do |counter, value|
|
63
|
-
it "counter #{counter} should equal #{value.inspect}" do
|
64
|
-
counter_values = JSON.load(command("curl http://localhost:9292/counters").stdout)
|
65
|
-
expect(counter_values[counter]).to eq(value)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
shared_examples_for "run_start payload check" do
|
71
|
-
describe "run_start message" do
|
72
|
-
let(:required_fields) do
|
73
|
-
%w{
|
74
|
-
chef_server_fqdn
|
75
|
-
entity_uuid
|
76
|
-
id
|
77
|
-
message_version
|
78
|
-
message_type
|
79
|
-
node_name
|
80
|
-
organization_name
|
81
|
-
run_id
|
82
|
-
source
|
83
|
-
start_time
|
84
|
-
}
|
85
|
-
end
|
86
|
-
let(:optional_fields) { [] }
|
87
|
-
|
88
|
-
it "is not missing any required fields" do
|
89
|
-
payload = JSON.load(command("curl http://localhost:9292/cache/run_start").stdout)
|
90
|
-
missing_fields = required_fields.select { |key| !payload.key?(key) }
|
91
|
-
expect(missing_fields).to eq([])
|
92
|
-
end
|
93
|
-
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
shared_examples_for "run_converge.success payload check" do
|
98
|
-
describe "run_converge success message" do
|
99
|
-
let(:required_fields) do
|
100
|
-
%w{
|
101
|
-
chef_server_fqdn
|
102
|
-
entity_uuid
|
103
|
-
id
|
104
|
-
end_time
|
105
|
-
expanded_run_list
|
106
|
-
message_type
|
107
|
-
message_version
|
108
|
-
node
|
109
|
-
node_name
|
110
|
-
organization_name
|
111
|
-
policy_name
|
112
|
-
policy_group
|
113
|
-
resources
|
114
|
-
run_id
|
115
|
-
run_list
|
116
|
-
source
|
117
|
-
start_time
|
118
|
-
status
|
119
|
-
total_resource_count
|
120
|
-
updated_resource_count
|
121
|
-
deprecations
|
122
|
-
}
|
123
|
-
end
|
124
|
-
let(:optional_fields) { [] }
|
125
|
-
|
126
|
-
it "is not missing any required fields" do
|
127
|
-
payload = JSON.load(command("curl http://localhost:9292/cache/run_converge.success").stdout)
|
128
|
-
missing_fields = required_fields.select { |key| !payload.key?(key) }
|
129
|
-
expect(missing_fields).to eq([])
|
130
|
-
end
|
131
|
-
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
shared_examples_for "run_converge.failure payload check" do
|
136
|
-
describe "run_converge failure message" do
|
137
|
-
let(:required_fields) do
|
138
|
-
%w{
|
139
|
-
chef_server_fqdn
|
140
|
-
entity_uuid
|
141
|
-
error
|
142
|
-
id
|
143
|
-
end_time
|
144
|
-
expanded_run_list
|
145
|
-
message_type
|
146
|
-
message_version
|
147
|
-
node
|
148
|
-
node_name
|
149
|
-
organization_name
|
150
|
-
policy_name
|
151
|
-
policy_group
|
152
|
-
resources
|
153
|
-
run_id
|
154
|
-
run_list
|
155
|
-
source
|
156
|
-
start_time
|
157
|
-
status
|
158
|
-
total_resource_count
|
159
|
-
updated_resource_count
|
160
|
-
deprecations
|
161
|
-
}
|
162
|
-
end
|
163
|
-
let(:optional_fields) { [] }
|
164
|
-
|
165
|
-
it "is not missing any required fields" do
|
166
|
-
payload = JSON.load(command("curl http://localhost:9292/cache/run_converge.failure").stdout)
|
167
|
-
missing_fields = required_fields.select { |key| !payload.key?(key) }
|
168
|
-
expect(missing_fields).to eq([])
|
169
|
-
end
|
170
|
-
|
171
|
-
it "does not have any extra fields" do
|
172
|
-
payload = JSON.load(command("curl http://localhost:9292/cache/run_converge.failure").stdout)
|
173
|
-
extra_fields = payload.keys.select { |key| !required_fields.include?(key) && !optional_fields.include?(key) }
|
174
|
-
expect(extra_fields).to eq([])
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
describe "CCR with no data collector URL configured" do
|
180
|
-
include_examples "successful chef run", "chef-client -z -c /etc/chef/no-endpoint.rb"
|
181
|
-
include_examples "counter checks", { "run_start" => nil, "run_converge.success" => nil, "run_converge.failure" => nil }
|
182
|
-
end
|
183
|
-
|
184
|
-
describe "CCR, local mode, config in solo mode" do
|
185
|
-
include_examples "successful chef run", "chef-client -z -c /etc/chef/solo-mode.rb"
|
186
|
-
include_examples "counter checks", { "run_start" => 1, "run_converge.success" => 1, "run_converge.failure" => nil }
|
187
|
-
include_examples "run_start payload check"
|
188
|
-
include_examples "run_converge.success payload check"
|
189
|
-
end
|
190
|
-
|
191
|
-
describe "CCR, local mode, config in client mode" do
|
192
|
-
include_examples "successful chef run", "chef-client -z -c /etc/chef/client-mode.rb"
|
193
|
-
include_examples "counter checks", { "run_start" => nil, "run_converge.success" => nil, "run_converge.failure" => nil }
|
194
|
-
end
|
195
|
-
|
196
|
-
describe "CCR, local mode, config in both mode" do
|
197
|
-
include_examples "successful chef run", "chef-client -z -c /etc/chef/both-mode.rb"
|
198
|
-
include_examples "counter checks", { "run_start" => 1, "run_converge.success" => 1, "run_converge.failure" => nil }
|
199
|
-
include_examples "run_start payload check"
|
200
|
-
include_examples "run_converge.success payload check"
|
201
|
-
end
|
202
|
-
|
203
|
-
describe "CCR, local mode, config in solo mode, failed run" do
|
204
|
-
include_examples "unsuccessful chef run", "chef-client -z -c /etc/chef/solo-mode.rb -r 'recipe[cookbook-that-does-not-exist::default]'"
|
205
|
-
include_examples "counter checks", { "run_start" => 1, "run_converge.success" => nil, "run_converge.failure" => 1 }
|
206
|
-
include_examples "run_start payload check"
|
207
|
-
include_examples "run_converge.failure payload check"
|
208
|
-
end
|