chef 13.6.4-universal-mingw32 → 13.7.16-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (269) hide show
  1. checksums.yaml +5 -5
  2. data/VERSION +1 -1
  3. data/acceptance/Gemfile +2 -2
  4. data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb +1 -6
  5. data/distro/powershell/chef/chef.psm1 +1 -5
  6. data/lib/chef/api_client.rb +5 -5
  7. data/lib/chef/api_client_v1.rb +6 -6
  8. data/lib/chef/application.rb +3 -2
  9. data/lib/chef/application/knife.rb +4 -0
  10. data/lib/chef/chef_class.rb +2 -2
  11. data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
  12. data/lib/chef/chef_fs/data_handler/data_handler_base.rb +2 -4
  13. data/lib/chef/client.rb +3 -3
  14. data/lib/chef/cookbook/chefignore.rb +4 -0
  15. data/lib/chef/cookbook/cookbook_collection.rb +2 -2
  16. data/lib/chef/cookbook/metadata.rb +2 -2
  17. data/lib/chef/data_bag.rb +1 -1
  18. data/lib/chef/deprecated.rb +10 -0
  19. data/lib/chef/event_dispatch/base.rb +2 -2
  20. data/lib/chef/http.rb +10 -10
  21. data/lib/chef/knife.rb +16 -15
  22. data/lib/chef/knife/configure.rb +12 -36
  23. data/lib/chef/knife/cookbook_upload.rb +4 -4
  24. data/lib/chef/knife/core/bootstrap_context.rb +1 -1
  25. data/lib/chef/knife/core/status_presenter.rb +6 -2
  26. data/lib/chef/knife/core/ui.rb +1 -1
  27. data/lib/chef/knife/data_bag_secret_options.rb +1 -1
  28. data/lib/chef/knife/data_bag_show.rb +1 -1
  29. data/lib/chef/knife/edit.rb +1 -1
  30. data/lib/chef/knife/ssh.rb +47 -35
  31. data/lib/chef/knife/user_create.rb +2 -0
  32. data/lib/chef/knife/user_delete.rb +2 -0
  33. data/lib/chef/knife/user_edit.rb +2 -0
  34. data/lib/chef/knife/user_reregister.rb +2 -0
  35. data/lib/chef/knife/user_show.rb +2 -0
  36. data/lib/chef/mixin/powershell_out.rb +1 -1
  37. data/lib/chef/node/attribute.rb +46 -70
  38. data/lib/chef/node/attribute_collections.rb +5 -5
  39. data/lib/chef/node/common_api.rb +1 -1
  40. data/lib/chef/node/immutable_collections.rb +180 -23
  41. data/lib/chef/node/mixin/state_tracking.rb +6 -6
  42. data/lib/chef/node_map.rb +63 -45
  43. data/lib/chef/property.rb +8 -8
  44. data/lib/chef/provider.rb +9 -3
  45. data/lib/chef/provider/apt_preference.rb +1 -1
  46. data/lib/chef/provider/apt_repository.rb +1 -1
  47. data/lib/chef/provider/apt_update.rb +1 -1
  48. data/lib/chef/provider/file.rb +1 -1
  49. data/lib/chef/provider/group/dscl.rb +6 -2
  50. data/lib/chef/provider/ifconfig.rb +96 -34
  51. data/lib/chef/provider/launchd.rb +0 -1
  52. data/lib/chef/provider/log.rb +3 -13
  53. data/lib/chef/provider/package/dnf.rb +1 -1
  54. data/lib/chef/provider/package/smartos.rb +2 -2
  55. data/lib/chef/provider/reboot.rb +12 -0
  56. data/lib/chef/provider/remote_directory.rb +1 -1
  57. data/lib/chef/provider/remote_file/http.rb +3 -2
  58. data/lib/chef/provider/service/solaris.rb +6 -2
  59. data/lib/chef/provider/systemd_unit.rb +34 -33
  60. data/lib/chef/provider/user/dscl.rb +1 -1
  61. data/lib/chef/provider/windows_path.rb +6 -7
  62. data/lib/chef/provider/windows_task.rb +89 -33
  63. data/lib/chef/provider/yum_repository.rb +24 -9
  64. data/lib/chef/resource/apt_package.rb +1 -0
  65. data/lib/chef/resource/apt_preference.rb +4 -0
  66. data/lib/chef/resource/apt_repository.rb +4 -0
  67. data/lib/chef/resource/apt_update.rb +3 -0
  68. data/lib/chef/resource/bash.rb +4 -0
  69. data/lib/chef/resource/batch.rb +5 -0
  70. data/lib/chef/resource/bff_package.rb +4 -0
  71. data/lib/chef/resource/breakpoint.rb +6 -0
  72. data/lib/chef/resource/cab_package.rb +6 -6
  73. data/lib/chef/resource/chef_gem.rb +13 -0
  74. data/lib/chef/resource/chocolatey_package.rb +4 -6
  75. data/lib/chef/resource/cookbook_file.rb +13 -15
  76. data/lib/chef/resource/cron.rb +2 -0
  77. data/lib/chef/resource/csh.rb +4 -0
  78. data/lib/chef/resource/directory.rb +8 -26
  79. data/lib/chef/resource/dnf_package.rb +5 -0
  80. data/lib/chef/resource/dpkg_package.rb +2 -0
  81. data/lib/chef/resource/dsc_resource.rb +5 -0
  82. data/lib/chef/resource/dsc_script.rb +6 -0
  83. data/lib/chef/resource/env.rb +3 -0
  84. data/lib/chef/resource/erl_call.rb +5 -0
  85. data/lib/chef/resource/execute.rb +5 -1
  86. data/lib/chef/resource/file.rb +2 -1
  87. data/lib/chef/resource/file/verification.rb +10 -0
  88. data/lib/chef/resource/freebsd_package.rb +10 -2
  89. data/lib/chef/resource/gem_package.rb +2 -0
  90. data/lib/chef/resource/git.rb +2 -0
  91. data/lib/chef/resource/group.rb +1 -0
  92. data/lib/chef/resource/homebrew_package.rb +3 -0
  93. data/lib/chef/resource/http_request.rb +2 -0
  94. data/lib/chef/resource/ifconfig.rb +23 -150
  95. data/lib/chef/resource/ips_package.rb +1 -0
  96. data/lib/chef/resource/ksh.rb +6 -0
  97. data/lib/chef/resource/launchd.rb +5 -4
  98. data/lib/chef/resource/link.rb +10 -0
  99. data/lib/chef/resource/log.rb +19 -46
  100. data/lib/chef/resource/macports_package.rb +1 -0
  101. data/lib/chef/resource/mdadm.rb +4 -0
  102. data/lib/chef/resource/mount.rb +1 -0
  103. data/lib/chef/resource/msu_package.rb +7 -8
  104. data/lib/chef/resource/ohai.rb +2 -0
  105. data/lib/chef/resource/openbsd_package.rb +3 -0
  106. data/lib/chef/resource/osx_profile.rb +10 -40
  107. data/lib/chef/resource/package.rb +6 -0
  108. data/lib/chef/resource/pacman_package.rb +1 -0
  109. data/lib/chef/resource/paludis_package.rb +3 -0
  110. data/lib/chef/resource/perl.rb +4 -0
  111. data/lib/chef/resource/portage_package.rb +1 -0
  112. data/lib/chef/resource/powershell_package.rb +5 -0
  113. data/lib/chef/resource/powershell_script.rb +8 -0
  114. data/lib/chef/resource/python.rb +4 -0
  115. data/lib/chef/resource/reboot.rb +14 -20
  116. data/lib/chef/resource/registry_key.rb +1 -0
  117. data/lib/chef/resource/remote_directory.rb +3 -0
  118. data/lib/chef/resource/remote_file.rb +2 -0
  119. data/lib/chef/resource/resource_notification.rb +17 -0
  120. data/lib/chef/resource/route.rb +1 -0
  121. data/lib/chef/resource/rpm_package.rb +1 -0
  122. data/lib/chef/resource/ruby.rb +4 -0
  123. data/lib/chef/resource/ruby_block.rb +3 -0
  124. data/lib/chef/resource/script.rb +4 -0
  125. data/lib/chef/resource/service.rb +1 -0
  126. data/lib/chef/resource/smartos_package.rb +1 -0
  127. data/lib/chef/resource/solaris_package.rb +1 -0
  128. data/lib/chef/resource/subversion.rb +1 -0
  129. data/lib/chef/resource/systemd_unit.rb +6 -0
  130. data/lib/chef/resource/template.rb +9 -0
  131. data/lib/chef/resource/user.rb +1 -0
  132. data/lib/chef/resource/windows_package.rb +2 -0
  133. data/lib/chef/resource/windows_path.rb +5 -10
  134. data/lib/chef/resource/windows_service.rb +3 -0
  135. data/lib/chef/resource/windows_task.rb +66 -87
  136. data/lib/chef/resource/yum_repository.rb +26 -22
  137. data/lib/chef/resource/zypper_package.rb +2 -0
  138. data/lib/chef/resource/zypper_repository.rb +6 -1
  139. data/lib/chef/run_context.rb +8 -2
  140. data/lib/chef/server_api.rb +1 -0
  141. data/lib/chef/util/selinux.rb +5 -4
  142. data/lib/chef/version.rb +1 -1
  143. data/lib/chef/version/platform.rb +18 -0
  144. data/lib/chef/version_constraint/platform.rb +2 -0
  145. data/spec/data/client.d_00/02-strings.rb +2 -0
  146. data/spec/functional/assets/chefinittest +6 -4
  147. data/spec/functional/knife/ssh_spec.rb +54 -7
  148. data/spec/functional/resource/bff_spec.rb +3 -3
  149. data/spec/functional/resource/ifconfig_spec.rb +1 -1
  150. data/spec/functional/resource/mount_spec.rb +7 -3
  151. data/spec/functional/resource/user/useradd_spec.rb +4 -4
  152. data/spec/functional/resource/windows_task_spec.rb +6 -6
  153. data/spec/functional/win32/security_spec.rb +7 -33
  154. data/spec/integration/knife/data_bag_show_spec.rb +1 -1
  155. data/spec/integration/recipes/noop_resource_spec.rb +1 -1
  156. data/spec/integration/recipes/recipe_dsl_spec.rb +30 -30
  157. data/spec/integration/recipes/resource_action_spec.rb +2 -2
  158. data/spec/integration/recipes/resource_converge_if_changed_spec.rb +71 -15
  159. data/spec/spec_helper.rb +19 -0
  160. data/spec/support/shared/functional/execute_resource.rb +1 -1
  161. data/spec/support/shared/unit/application_dot_d.rb +2 -0
  162. data/spec/support/shared/unit/execute_resource.rb +8 -1
  163. data/spec/support/shared/unit/provider/file.rb +9 -1
  164. data/spec/unit/chef_fs/data_handler/data_bag_item_data_handler.rb +10 -7
  165. data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +2 -2
  166. data/spec/unit/client_spec.rb +1 -1
  167. data/spec/unit/deprecated_spec.rb +4 -4
  168. data/spec/unit/http_spec.rb +9 -0
  169. data/spec/unit/knife/bootstrap_spec.rb +5 -0
  170. data/spec/unit/knife/configure_spec.rb +10 -60
  171. data/spec/unit/knife/data_bag_create_spec.rb +40 -2
  172. data/spec/unit/knife/data_bag_show_spec.rb +16 -2
  173. data/spec/unit/knife/ssh_spec.rb +85 -39
  174. data/spec/unit/knife_spec.rb +2 -0
  175. data/spec/unit/lwrp_spec.rb +5 -3
  176. data/spec/unit/mixin/powershell_type_coercions_spec.rb +7 -6
  177. data/spec/unit/node/attribute_spec.rb +55 -24
  178. data/spec/unit/node/immutable_collections_spec.rb +28 -14
  179. data/spec/unit/node/vivid_mash_spec.rb +27 -10
  180. data/spec/unit/node_map_spec.rb +34 -0
  181. data/spec/unit/property_spec.rb +13 -13
  182. data/spec/unit/provider/group/dscl_spec.rb +14 -5
  183. data/spec/unit/provider/ifconfig_spec.rb +10 -3
  184. data/spec/unit/provider/remote_file/http_spec.rb +23 -19
  185. data/spec/unit/provider/service/solaris_smf_service_spec.rb +6 -5
  186. data/spec/unit/provider/user/dscl_spec.rb +26 -0
  187. data/spec/unit/provider/windows_task_spec.rb +148 -4
  188. data/spec/unit/provider_spec.rb +1 -1
  189. data/spec/unit/resource/apt_package_spec.rb +1 -1
  190. data/spec/unit/resource/bash_spec.rb +8 -10
  191. data/spec/unit/resource/batch_spec.rb +1 -1
  192. data/spec/unit/resource/cab_package_spec.rb +19 -1
  193. data/spec/unit/resource/chef_gem_spec.rb +3 -3
  194. data/spec/unit/resource/chocolatey_package_spec.rb +10 -10
  195. data/spec/unit/resource/conditional_spec.rb +2 -2
  196. data/spec/unit/resource/cookbook_file_spec.rb +24 -30
  197. data/spec/unit/resource/cron_spec.rb +79 -82
  198. data/spec/unit/resource/csh_spec.rb +8 -10
  199. data/spec/unit/resource/deploy_spec.rb +1 -1
  200. data/spec/unit/resource/directory_spec.rb +28 -31
  201. data/spec/unit/resource/dnf_package_spec.rb +9 -9
  202. data/spec/unit/resource/env_spec.rb +7 -7
  203. data/spec/unit/resource/erl_call_spec.rb +9 -9
  204. data/spec/unit/resource/execute_spec.rb +6 -6
  205. data/spec/unit/resource/file/verification_spec.rb +18 -4
  206. data/spec/unit/resource/file_spec.rb +53 -56
  207. data/spec/unit/resource/freebsd_package_spec.rb +7 -7
  208. data/spec/unit/resource/gem_package_spec.rb +1 -1
  209. data/spec/unit/resource/git_spec.rb +7 -9
  210. data/spec/unit/resource/group_spec.rb +60 -70
  211. data/spec/unit/resource/http_request_spec.rb +16 -19
  212. data/spec/unit/resource/ifconfig_spec.rb +3 -3
  213. data/spec/unit/resource/ips_package_spec.rb +3 -5
  214. data/spec/unit/resource/ksh_spec.rb +8 -10
  215. data/spec/unit/resource/launchd_spec.rb +17 -10
  216. data/spec/unit/resource/link_spec.rb +53 -53
  217. data/spec/unit/resource/log_spec.rb +24 -28
  218. data/spec/unit/resource/mdadm_spec.rb +42 -44
  219. data/spec/unit/resource/mount_spec.rb +97 -99
  220. data/spec/unit/resource/msu_package_spec.rb +14 -8
  221. data/spec/unit/resource/ohai_spec.rb +15 -17
  222. data/spec/unit/resource/openbsd_package_spec.rb +3 -3
  223. data/spec/unit/resource/osx_profile_spec.rb +7 -7
  224. data/spec/unit/resource/package_spec.rb +36 -40
  225. data/spec/unit/resource/perl_spec.rb +8 -11
  226. data/spec/unit/resource/portage_package_spec.rb +8 -10
  227. data/spec/unit/resource/powershell_package_spec.rb +9 -9
  228. data/spec/unit/resource/python_spec.rb +8 -11
  229. data/spec/unit/resource/reboot_spec.rb +50 -0
  230. data/spec/unit/resource/registry_key_spec.rb +84 -98
  231. data/spec/unit/resource/remote_directory_spec.rb +40 -42
  232. data/spec/unit/resource/remote_file_spec.rb +78 -80
  233. data/spec/unit/resource/route_spec.rb +42 -44
  234. data/spec/unit/resource/rpm_package_spec.rb +5 -7
  235. data/spec/unit/resource/ruby_block_spec.rb +14 -16
  236. data/spec/unit/resource/ruby_spec.rb +8 -12
  237. data/spec/unit/resource/scm_spec.rb +66 -69
  238. data/spec/unit/resource/script_spec.rb +1 -1
  239. data/spec/unit/resource/service_spec.rb +80 -83
  240. data/spec/unit/resource/smartos_package_spec.rb +5 -0
  241. data/spec/unit/resource/solaris_package_spec.rb +3 -5
  242. data/spec/unit/resource/subversion_spec.rb +18 -16
  243. data/spec/unit/resource/systemd_unit_spec.rb +50 -54
  244. data/spec/unit/resource/template_spec.rb +56 -61
  245. data/spec/unit/resource/user_spec.rb +47 -53
  246. data/spec/unit/resource/windows_package_spec.rb +1 -1
  247. data/spec/unit/resource/windows_path_spec.rb +11 -8
  248. data/spec/unit/resource/windows_task_spec.rb +129 -33
  249. data/spec/unit/resource/yum_package_spec.rb +1 -1
  250. data/spec/unit/resource/yum_repository_spec.rb +61 -8
  251. data/spec/unit/resource/zypper_repository_spec.rb +17 -18
  252. data/spec/unit/util/selinux_spec.rb +3 -6
  253. data/tasks/dependencies.rb +0 -5
  254. data/tasks/rspec.rb +1 -1
  255. metadata +7 -19
  256. data/acceptance/.DS_Store +0 -0
  257. data/acceptance/.bundle/config +0 -2
  258. data/acceptance/top-cookbooks/.kitchen.docker.yml +0 -13
  259. data/acceptance/top-cookbooks/.kitchen.git.yml +0 -11
  260. data/distro/.DS_Store +0 -0
  261. data/lib/.DS_Store +0 -0
  262. data/lib/chef/.DS_Store +0 -0
  263. data/lib/chef/knife/.DS_Store +0 -0
  264. data/lib/chef/mixin/.DS_Store +0 -0
  265. data/spec/.DS_Store +0 -0
  266. data/spec/functional/.DS_Store +0 -0
  267. data/spec/support/.DS_Store +0 -0
  268. data/spec/unit/.DS_Store +0 -0
  269. data/tasks/.DS_Store +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5312db5aec7d7f3b32b5f91d1f869059fd6a1773
