chef 13.11.3-universal-mingw32 → 13.12.3-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -3
  3. data/README.md +35 -40
  4. data/Rakefile +18 -22
  5. data/chef-universal-mingw32.gemspec +1 -1
  6. data/chef.gemspec +3 -3
  7. data/lib/chef/client.rb +1 -1
  8. data/lib/chef/mixin/params_validate.rb +3 -1
  9. data/lib/chef/provider/script.rb +2 -2
  10. data/lib/chef/version.rb +1 -1
  11. data/spec/functional/http/simple_spec.rb +12 -6
  12. data/spec/functional/resource/remote_file_spec.rb +19 -15
  13. data/spec/support/platform_helpers.rb +2 -1
  14. data/tasks/announce.rb +1 -1
  15. data/tasks/dependencies.rb +5 -39
  16. data/tasks/maintainers.rb +10 -10
  17. data/tasks/rspec.rb +2 -2
  18. data/tasks/templates/prerelease.md.erb +11 -2
  19. data/tasks/templates/release.md.erb +9 -1
  20. metadata +6 -247
  21. data/CONTRIBUTING.md +0 -151
  22. data/VERSION +0 -1
  23. data/acceptance/.gitignore +0 -3
  24. data/acceptance/.shared/kitchen_acceptance/.kitchen.digitalocean.yml +0 -33
  25. data/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +0 -283
  26. data/acceptance/.shared/kitchen_acceptance/.kitchen.vagrant.yml +0 -59
  27. data/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb +0 -68
  28. data/acceptance/.shared/kitchen_acceptance/metadata.rb +0 -1
  29. data/acceptance/Gemfile +0 -19
  30. data/acceptance/Gemfile.lock +0 -266
  31. data/acceptance/README.md +0 -137
  32. data/acceptance/basics/.acceptance/acceptance-cookbook/.gitignore +0 -2
  33. data/acceptance/basics/.acceptance/acceptance-cookbook/metadata.rb +0 -3
  34. data/acceptance/basics/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
  35. data/acceptance/basics/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -1
  36. data/acceptance/basics/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -1
  37. data/acceptance/basics/.kitchen.yml +0 -4
  38. data/acceptance/basics/test/integration/chef-current-install/serverspec/chef_client_spec.rb +0 -19
  39. data/acceptance/basics/test/integration/chef-current-install/serverspec/spec_helper.rb +0 -6
  40. data/acceptance/basics/test/integration/helpers/serverspec/Gemfile +0 -8
  41. data/acceptance/data-collector/.acceptance/acceptance-cookbook/.gitignore +0 -2
  42. data/acceptance/data-collector/.acceptance/acceptance-cookbook/metadata.rb +0 -3
  43. data/acceptance/data-collector/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -2
  44. data/acceptance/data-collector/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -2
  45. data/acceptance/data-collector/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -2
  46. data/acceptance/data-collector/.acceptance/data-collector-test/.gitignore +0 -16
  47. data/acceptance/data-collector/.acceptance/data-collector-test/Berksfile +0 -3
  48. data/acceptance/data-collector/.acceptance/data-collector-test/files/default/api.rb +0 -101
  49. data/acceptance/data-collector/.acceptance/data-collector-test/files/default/apigemfile +0 -3
  50. data/acceptance/data-collector/.acceptance/data-collector-test/files/default/client-rb-both-mode.rb +0 -4
  51. data/acceptance/data-collector/.acceptance/data-collector-test/files/default/client-rb-client-mode.rb +0 -4
  52. data/acceptance/data-collector/.acceptance/data-collector-test/files/default/client-rb-no-endpoint.rb +0 -2
  53. data/acceptance/data-collector/.acceptance/data-collector-test/files/default/client-rb-solo-mode.rb +0 -4
  54. data/acceptance/data-collector/.acceptance/data-collector-test/files/default/config.ru +0 -2
  55. data/acceptance/data-collector/.acceptance/data-collector-test/metadata.rb +0 -7
  56. data/acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb +0 -44
  57. data/acceptance/data-collector/.kitchen.yml +0 -9
  58. data/acceptance/data-collector/Berksfile +0 -3
  59. data/acceptance/data-collector/test/integration/default/serverspec/default_spec.rb +0 -208
  60. data/acceptance/data-collector/test/integration/helpers/serverspec/Gemfile +0 -8
  61. data/acceptance/omnitruck/.acceptance/acceptance-cookbook/.gitignore +0 -2
  62. data/acceptance/omnitruck/.acceptance/acceptance-cookbook/metadata.rb +0 -1
  63. data/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
  64. data/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -1
  65. data/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -61
  66. data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/.gitignore +0 -2
  67. data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb +0 -43
  68. data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb +0 -41
  69. data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/metadata.rb +0 -3
  70. data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
  71. data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -1
  72. data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -1
  73. data/acceptance/top-cookbooks/.gitignore +0 -1
  74. data/acceptance/top-cookbooks/.kitchen.chocolatey.yml +0 -6
  75. data/acceptance/top-cookbooks/.kitchen.iis.yml +0 -4
  76. data/acceptance/top-cookbooks/.kitchen.learn-the-basics-rhel.yml +0 -7
  77. data/acceptance/top-cookbooks/.kitchen.learn-the-basics-ubuntu.yml +0 -7
  78. data/acceptance/top-cookbooks/.kitchen.learn-the-basics-windows.yml +0 -7
  79. data/acceptance/top-cookbooks/.kitchen.powershell.yml +0 -4
  80. data/acceptance/top-cookbooks/.kitchen.sql_server.yml +0 -5
  81. data/acceptance/top-cookbooks/.kitchen.winbox.yml +0 -8
  82. data/acceptance/top-cookbooks/.kitchen.windows.yml +0 -38
  83. data/acceptance/trivial/.acceptance/acceptance-cookbook/.gitignore +0 -2
  84. data/acceptance/trivial/.acceptance/acceptance-cookbook/metadata.rb +0 -2
  85. data/acceptance/trivial/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
  86. data/acceptance/trivial/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -1
  87. data/acceptance/trivial/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -1
  88. data/acceptance/trivial/.kitchen.yml +0 -7
  89. data/acceptance/trivial/test/integration/chef-current-install/inspec/chef_client_spec.rb +0 -5
  90. data/acceptance/windows-service/.acceptance/acceptance-cookbook/.gitignore +0 -2
  91. data/acceptance/windows-service/.acceptance/acceptance-cookbook/metadata.rb +0 -2
  92. data/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
  93. data/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -1
  94. data/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -1
  95. data/acceptance/windows-service/.kitchen.yml +0 -7
  96. data/acceptance/windows-service/test/integration/chef-windows-service/inspec/chef_windows_service_spec.rb +0 -58
  97. data/distro/common/html/_sources/ctl_chef_client.txt +0 -36
  98. data/distro/common/html/_sources/ctl_chef_server.txt +0 -341
  99. data/distro/common/html/_sources/ctl_chef_shell.txt +0 -15
  100. data/distro/common/html/_sources/ctl_chef_solo.txt +0 -25
  101. data/distro/common/html/_sources/index.txt +0 -135
  102. data/distro/common/html/_sources/knife.txt +0 -74
  103. data/distro/common/html/_sources/knife_bootstrap.txt +0 -56
  104. data/distro/common/html/_sources/knife_client.txt +0 -151
  105. data/distro/common/html/_sources/knife_common_options.txt +0 -6
  106. data/distro/common/html/_sources/knife_configure.txt +0 -29
  107. data/distro/common/html/_sources/knife_cookbook.txt +0 -236
  108. data/distro/common/html/_sources/knife_cookbook_site.txt +0 -157
  109. data/distro/common/html/_sources/knife_data_bag.txt +0 -160
  110. data/distro/common/html/_sources/knife_delete.txt +0 -26
  111. data/distro/common/html/_sources/knife_deps.txt +0 -61
  112. data/distro/common/html/_sources/knife_diff.txt +0 -34
  113. data/distro/common/html/_sources/knife_download.txt +0 -44
  114. data/distro/common/html/_sources/knife_edit.txt +0 -26
  115. data/distro/common/html/_sources/knife_environment.txt +0 -158
  116. data/distro/common/html/_sources/knife_exec.txt +0 -47
  117. data/distro/common/html/_sources/knife_index_rebuild.txt +0 -21
  118. data/distro/common/html/_sources/knife_list.txt +0 -33
  119. data/distro/common/html/_sources/knife_node.txt +0 -250
  120. data/distro/common/html/_sources/knife_raw.txt +0 -35
  121. data/distro/common/html/_sources/knife_recipe_list.txt +0 -23
  122. data/distro/common/html/_sources/knife_role.txt +0 -157
  123. data/distro/common/html/_sources/knife_search.txt +0 -53
  124. data/distro/common/html/_sources/knife_serve.txt +0 -19
  125. data/distro/common/html/_sources/knife_show.txt +0 -27
  126. data/distro/common/html/_sources/knife_ssh.txt +0 -43
  127. data/distro/common/html/_sources/knife_ssl_check.txt +0 -41
  128. data/distro/common/html/_sources/knife_ssl_fetch.txt +0 -41
  129. data/distro/common/html/_sources/knife_status.txt +0 -37
  130. data/distro/common/html/_sources/knife_tag.txt +0 -69
  131. data/distro/common/html/_sources/knife_upload.txt +0 -49
  132. data/distro/common/html/_sources/knife_user.txt +0 -127
  133. data/distro/common/html/_sources/knife_using.txt +0 -43
  134. data/distro/common/html/_sources/knife_xargs.txt +0 -30
  135. data/distro/common/html/_static/ajax-loader.gif +0 -0
  136. data/distro/common/html/_static/basic.css +0 -537
  137. data/distro/common/html/_static/chef.ico +0 -0
  138. data/distro/common/html/_static/chef_html_logo.png +0 -0
  139. data/distro/common/html/_static/comment-bright.png +0 -0
  140. data/distro/common/html/_static/comment-close.png +0 -0
  141. data/distro/common/html/_static/comment.png +0 -0
  142. data/distro/common/html/_static/contents.png +0 -0
  143. data/distro/common/html/_static/doctools.js +0 -238
  144. data/distro/common/html/_static/down-pressed.png +0 -0
  145. data/distro/common/html/_static/down.png +0 -0
  146. data/distro/common/html/_static/file.png +0 -0
  147. data/distro/common/html/_static/guide.css +0 -505
  148. data/distro/common/html/_static/jquery.js +0 -2
  149. data/distro/common/html/_static/minus.png +0 -0
  150. data/distro/common/html/_static/navigation.png +0 -0
  151. data/distro/common/html/_static/plus.png +0 -0
  152. data/distro/common/html/_static/pygments.css +0 -62
  153. data/distro/common/html/_static/searchtools.js +0 -622
  154. data/distro/common/html/_static/underscore.js +0 -31
  155. data/distro/common/html/_static/up-pressed.png +0 -0
  156. data/distro/common/html/_static/up.png +0 -0
  157. data/distro/common/html/_static/websupport.js +0 -808
  158. data/distro/common/html/ctl_chef_client.html +0 -270
  159. data/distro/common/html/ctl_chef_server.html +0 -728
  160. data/distro/common/html/ctl_chef_shell.html +0 -163
  161. data/distro/common/html/ctl_chef_solo.html +0 -194
  162. data/distro/common/html/index.html +0 -202
  163. data/distro/common/html/knife.html +0 -170
  164. data/distro/common/html/knife_bootstrap.html +0 -285
  165. data/distro/common/html/knife_client.html +0 -285
  166. data/distro/common/html/knife_common_options.html +0 -96
  167. data/distro/common/html/knife_configure.html +0 -105
  168. data/distro/common/html/knife_cookbook.html +0 -487
  169. data/distro/common/html/knife_cookbook_site.html +0 -375
  170. data/distro/common/html/knife_data_bag.html +0 -374
  171. data/distro/common/html/knife_delete.html +0 -93
  172. data/distro/common/html/knife_deps.html +0 -143
  173. data/distro/common/html/knife_diff.html +0 -123
  174. data/distro/common/html/knife_download.html +0 -145
  175. data/distro/common/html/knife_edit.html +0 -89
  176. data/distro/common/html/knife_environment.html +0 -322
  177. data/distro/common/html/knife_exec.html +0 -220
  178. data/distro/common/html/knife_index_rebuild.html +0 -83
  179. data/distro/common/html/knife_list.html +0 -114
  180. data/distro/common/html/knife_node.html +0 -458
  181. data/distro/common/html/knife_raw.html +0 -110
  182. data/distro/common/html/knife_recipe_list.html +0 -91
  183. data/distro/common/html/knife_role.html +0 -295
  184. data/distro/common/html/knife_search.html +0 -203
  185. data/distro/common/html/knife_serve.html +0 -79
  186. data/distro/common/html/knife_show.html +0 -104
  187. data/distro/common/html/knife_ssh.html +0 -177
  188. data/distro/common/html/knife_ssl_check.html +0 -151
  189. data/distro/common/html/knife_ssl_fetch.html +0 -151
  190. data/distro/common/html/knife_status.html +0 -144
  191. data/distro/common/html/knife_tag.html +0 -138
  192. data/distro/common/html/knife_upload.html +0 -153
  193. data/distro/common/html/knife_user.html +0 -242
  194. data/distro/common/html/knife_using.html +0 -210
  195. data/distro/common/html/knife_xargs.html +0 -122
  196. data/distro/common/html/objects.inv +0 -0
  197. data/distro/common/html/search.html +0 -82
  198. data/distro/common/html/searchindex.js +0 -1
  199. data/distro/common/man/man1/README.md +0 -58
  200. data/distro/common/man/man1/chef-shell.1 +0 -194
  201. data/distro/common/man/man1/knife-bootstrap.1 +0 -215
  202. data/distro/common/man/man1/knife-client.1 +0 -443
  203. data/distro/common/man/man1/knife-configure.1 +0 -161
  204. data/distro/common/man/man1/knife-cookbook-site.1 +0 -552
  205. data/distro/common/man/man1/knife-cookbook.1 +0 -770
  206. data/distro/common/man/man1/knife-data-bag.1 +0 -617
  207. data/distro/common/man/man1/knife-delete.1 +0 -127
  208. data/distro/common/man/man1/knife-deps.1 +0 -246
  209. data/distro/common/man/man1/knife-diff.1 +0 -226
  210. data/distro/common/man/man1/knife-download.1 +0 -258
  211. data/distro/common/man/man1/knife-edit.1 +0 -121
  212. data/distro/common/man/man1/knife-environment.1 +0 -496
  213. data/distro/common/man/man1/knife-exec.1 +0 -362
  214. data/distro/common/man/man1/knife-index-rebuild.1 +0 -63
  215. data/distro/common/man/man1/knife-list.1 +0 -174
  216. data/distro/common/man/man1/knife-node.1 +0 -716
  217. data/distro/common/man/man1/knife-raw.1 +0 -172
  218. data/distro/common/man/man1/knife-recipe-list.1 +0 -85
  219. data/distro/common/man/man1/knife-role.1 +0 -426
  220. data/distro/common/man/man1/knife-search.1 +0 -359
  221. data/distro/common/man/man1/knife-serve.1 +0 -109
  222. data/distro/common/man/man1/knife-show.1 +0 -160
  223. data/distro/common/man/man1/knife-ssh.1 +0 -284
  224. data/distro/common/man/man1/knife-ssl-check.1 +0 -207
  225. data/distro/common/man/man1/knife-ssl-fetch.1 +0 -207
  226. data/distro/common/man/man1/knife-status.1 +0 -234
  227. data/distro/common/man/man1/knife-tag.1 +0 -189
  228. data/distro/common/man/man1/knife-upload.1 +0 -280
  229. data/distro/common/man/man1/knife-user.1 +0 -356
  230. data/distro/common/man/man1/knife-xargs.1 +0 -189
  231. data/distro/common/man/man1/knife.1 +0 -332
  232. data/distro/common/man/man8/chef-apply.8 +0 -86
  233. data/distro/common/man/man8/chef-client.8 +0 -398
  234. data/distro/common/man/man8/chef-solo.8 +0 -260
  235. data/distro/common/markdown/README +0 -3
  236. data/distro/common/markdown/man1/chef-shell.mkd +0 -195
  237. data/distro/common/markdown/man1/knife-bootstrap.mkd +0 -141
  238. data/distro/common/markdown/man1/knife-client.mkd +0 -103
  239. data/distro/common/markdown/man1/knife-configure.mkd +0 -71
  240. data/distro/common/markdown/man1/knife-cookbook-site.mkd +0 -123
  241. data/distro/common/markdown/man1/knife-cookbook.mkd +0 -263
  242. data/distro/common/markdown/man1/knife-data-bag.mkd +0 -121
  243. data/distro/common/markdown/man1/knife-environment.mkd +0 -151
  244. data/distro/common/markdown/man1/knife-exec.mkd +0 -42
  245. data/distro/common/markdown/man1/knife-index.mkd +0 -30
  246. data/distro/common/markdown/man1/knife-node.mkd +0 -130
  247. data/distro/common/markdown/man1/knife-role.mkd +0 -85
  248. data/distro/common/markdown/man1/knife-search.mkd +0 -180
  249. data/distro/common/markdown/man1/knife-ssh.mkd +0 -69
  250. data/distro/common/markdown/man1/knife-status.mkd +0 -36
  251. data/distro/common/markdown/man1/knife-tag.mkd +0 -39
  252. data/distro/common/markdown/man1/knife.mkd +0 -213
  253. data/distro/common/markdown/man8/chef-client.mkd +0 -75
  254. data/distro/common/markdown/man8/chef-expander.mkd +0 -81
  255. data/distro/common/markdown/man8/chef-expanderctl.mkd +0 -57
  256. data/distro/common/markdown/man8/chef-server-webui.mkd +0 -121
  257. data/distro/common/markdown/man8/chef-server.mkd +0 -120
  258. data/distro/common/markdown/man8/chef-solo.mkd +0 -107
  259. data/distro/common/markdown/man8/chef-solr.mkd +0 -89
  260. data/tasks/cbgb.rb +0 -84
