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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -21,6 +21,7 @@ require "chef/provider/package/apt"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the apt_package resource to manage packages on Debian and Ubuntu platforms.
24
25
  class AptPackage < Chef::Resource::Package
25
26
  resource_name :apt_package
26
27
  provides :package, os: "linux", platform_family: "debian"
@@ -20,6 +20,10 @@ require "chef/resource"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # The apt_preference resource allows for the creation of APT preference files. Preference files are used to control
24
+ # which package versions and sources are prioritized during installation.
25
+ #
26
+ # @since 13.3
23
27
  class AptPreference < Chef::Resource
24
28
  resource_name :apt_preference
25
29
  provides :apt_preference
@@ -20,6 +20,10 @@ require "chef/resource"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the apt_repository resource to specify additional APT repositories. Adding a new repository will update
24
+ # APT package cache immediately.
25
+ #
26
+ # @since 12.9
23
27
  class AptRepository < Chef::Resource
24
28
  resource_name :apt_repository
25
29
  provides :apt_repository
@@ -20,6 +20,9 @@ require "chef/resource"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the apt_update resource to manage APT repository updates on Debian and Ubuntu platforms.
24
+ #
25
+ # @since 12.7
23
26
  class AptUpdate < Chef::Resource
24
27
  resource_name :apt_update
25
28
  provides :apt_update
@@ -21,6 +21,10 @@ require "chef/provider/script"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the bash resource to execute scripts using the Bash interpreter. This resource may also use any of the actions
25
+ # and properties that are available to the execute resource. Commands that are executed with this resource are (by
26
+ # their nature) not idempotent, as they are typically unique to the environment in which they are run. Use not_if
27
+ # and only_if to guard this resource for idempotence.
24
28
  class Bash < Chef::Resource::Script
25
29
 
26
30
  def initialize(name, run_context = nil)
@@ -20,6 +20,11 @@ require "chef/resource/windows_script"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the batch resource to execute a batch script using the cmd.exe interpreter on Windows. The batch resource
24
+ # creates and executes a temporary file (similar to how the script resource behaves), rather than running the
25
+ # command inline. Commands that are executed with this resource are (by their nature) not idempotent, as they are
26
+ # typically unique to the environment in which they are run. Use not_if and only_if to guard this resource for
27
+ # idempotence.
23
28
  class Batch < Chef::Resource::WindowsScript
24
29
 
25
30
  provides :batch, os: "windows"
@@ -21,6 +21,10 @@ require "chef/provider/package/aix"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the bff_package resource to manage packages for the AIX platform using the installp utility. When a package is
25
+ # installed from a local file, it must be added to the node using the remote_file or cookbook_file resources.
26
+ #
27
+ # @since 12.0
24
28
  class BffPackage < Chef::Resource::Package
25
29
  end
26
30
  end
@@ -20,6 +20,12 @@ require "chef/resource"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the breakpoint resource to add breakpoints to recipes. Run the chef-shell in chef-client mode, and then use
24
+ # those breakpoints to debug recipes. Breakpoints are ignored by the chef-client during an actual chef-client run.
25
+ # That said, breakpoints are typically used to debug recipes only when running them in a non-production environment,
26
+ # after which they are removed from those recipes before the parent cookbook is uploaded to the Chef server.
27
+ #
28
+ # @since 12.0
23
29
  class Breakpoint < Chef::Resource
24
30
  provides :breakpoint
25
31
  resource_name :breakpoint
@@ -21,24 +21,24 @@ require "chef/mixin/uris"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the cab_package resource to install or remove Microsoft Windows cabinet (.cab) packages.
25
+ #
26
+ # @since 12.15
24
27
  class CabPackage < Chef::Resource::Package
25
28
  include Chef::Mixin::Uris
26
29
 
30
+ resource_name :cab_package
27
31
  provides :cab_package, os: "windows"
28
32
 
29
33
  allowed_actions :install, :remove
30
34
 
31
- def initialize(name, run_context = nil)
32
- super
33
- @resource_name = :cab_package
34
- end
35
-
36
35
  property :source, String,
37
36
  coerce: (proc do |s|
38
37
  unless s.nil?
39
38
  uri_scheme?(s) ? s : Chef::Util::PathHelper.canonical_path(s, false)
40
39
  end
41
- end)
40
+ end),
41
+ default: lazy { |r| r.package_name }
42
42
  end
43
43
  end
44
44
  end