4
- data.tar.gz: 62001ef77a66045535ad61574011cc88a034de4e
2
+ SHA256:
3
+ metadata.gz: 1fcd5ce7cb24f5f47ba8138e6fffd6b5157783ff98fecbd099c3b5e07c497c2c
4
+ data.tar.gz: 653cca5199263fba6bbbc3cf6cf85c0cdf6b876208b332b2cc65610f765d8133
5
5
  SHA512:
6
- metadata.gz: eafd0d163281e7c7acce7ddb724942ee96fa88255d86d5688cdf1c2fc6a87c3b943b50a513cfccfa782f192a34ee0e82ee4af8f43da88524d6497fa3b466e0c4
7
- data.tar.gz: 7d40acf7ee328e5bad963ab375885418acc47f3e661ee171d7934f93aabb34b333618057880839c985d37278dd2d7b228a74d818045e4e8ae727669e255b755f
6
+ metadata.gz: e43227b9110b01c0e75076b7748f5b14f555a655ceccb72927fd93bc040c7b3c37329529dbc7d2468a9ddbf66f8a15c4236b26f4e7c6635534044bde8b6aa2bc
7
+ data.tar.gz: 9544fec98cbe49787fd3e14b6ae63fa0c8cf09136de0f34ed4bb7408c1fa7d770220dde5ee37e96cf039349bfc35ccfa03941ab3e0f4e95a4d655199d830c45f
data/VERSION CHANGED
@@ -1 +1 @@
1
- 13.6.4
1
+ 13.7.16
@@ -15,5 +15,5 @@ gem "berkshelf"
15
15
  # packages are not always immediately available via the omnitruck API.