@@ -1,3 +0,0 @@
1
- name 'acceptance-cookbook'
2
-
3
- depends "kitchen_acceptance"
@@ -1,4 +0,0 @@
1
- suites:
2
- - name: chef-current-install
3
- includes: [ubuntu-14.04, windows-server-2012r2]
4
- run_list:
@@ -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,6 +0,0 @@
1
- require "serverspec"
2
- require "pathname"
3
-
4
- set :backend, :exec
5
-
6
- set :path, "/bin:/usr/local/bin:$PATH"
@@ -1,8 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Until https://github.com/test-kitchen/busser-serverspec/pull/42 is merged and
4
- # released, we need to include rake and rspec-core in the Gemfile
5
- gem "rake"
6
- gem "rspec-core"
7
- gem "busser-serverspec"
8
- gem "serverspec"
@@ -1,3 +0,0 @@
1
- name 'acceptance-cookbook'
2
- depends "kitchen_acceptance"
3
- depends "data-collector-test"
@@ -1,2 +0,0 @@
1
- log "Running 'destroy' recipe from the acceptance-cookbook in directory '#{node['chef-acceptance']['suite-dir']}'"
2
- kitchen "destroy"
@@ -1,2 +0,0 @@
1
- log "Running 'provision' recipe from the acceptance-cookbook in directory '#{node['chef-acceptance']['suite-dir']}'"
2
- kitchen "converge"
@@ -1,2 +0,0 @@
1
- log "Running 'verify' recipe from the acceptance-cookbook in directory '#{node['chef-acceptance']['suite-dir']}'"
2
- kitchen "verify"
@@ -1,16 +0,0 @@
1
- .vagrant
2
- Berksfile.lock
3
- *~
4
- *#
5
- .#*
6
- \#*#
7
- .*.sw[a-z]
8
- *.un~
9
-
10
- # Bundler
11
- Gemfile.lock
12
- bin/*
13
- .bundle/*
14
-
15
- .kitchen/
16
- .kitchen.local.yml
@@ -1,3 +0,0 @@
1
- source 'https://supermarket.chef.io'
2
-
3
- metadata
@@ -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,3 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "sinatra"
@@ -1,4 +0,0 @@
1
- chef_server_url "http://localhost:8889"
2
- node_name "data-collector-test"
3
- data_collector.server_url "http://localhost:9292/data-collector/v0"
4
- data_collector.mode :both
@@ -1,4 +0,0 @@
1
- chef_server_url "http://localhost:8889"
2
- node_name "data-collector-test"
3
- data_collector.server_url "http://localhost:9292/data-collector/v0"
4
- data_collector.mode :client
@@ -1,2 +0,0 @@
1
- chef_server_url "http://localhost:8889"
2
- node_name "data-collector-test"
@@ -1,4 +0,0 @@
1
- chef_server_url "http://localhost:8889"
2
- node_name "data-collector-test"
3
- data_collector.server_url "http://localhost:9292/data-collector/v0"
4
- data_collector.mode :solo
@@ -1,2 +0,0 @@
1
- require_relative "./api"
2
- run Sinatra::Application
@@ -1,7 +0,0 @@
1
- name 'data-collector-test'
2
- maintainer 'Adam Leff'
3
- maintainer_email 'adamleff@chef.io'
4
- license 'Apache-2.0'
5
- description 'Installs/Configures data-collector-test'
6
- long_description 'Installs/Configures data-collector-test'
7
- version '0.1.0'
@@ -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,9 +0,0 @@
1
- verifier:
2
- name: busser
3
-
4
- suites:
5
- - name: default
6
- includes:
7
- - ubuntu-14.04
8
- run_list:
9
- - recipe[data-collector-test::default]
@@ -1,3 +0,0 @@
1
- source "https://supermarket.chef.io"
2
-
3
- cookbook "data-collector-test", path: File.join(File.expand_path(File.dirname(__FILE__)), ".acceptance", "data-collector-test")
@@ -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