@@ -21,6 +21,18 @@ require "chef/resource/gem_package"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the chef_gem resource to install a gem only for the instance of Ruby that is dedicated to the chef-client.
25
+ # When a gem is installed from a local file, it must be added to the node using the remote_file or cookbook_file
26
+ # resources.
27
+ #
28
+ # The chef_gem resource works with all of the same properties and options as the gem_package resource, but does not
29
+ # accept the gem_binary property because it always uses the CurrentGemEnvironment under which the chef-client is
30
+ # running. In addition to performing actions similar to the gem_package resource, the chef_gem resource does the
31
+ # following:
32
+ # - Runs its actions immediately, before convergence, allowing a gem to be used in a recipe immediately after it is
33
+ # installed
34
+ # - Runs Gem.clear_paths after the action, ensuring that gem is aware of changes so that it can be required
35
+ # immediately after it is installed
24
36
  class ChefGem < Chef::Resource::Package::GemPackage
25
37
  resource_name :chef_gem
26
38
 
@@ -30,6 +42,7 @@ class Chef
30
42
  }
31
43
  property :compile_time, [ true, false ], default: false, desired_state: false
32
44
 
45
+ # force the resource to compile time if the compile time property has been set
33
46
  def after_created
34
47
  if compile_time
35
48
  Array(action).each do |action|
@@ -20,22 +20,20 @@ require "chef/resource/package"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the chocolatey_package resource to manage packages using Chocolatey on the Microsoft Windows platform.
24
+ #
25
+ # @since 12.7
23
26
  class ChocolateyPackage < Chef::Resource::Package
24
27
 
28
+ resource_name :chocolatey_package
25
29
  provides :chocolatey_package, os: "windows"
26
30
 
27
31
  allowed_actions :install, :upgrade, :remove, :uninstall, :purge, :reconfig
28
32
 
29
- def initialize(name, run_context = nil)
30
- super
31
- @resource_name = :chocolatey_package
32
- end
33
-
34
33
  # windows can't take Array options yet
35
34
  property :options, String
36
35
 
37
36
  property :package_name, [String, Array], coerce: proc { |x| [x].flatten }
38
-
39
37
  property :version, [String, Array], coerce: proc { |x| [x].flatten }
40
38
  property :returns, [Integer, Array], default: [ 0 ], desired_state: false
41
39
  end
@@ -24,26 +24,24 @@ require "chef/mixin/securable"
24
24
 
25
25
  class Chef
26
26
  class Resource
27
+ # Use the cookbook_file resource to transfer files from a sub-directory of COOKBOOK_NAME/files/ to a specified path
28
+ # located on a host that is running the chef-client. The file is selected according to file specificity, which allows
29
+ # different source files to be used based on the hostname, host platform (operating system, distro, or as appropriate),
30
+ # or platform version. Files that are located in the COOKBOOK_NAME/files/default sub-directory may be used on any
31
+ # platform.
32
+ #
33
+ # During a chef-client run, the checksum for each local file is calculated and then compared against the checksum for
34
+ # the same file as it currently exists in the cookbook on the Chef server. A file is not transferred when the checksums
35
+ # match. Only files that require an update are transferred from the Chef server to a node.
27
36
  class CookbookFile < Chef::Resource::File
28
37
  include Chef::Mixin::Securable
29
38
 
30
- default_action :create
31
-
32
- def initialize(name, run_context = nil)
33
- super
34
- @provider = Chef::Provider::CookbookFile
35
- @source = ::File.basename(name)
36
- @cookbook = nil
37
- end
39
+ resource_name :cookbook_file
38
40
 
39
- def source(source_filename = nil)
40
- set_or_return(:source, source_filename, :kind_of => [ String, Array ])
41
- end
42
-
43
- def cookbook(cookbook_name = nil)
44
- set_or_return(:cookbook, cookbook_name, :kind_of => String)
45
- end
41
+ property :source, [ String, Array ], default: lazy { ::File.basename(name) }
42
+ property :cookbook, String
46
43
 
44
+ default_action :create
47
45
  end
48
46
  end
49
47
  end
@@ -21,6 +21,8 @@ require "chef/resource"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the cron resource to manage cron entries for time-based job scheduling. Properties for a schedule will default
25
+ # to * if not provided. The cron resource requires access to a crontab program, typically cron.
24
26
  class Cron < Chef::Resource
25
27
 
26
28
  identity_attr :command
@@ -21,6 +21,10 @@ require "chef/provider/script"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the csh resource to execute scripts using the csh interpreter. This resource may also use any of the actions
25
+ # and properties that are available to the execute resource. Commands that are executed with this resource are (by
26
+ # their nature) not idempotent, as they are typically unique to the environment in which they are run. Use not_if
27
+ # and only_if to guard this resource for idempotence.
24
28
  class Csh < Chef::Resource::Script