16
16
  gem "mixlib-install", "1.2.3"
17
17
 
18
- # for chef-13 development - pin to the released rubygems version
19
- gem "chef-config", "< 13.0"
18
+ # for chef-14 development - pin to the released rubygems version
19
+ gem "chef-config", "< 14.0"
@@ -6,12 +6,7 @@ class TopCookbooks < Chef::Resource
6
6
  # Disabling all windows tests until winrm issue is properly settled.
7
7
  #
8
8
  action :run do
9
- cookbook_kitchen "#{command} docker" do
10
- end
11
-
12
- cookbook_kitchen "#{command} git" do
13
- end
14
-
9
+
15
10
  # FIXME: waiting for https://github.com/learn-chef/learn-chef-acceptance/pull/23
16
11
  # cookbook_kitchen "#{command} learn-the-basics-ubuntu" do
17
12
  # repository "learn-chef/learn-chef-acceptance"
@@ -236,7 +236,6 @@ function Run-ExecutableAndWait($AppPath, $ArgumentString) {
236
236
  throw "Unable to create process [$ArgumentString]. Error code $reason."
237
237
  }
238
238
 
239
- $sb = New-Object System.Text.StringBuilder
240
239
  $buffer = New-Object byte[] 1024
241
240
 
242
241
  # Initialize reference variables
@@ -270,7 +269,7 @@ function Run-ExecutableAndWait($AppPath, $ArgumentString) {
270
269
  while ([Chef.Kernel32]::ReadFile($hReadOut, $buffer, $buffer.Length, [ref] $bytesRead, 0)) {
271
270
  $output = [Text.Encoding]::UTF8.GetString($buffer, 0, $bytesRead)
272
271
  if ($output) {
273
- [void]$sb.Append($output)
272
+ $output
274
273
  }
275
274
  if ($bytesRead -lt $buffer.Length) {
276
275
  # Partial buffer indicating the end of stream, break out of ReadFile loop
@@ -307,9 +306,6 @@ function Run-ExecutableAndWait($AppPath, $ArgumentString) {
307
306
  }
308
307
  }
309
308
 
310
- # Return output obtained from child process stdout/stderr
311
- $sb.ToString()
312
-
313
309
  # Cleanup handles
314
310
  $success = [Chef.Kernel32]::CloseHandle($pi.hProcess)
315
311
  if (-Not $success) {
@@ -47,7 +47,7 @@ class Chef
47
47
 
48
48
  # Gets or sets the client name.
49
49
  #
50
- # @params [Optional String] The name must be alpha-numeric plus - and _.
50
+ # @param [Optional String] The name must be alpha-numeric plus - and _.
51
51
  # @return [String] The current value of the name.
52
52
  def name(arg = nil)
53
53
  set_or_return(
@@ -59,7 +59,7 @@ class Chef
59
59
 
60
60
  # Gets or sets whether this client is an admin.
61
61
  #
62
- # @params [Optional True/False] Should be true or false - default is false.
62
+ # @param [Optional True/False] Should be true or false - default is false.
63
63
  # @return [True/False] The current value
64
64
  def admin(arg = nil)
65
65
  set_or_return(
@@ -71,7 +71,7 @@ class Chef
71
71
 
72
72
  # Gets or sets the public key.
73
73
  #
74
- # @params [Optional String] The string representation of the public key.
74
+ # @param [Optional String] The string representation of the public key.
75
75
  # @return [String] The current value.
76
76
  def public_key(arg = nil)
77
77
  set_or_return(
@@ -83,7 +83,7 @@ class Chef
83
83
 
84
84
  # Gets or sets whether this client is a validator.
85
85
  #
86
- # @params [Boolean] whether or not the client is a validator. If
86
+ # @param [Boolean] whether or not the client is a validator. If
87
87
  # `nil`, retrieves the already-set value.
88
88
  # @return [Boolean] The current value
89
89
  def validator(arg = nil)
@@ -96,7 +96,7 @@ class Chef
96
96
 
97
97
  # Gets or sets the private key.
98
98
  #
99
- # @params [Optional String] The string representation of the private key.
99
+ # @param [Optional String] The string representation of the private key.
100
100
  # @return [String] The current value.
101
101
  def private_key(arg = nil)
102
102
  set_or_return(
@@ -70,7 +70,7 @@ class Chef
70
70
 
71
71
  # Gets or sets the client name.
72
72
  #
73
- # @params [Optional String] The name must be alpha-numeric plus - and _.
73
+ # @param [Optional String] The name must be alpha-numeric plus - and _.
74
74
  # @return [String] The current value of the name.
75
75
  def name(arg = nil)
76
76
  set_or_return(
@@ -82,7 +82,7 @@ class Chef
82
82
 
83
83
  # Gets or sets whether this client is an admin.
84
84
  #
85
- # @params [Optional True/False] Should be true or false - default is false.
85
+ # @param [Optional True/False] Should be true or false - default is false.
86
86
  # @return [True/False] The current value
87
87
  def admin(arg = nil)
88
88
  set_or_return(
@@ -94,7 +94,7 @@ class Chef
94
94
 
95
95
  # Gets or sets the public key.
96
96
  #
97
- # @params [Optional String] The string representation of the public key.
97
+ # @param [Optional String] The string representation of the public key.
98
98
  # @return [String] The current value.
99
99
  def public_key(arg = nil)
100
100
  set_or_return(
@@ -106,7 +106,7 @@ class Chef
106
106
 
107
107
  # Gets or sets whether this client is a validator.
108
108
  #
109
- # @params [Boolean] whether or not the client is a validator. If
109
+ # @param [Boolean] whether or not the client is a validator. If
110
110
  # `nil`, retrieves the already-set value.
111
111
  # @return [Boolean] The current value
112
112
  def validator(arg = nil)
@@ -120,7 +120,7 @@ class Chef
120
120
  # Private key. The server will return it as a string.
121
121
  # Set to true under API V0 to have the server regenerate the default key.
122
122
  #
123
- # @params [Optional String] The string representation of the private key.
123
+ # @param [Optional String] The string representation of the private key.
124
124
  # @return [String] The current value.
125
125
  def private_key(arg = nil)
126
126
  set_or_return(
@@ -132,7 +132,7 @@ class Chef
132
132
 
133
133
  # Used to ask server to generate key pair under api V1
134
134
  #
135
- # @params [Optional True/False] Should be true or false - default is false.
135
+ # @param [Optional True/False] Should be true or false - default is false.
136
136
  # @return [True/False] The current value
137
137
  def create_key(arg = nil)
138
138
  set_or_return(
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: AJ Christensen (<aj@chef.io>)
3
3
  # Author:: Mark Mzyk (mmzyk@chef.io)
4
- # Copyright:: Copyright 2008-2017, Chef Software Inc.
4
+ # Copyright:: Copyright 2008-2018, Chef Software Inc.
5
5
  # License:: Apache License, Version 2.0
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -90,6 +90,7 @@ class Chef
90
90
  load_config_file
91
91
  Chef::Config.export_proxies
92
92
  Chef::Config.init_openssl
93
+ File.umask Chef::Config[:umask]
93
94
  end
94
95
 
95
96
  # Parse the config file
@@ -176,7 +177,7 @@ class Chef
176
177
  # Based on config and whether or not STDOUT is a tty, should we setup a
177
178
  # secondary logger for stdout?
178
179
  def want_additional_logger?
179
- ( Chef::Config[:log_location] != STDOUT ) && STDOUT.tty? && !Chef::Config[:daemonize]
180
+ !( Chef::Config[:log_location].is_a?(IO) && Chef::Config[:log_location].tty? ) && !Chef::Config[:daemonize]
180
181
  end
181
182
 
182
183
  def configure_stdout_logger
@@ -148,6 +148,10 @@ class Chef::Application::Knife < Chef::Application
148
148
  :boolean => true,
149
149
  :default => nil
150
150
 
151
+ option :profile,
152
+ :long => "--profile PROFILE",
153
+ :description => "The credentials profile to select"
154
+
151
155
  # Run knife
152
156
  def run
153
157
  Mixlib::Log::Formatter.show_time = false
@@ -200,8 +200,8 @@ class Chef
200
200
  #
201
201
  # Emit a deprecation message.
202
202
  #
203
- # @param type The message to send. This should be a symbol, referring to
204
- # a class defined in Chef::Deprecated
203
+ # @param [Symbol] type The message to send. This should refer to a class
204
+ # defined in Chef::Deprecated
205
205
  # @param message An explicit message to display, rather than the generic one
206
206
  # associated with the deprecation.
207
207
  # @param location The location. Defaults to the caller who called you (since
@@ -5,7 +5,7 @@ class Chef
5
5
  module ChefFS
6
6
  module DataHandler
7
7
  class DataBagItemDataHandler < DataHandlerBase
8
- RESERVED_NAMES = /node|role|environment|client/
8
+ RESERVED_NAMES = /^(node|role|environment|client)$/
9
9
 
10
10
  def normalize(data_bag_item, entry)
11
11
  # If it's wrapped with raw_data, unwrap it.
@@ -56,8 +56,7 @@ class Chef
56
56
  # 2. Put the actual values in the order of the defaults
57
57
  # 3. Move any other values to the end
58
58
  #
59
- # == Example
60
- #
59
+ # @example
61
60
  # normalize_hash({x: 100, c: 2, a: 1}, { a: 10, b: 20, c: 30})
62
61
  # -> { a: 1, b: 20, c: 2, x: 100}
63
62
  #
@@ -140,8 +139,7 @@ class Chef
140
139
  # the keys specified in "keys"; anything else must be emitted by the
141
140
  # caller.
142
141
  #
143
- # == Example
144
- #
142
+ # @example
145
143
  # to_ruby_keys({"name" => "foo", "environment" => "desert", "foo": "bar"}, [ "name", "environment" ])
146
144
  # ->
147
145
  # 'name "foo"
@@ -299,7 +299,7 @@ class Chef
299
299
  run_status.stop_clock
300
300
  Chef::Log.info("Chef Run complete in #{run_status.elapsed_time} seconds")
301
301
  run_completed_successfully
302
- events.run_completed(node)
302
+ events.run_completed(node, run_status)
303
303
 
304
304
  # keep this inside the main loop to get exception backtraces
305
305
  end_profiling
@@ -315,7 +315,7 @@ class Chef
315
315
  run_status.exception = run_error
316
316
  run_failed
317
317
  end
318
- events.run_failed(run_error)
318
+ events.run_failed(run_error, run_status)
319
319
  ensure
320
320
  Chef::RequestID.instance.reset_request_id
321
321
  @run_status = nil
@@ -602,7 +602,7 @@ class Chef
602
602
  # @api private
603
603
  #
604
604
  def run_ohai
605
- filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version os os_version} : nil
605
+ filter = Chef::Config[:minimal_ohai] ? %w{fqdn machinename hostname platform platform_version ohai_time os os_version} : nil
606
606
  ohai.all_plugins(filter)
607
607
  events.ohai_completed(node)
608
608
  rescue Ohai::Exceptions::CriticalPluginFailure => e
@@ -33,12 +33,16 @@ class Chef
33
33
  @ignores = parse_ignore_file
34
34
  end
35
35
 
36
+ # @param [Array] list the list of cookbook files
37
+ # @return [Array] list of cookbook files with chefignore files removed
36
38
  def remove_ignores_from(file_list)
37
39
  Array(file_list).inject([]) do |unignored, file|
38
40
  ignored?(file) ? unignored : unignored << file
39
41
  end
40
42
  end
41
43
 
44
+ # @param [String] file_name the file name to check ignored status for
45
+ # @return [Boolean] is the file ignored or not
42
46
  def ignored?(file_name)
43
47
  @ignores.any? { |glob| File.fnmatch?(glob, file_name) }
44
48
  end
@@ -47,8 +47,8 @@ class Chef
47
47
  # Currently checks chef_version and ohai_version in the cookbook metadata
48
48
  # against the running Chef::VERSION and Ohai::VERSION.
49
49
  #
50
- # @raises [Chef::Exceptions::CookbookChefVersionMismatch] if the Chef::VERSION fails validation
51
- # @raises [Chef::Exceptions::CookbookOhaiVersionMismatch] if the Ohai::VERSION fails validation
50
+ # @raise [Chef::Exceptions::CookbookChefVersionMismatch] if the Chef::VERSION fails validation
51
+ # @raise [Chef::Exceptions::CookbookOhaiVersionMismatch] if the Ohai::VERSION fails validation
52
52
  def validate!
53
53
  each do |cookbook_name, cookbook_version|
54
54
  cookbook_version.metadata.validate_chef_version!
@@ -596,7 +596,7 @@ class Chef
596
596
  # Validates that the Ohai::VERSION of the running chef-client matches one of the
597
597
  # configured ohai_version statements in this cookbooks metadata.
598
598
  #
599
- # @raises [Chef::Exceptions::CookbookOhaiVersionMismatch] if the cookbook fails validation
599
+ # @raise [Chef::Exceptions::CookbookOhaiVersionMismatch] if the cookbook fails validation
600
600
  def validate_ohai_version!
601
601
  unless gem_dep_matches?("ohai", Gem::Version.new(Ohai::VERSION), *ohai_versions)
602
602
  raise Exceptions::CookbookOhaiVersionMismatch.new(Ohai::VERSION, name, version, *ohai_versions)
@@ -606,7 +606,7 @@ class Chef
606
606
  # Validates that the Chef::VERSION of the running chef-client matches one of the
607
607
  # configured chef_version statements in this cookbooks metadata.
608
608
  #
609
- # @raises [Chef::Exceptions::CookbookChefVersionMismatch] if the cookbook fails validation
609
+ # @raise [Chef::Exceptions::CookbookChefVersionMismatch] if the cookbook fails validation
610
610
  def validate_chef_version!
611
611
  unless gem_dep_matches?("chef", Gem::Version.new(Chef::VERSION), *chef_versions)
612
612
  raise Exceptions::CookbookChefVersionMismatch.new(Chef::VERSION, name, version, *chef_versions)
@@ -33,7 +33,7 @@ class Chef
33
33
  include Chef::Mixin::ParamsValidate
34
34
 
35
35
  VALID_NAME = /^[\.\-[:alnum:]_]+$/
36
- RESERVED_NAMES = /node|role|environment|client/
36
+ RESERVED_NAMES = /^(node|role|environment|client)$/
37
37
 
38
38
  attr_accessor :chef_server_rest
39
39
 
@@ -268,6 +268,16 @@ class Chef
268
268
  end
269
269
  end
270
270
 
271
+ class ErlResource < Base
272
+ def id
273
+ 22
274
+ end
275
+
276
+ def target
277
+ "erl_resource.html"
278
+ end
279
+ end
280
+
271
281
  # id 3694 was deleted
272
282
 
273
283
  class Generic < Base
@@ -36,11 +36,11 @@ class Chef
36
36
  end
37
37
 
38
38
  # Called at the end a successful Chef run.
39
- def run_completed(node)
39
+ def run_completed(node, run_status)
40
40
  end
41
41
 
42
42
  # Called at the end of a failed Chef run.
43
- def run_failed(exception)
43
+ def run_failed(exception, run_status)
44
44
  end
45
45
 
46
46
  # Called right after ohai runs.
@@ -170,11 +170,10 @@ class Chef
170
170
  raise
171
171
  end
172
172
 
173
- def streaming_request_with_progress(path, headers = {}, &progress_block)
173
+ def streaming_request_with_progress(path, headers = {}, tempfile = nil, &progress_block)
174
174
  http_attempts ||= 0
175
175
  url = create_url(path)
176
176
  response, rest_request, return_value = nil, nil, nil
177
- tempfile = nil
178
177
  data = nil
179
178
 
180
179
  method = :GET
@@ -182,7 +181,7 @@ class Chef
182
181
 
183
182
  response, rest_request, return_value = send_http_request(method, url, processed_headers, data) do |http_response|
184
183
  if http_response.kind_of?(Net::HTTPSuccess)
185
- tempfile = stream_to_tempfile(url, http_response, &progress_block)
184
+ tempfile = stream_to_tempfile(url, http_response, tempfile, &progress_block)
186
185
  end
187
186
  apply_stream_complete_middleware(http_response, rest_request, return_value)
188
187
  end
@@ -217,11 +216,10 @@ class Chef
217
216
  #
218
217
  # @yield [tempfile] block to process the tempfile
219
218
  # @yieldparams [tempfile<Tempfile>] tempfile
220
- def streaming_request(path, headers = {})
219
+ def streaming_request(path, headers = {}, tempfile = nil)
221
220
  http_attempts ||= 0
222
221
  url = create_url(path)
223
222
  response, rest_request, return_value = nil, nil, nil
224
- tempfile = nil
225
223
  data = nil
226
224
 
227
225
  method = :GET
@@ -229,7 +227,7 @@ class Chef
229
227
 
230
228
  response, rest_request, return_value = send_http_request(method, url, processed_headers, data) do |http_response|
231
229
  if http_response.kind_of?(Net::HTTPSuccess)
232
- tempfile = stream_to_tempfile(url, http_response)
230
+ tempfile = stream_to_tempfile(url, http_response, tempfile)
233
231
  end
234
232
  apply_stream_complete_middleware(http_response, rest_request, return_value)
235
233
  end
@@ -500,11 +498,13 @@ class Chef
500
498
  end
501
499
 
502
500
  # @api private
503
- def stream_to_tempfile(url, response, &progress_block)
501
+ def stream_to_tempfile(url, response, tf = nil, &progress_block)
504
502
  content_length = response["Content-Length"]
505
- tf = Tempfile.open("chef-rest")
506
- if Chef::Platform.windows?
507
- tf.binmode # required for binary files on Windows platforms
503
+ if tf.nil?
504
+ tf = Tempfile.open("chef-rest")
505
+ if Chef::Platform.windows?
506
+ tf.binmode # required for binary files on Windows platforms
507
+ end
508
508
  end
509
509
  Chef::Log.debug("Streaming download from #{url} to tempfile #{tf.path}")
510
510
  # Stolen from http://www.ruby-forum.com/topic/166423
@@ -42,9 +42,9 @@ class Chef
42
42
  extend Chef::Mixin::ConvertToClassName
43
43
  extend Forwardable
44
44
 
45
- # Backwards Compat:
46
- # Ideally, we should not vomit all of these methods into this base class;
47
- # instead, they should be accessed by hitting the ui object directly.
45
+ # @note Backwards Compat:
46
+ # Ideally, we should not vomit all of these methods into this base class;
47
+ # instead, they should be accessed by hitting the ui object directly.
48
48
  def_delegator :@ui, :stdout
49
49
  def_delegator :@ui, :stderr
50
50
  def_delegator :@ui, :stdin
@@ -105,12 +105,11 @@ class Chef
105
105
  # Explicitly set the category for the current command to +new_category+
106
106
  # The category is normally determined from the first word of the command
107
107
  # name, but some commands make more sense using two or more words
108
- # ===Arguments
109
- # new_category::: A String to set the category to (see examples)
110
- # ===Examples:
111
- # Data bag commands would be in the 'data' category by default. To put them
112
- # in the 'data bag' category:
113
- # category('data bag')
108
+ # @param new_category [String] value to set the category to (see examples)
109
+ #
110
+ # @example Data bag commands would be in the 'data' category by default. To
111
+ # put them in the 'data bag' category:
112
+ # category('data bag')
114
113
  def self.category(new_category)
115
114
  @category = new_category
116
115
  end
@@ -178,8 +177,9 @@ class Chef
178
177
  @config_loader ||= WorkstationConfigLoader.new(nil, Chef::Log)
179
178
  end
180
179
 
181
- def self.load_config(explicit_config_file)
180
+ def self.load_config(explicit_config_file, profile)
182
181
  config_loader.explicit_config_file = explicit_config_file
182
+ config_loader.profile = profile
183
183
  config_loader.load
184
184
 
185
185
  ui.warn("No knife configuration file found") if config_loader.no_config_found?
@@ -196,10 +196,11 @@ class Chef
196
196
 
197
197
  # Run knife for the given +args+ (ARGV), adding +options+ to the list of
198
198
  # CLI options that the subcommand knows how to handle.
199
- # ===Arguments
200
- # args::: usually ARGV
201
- # options::: A Mixlib::CLI option parser hash. These +options+ are how
202
- # subcommands know about global knife CLI options
199
+ #
200
+ # @param args [Array] The arguments. Usually ARGV
201
+ # @param options [Mixlib::CLI option parser hash] These +options+ are how
202
+ # subcommands know about global knife CLI options
203
+ #
203
204
  def self.run(args, options = {})
204
205
  # Fallback debug logging. Normally the logger isn't configured until we
205
206
  # read the config, but this means any logging that happens before the
@@ -404,7 +405,7 @@ class Chef
404
405
  def configure_chef
405
406
  # knife needs to send logger output to STDERR by default
406
407
  Chef::Config[:log_location] = STDERR
407
- config_loader = self.class.load_config(config[:config_file])
408
+ config_loader = self.class.load_config(config[:config_file], config[:profile])
408
409
  config[:config_file] = config_loader.config_location
409
410
 
410
411
  # For CLI options like `--config-option key=value`. These have to get