25
29
 
26
30
  def initialize(name, run_context = nil)
@@ -2,7 +2,7 @@
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
3
  # Author:: Seth Chisamore (<schisamo@chef.io>)
4
4
  # Author:: Tyler Cloke (<tyler@chef.io>)
5
- # Copyright:: Copyright 2008-2016, Chef Software Inc.
5
+ # Copyright:: Copyright 2008-2017, Chef Software Inc.
6
6
  # License:: Apache License, Version 2.0
7
7
  #
8
8
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,14 +19,16 @@
19
19
  #
20
20
 
21
21
  require "chef/resource"
22
- require "chef/provider/directory"
23
22
  require "chef/mixin/securable"
24
23
 
25
24
  class Chef
26
25
  class Resource
26
+ # Use the directory resource to manage a directory, which is a hierarchy of folders that comprises all of the
27
+ # information stored on a computer. The root directory is the top-level, under which the rest of the directory
28
+ # is organized. The directory resource uses the name property to specify the path to a location in a directory.
29
+ # Typically, permission to access that location in the directory is required.
27
30
  class Directory < Chef::Resource
28
-
29
- identity_attr :path
31
+ resource_name :directory
30
32
 
31
33
  state_attrs :group, :mode, :owner
32
34
 
@@ -35,28 +37,8 @@ class Chef
35
37
  default_action :create
36
38
  allowed_actions :create, :delete
37
39
 
38
- def initialize(name, run_context = nil)
39
- super
40
- @path = name
41
- @recursive = false
42
- end
43
-
44
- def recursive(arg = nil)
45
- set_or_return(
46
- :recursive,
47
- arg,
48
- :kind_of => [ TrueClass, FalseClass ]
49
- )
50
- end
51
-
52
- def path(arg = nil)
53
- set_or_return(
54
- :path,
55
- arg,
56
- :kind_of => String
57
- )
58
- end
59
-
40
+ property :path, String, name_property: true, identity: true
41
+ property :recursive, [ TrueClass, FalseClass ], default: false
60
42
  end
61
43
  end
62
44
  end
@@ -21,6 +21,11 @@ require "chef/mixin/shell_out"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the dnf_package resource to install, upgrade, and remove packages with DNF for Fedora platforms. The dnf_package
25
+ # resource is able to resolve provides data for packages much like DNF can do when it is run from the command line.
26
+ # This allows a variety of options for installing packages, like minimum versions, virtual provides, and library names.
27
+ #
28
+ # @since 12.18
24
29
  class DnfPackage < Chef::Resource::Package
25
30
  extend Chef::Mixin::Which
26
31
  extend Chef::Mixin::ShellOut
@@ -20,6 +20,8 @@ require "chef/resource/package"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the dpkg_package resource to manage packages for the dpkg platform. When a package is installed from a local
24
+ # file, it must be added to the node using the remote_file or cookbook_file resources.
23
25
  class DpkgPackage < Chef::Resource::Package
24
26
  resource_name :dpkg_package
25
27
  provides :dpkg_package, os: "linux"
@@ -19,6 +19,11 @@ require "chef/dsl/powershell"
19
19
 
20
20
  class Chef
21
21
  class Resource
22
+ # The dsc_resource resource allows any DSC resource to be used in a Chef recipe, as well as any custom resources
23
+ # that have been added to your Windows PowerShell environment. Microsoft frequently adds new resources to the DSC
24
+ # resource collection.
25
+ #
26
+ # @since 12.2
22
27
  class DscResource < Chef::Resource
23
28
  provides :dsc_resource, os: "windows"
24
29
 
@@ -21,9 +21,15 @@ require "chef/dsl/powershell"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Many DSC resources are comparable to built-in Chef resources. For example, both DSC and Chef have file, package,
25
+ # and service resources. The dsc_script resource is most useful for those DSC resources that do not have a direct
26
+ # comparison to a resource in Chef, such as the Archive resource, a custom DSC resource, an existing DSC script
27
+ # that performs an important task, and so on. Use the dsc_script resource to embed the code that defines a DSC
28
+ # configuration directly within a Chef recipe.
24
29
  class DscScript < Chef::Resource
25
30
  include Chef::DSL::Powershell
26
31
 
32
+ resource_name :dsc_script
27
33
  provides :dsc_script, os: "windows"
28
34
 
29
35
  default_action :run
@@ -19,7 +19,10 @@
19
19
 
20
20
  class Chef
21
21
  class Resource
22
+ # Use the env resource to manage environment keys in Microsoft Windows. After an environment key is set, Microsoft
23
+ # Windows must be restarted before the environment key will be available to the Task Scheduler.
22
24
  class Env < Chef::Resource
25
+ resource_name :env
23
26
  provides :env, os: "windows"
24
27
 
25
28
  default_action :create
@@ -80,6 +80,11 @@ class Chef
80
80
  )
81
81
  end
82
82
 
83
+ # This resource is deprecated.
84
+ def after_created
85
+ Chef.deprecated(:erl_resource, "The #{resource_name} resource (#{source_line}) is deprecated and will be removed from Chef core in 14.0 (April 2018).")
86
+ end
87
+
83
88
  end
84
89
  end
85
90
  end
@@ -22,6 +22,9 @@ require "chef/provider/execute"
22
22
 
23
23
  class Chef
24
24
  class Resource
25
+ # Use the execute resource to execute a single command. Commands that are executed with this resource are (by their
26
+ # nature) not idempotent, as they are typically unique to the environment in which they are run. Use not_if and only_if
27
+ # to guard this resource for idempotence.
25
28
  class Execute < Chef::Resource
26
29
 
27
30
  identity_attr :command
@@ -130,7 +133,8 @@ class Chef
130
133
 
131
134
  property :password, String, sensitive: true
132
135
 
133
- property :sensitive, [ TrueClass, FalseClass ], default: false, coerce: proc { |x| password ? true : x }
136
+ # lazy used to set default value of sensitive to true if password is set
137
+ property :sensitive, [ TrueClass, FalseClass ], default: lazy { |r| r.password ? true : false }
134
138
 
135
139
  property :elevated, [ TrueClass, FalseClass ], default: false
136
140
 
@@ -25,6 +25,7 @@ require "pathname"
25
25
 
26
26
  class Chef
27
27
  class Resource
28
+ # Use the file resource to manage files directly on a node.
28
29
  class File < Chef::Resource
29
30
  include Chef::Mixin::Securable
30
31
 
@@ -43,7 +44,7 @@ class Chef
43
44
  # mutate the new_resource.checksum which would change the
44
45
  # user intent in the new_resource if the resource is reused.
45
46
  #
46
- # @returns [String] Checksum of the file we actually rendered
47
+ # @return [String] Checksum of the file we actually rendered
47
48
  attr_accessor :final_checksum
48
49
 
49
50
  default_action :create
@@ -119,6 +119,16 @@ class Chef
119
119
  v = verification_class.new(@parent_resource, @command, @command_opts, &@block)
120
120
  v.verify(path, opts)
121
121
  end
122
+
123
+ def to_s
124
+ if @block
125
+ "<Proc>"
126
+ elsif @command.is_a?(Symbol)
127
+ "#{@command.inspect} (#{Chef::Resource::File::Verification.lookup(@command).name})"
128
+ elsif @command.is_a?(String)
129
+ @command
130
+ end
131
+ end
122
132
  end
123
133
  end
124
134
  end
@@ -26,25 +26,33 @@ require "chef/mixin/shell_out"
26
26
 
27
27
  class Chef
28
28
  class Resource
29
+ # Use the freebsd_package resource to manage packages for the FreeBSD platform.
29
30
  class FreebsdPackage < Chef::Resource::Package
30
31
  include Chef::Mixin::ShellOut
31
32
 
32
33
  resource_name :freebsd_package
33
34
  provides :package, platform: "freebsd"
34
35
 
36
+ # make sure we assign the appropriate underlying providers based on what
37
+ # package managers exist on this FreeBSD system or the source of the package
38
+ #
39
+ # @return [void]
35
40
  def after_created
36
41
  assign_provider
37
42
  end
38
43
 
44
+ # Is the system at least version 1000017 or is the make variable WITH_PKGNG set
45
+ #
46
+ # @return [Boolean] do we support pkgng
39
47
  def supports_pkgng?
40
48
  ships_with_pkgng? || !!shell_out_compact!("make", "-V", "WITH_PKGNG", :env => nil).stdout.match(/yes/i)
41
49
  end
42
50
 
43
51
  private
44
52
 
53
+ # It was not until __FreeBSD_version 1000017 that pkgng became
54
+ # the default binary package manager. See '/usr/ports/Mk/bsd.port.mk'.
45
55
  def ships_with_pkgng?
46
- # It was not until __FreeBSD_version 1000017 that pkgng became
47
- # the default binary package manager. See '/usr/ports/Mk/bsd.port.mk'.
48
56
  node[:os_version].to_i >= 1000017
49
57
  end
50
58