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
@@ -25,6 +25,9 @@ require "chef/mixin/shell_out"
25
25
 
26
26
  class Chef
27
27
  class Resource
28
+ # Use the openbsd_package resource to manage packages for the OpenBSD platform.
29
+ #
30
+ # @since 12.1
28
31
  class OpenbsdPackage < Chef::Resource::Package
29
32
  include Chef::Mixin::ShellOut
30
33
 
@@ -20,6 +20,12 @@ require "chef/resource"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the osx_profile resource to manage configuration profiles (.mobileconfig files)
24
+ # on the macOS platform. The osx_profile resource installs profiles by using
25
+ # the uuidgen library to generate a unique ProfileUUID, and then using the
26
+ # profiles command to install the profile on the system.
27
+ #
28
+ # @since 12.7
23
29
  class OsxProfile < Chef::Resource
24
30
  provides :osx_profile, os: "darwin"
25
31
  provides :osx_config_profile, os: "darwin"
@@ -29,46 +35,10 @@ class Chef
29
35
  default_action :install
30
36
  allowed_actions :install, :remove
31
37
 
32
- def initialize(name, run_context = nil)
33
- super
34
- @profile_name = name
35
- @profile = nil
36
- @identifier = nil
37
- @path = nil
38
- end
39
-
40
- def profile_name(arg = nil)
41
- set_or_return(
42
- :profile_name,
43
- arg,
44
- :kind_of => [ String ]
45
- )
46
- end
47
-
48
- def profile(arg = nil)
49
- set_or_return(
50
- :profile,
51
- arg,
52
- :kind_of => [ String, Hash ]
53
- )
54
- end
55
-
56
- def identifier(arg = nil)
57
- set_or_return(
58
- :identifier,
59
- arg,
60
- :kind_of => [ String ]
61
- )
62
- end
63
-
64
- def path(arg = nil)
65
- set_or_return(
66
- :path,
67
- arg,
68
- :kind_of => [ String ]
69
- )
70
- end
71
-
38
+ property :profile_name, String, name_property: true
39
+ property :profile, [ String, Hash ]
40
+ property :identifier, String
41
+ property :path, String
72
42
  end
73
43
  end
74
44
  end
@@ -21,6 +21,12 @@ require "chef/resource"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the package resource to manage packages. When the package is installed from a local file (such as with RubyGems,
25
+ # dpkg, or RPM Package Manager), the file must be added to the node using the remote_file or cookbook_file resources.
26
+ #
27
+ # This resource is the base resource for several other resources used for package management on specific platforms.
28
+ # While it is possible to use each of these specific resources, it is recommended to use the package resource as often
29
+ # as possible.
24
30
  class Package < Chef::Resource
25
31
  resource_name :package
26
32
 
@@ -20,6 +20,7 @@ require "chef/resource/package"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the pacman_package resource to manage packages (using pacman) on the Arch Linux platform.
23
24
  class PacmanPackage < Chef::Resource::Package
24
25
  resource_name :pacman_package
25
26
  provides :pacman_package, os: "linux"
@@ -21,6 +21,9 @@ require "chef/provider/package/paludis"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the paludis_package resource to manage packages for the Paludis platform.
25
+ #
26
+ # @since 12.1
24
27
  class PaludisPackage < Chef::Resource::Package
25
28
  resource_name :paludis_package
26
29
  provides :paludis_package, os: "linux"
@@ -21,6 +21,10 @@ require "chef/provider/script"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the perl resource to execute scripts using the Perl 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 and
27
+ # only_if to guard this resource for idempotence.
24
28
  class Perl < Chef::Resource::Script
25
29
  def initialize(name, run_context = nil)
26
30
  super
@@ -20,6 +20,7 @@ require "chef/resource/package"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the portage_package resource to manage packages for the Gentoo platform.
23
24
  class PortagePackage < Chef::Resource::Package
24
25
  resource_name :portage_package
25
26
  def initialize(name, run_context = nil)
@@ -20,6 +20,11 @@ require "chef/mixin/uris"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the powershell_package resource to install and manage packages via the Powershell Package Manager for the
24
+ # Microsoft Windows platform. The powershell_package resource requires administrative access, and a source must be
25
+ # configured in the Powershell Package Manager via the Register-PackageSource command
26
+ #
27
+ # @since 12.16
23
28
  class PowershellPackage < Chef::Resource::Package
24
29
  include Chef::Mixin::Uris
25
30
 
@@ -19,6 +19,14 @@ require "chef/resource/windows_script"
19
19
 
20
20
  class Chef
21
21
  class Resource
22
+ # Use the powershell_script resource to execute a script using the Windows PowerShell interpreter, much like how the
23
+ # script and script-based resources—bash, csh, perl, python, and ruby—are used. The powershell_script is specific to
24
+ # the Microsoft Windows platform and the Windows PowerShell interpreter.
25
+ #
26
+ # The powershell_script resource creates and executes a temporary file (similar to how the script resource behaves),
27
+ # rather than running the command inline. Commands that are executed with this resource are (by their nature) not
28
+ # idempotent, as they are typically unique to the environment in which they are run. Use not_if and only_if to guard
29
+ # this resource for idempotence.
22
30
  class PowershellScript < Chef::Resource::WindowsScript
23
31
  provides :powershell_script, os: "windows"
24
32
 
@@ -20,6 +20,10 @@ require "chef/provider/script"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the python resource to execute scripts using the Python interpreter. This resource may also use any of the actions
24
+ # and properties that are available to the execute resource. Commands that are executed with this resource are (by
25
+ # their nature) not idempotent, as they are typically unique to the environment in which they are run. Use not_if and
26
+ # only_if to guard this resource for idempotence.
23
27
  class Python < Chef::Resource::Script
24
28
  def initialize(name, run_context = nil)
25
29
  super
@@ -18,31 +18,25 @@
18
18
 
19
19
  require "chef/resource"
20
20
 
21
- # In using this resource via notifications, it's important to *only* use
22
- # immediate notifications. Delayed notifications produce unintuitive and
23
- # probably undesired results.
24
21
  class Chef
25
22
  class Resource
23
+ # Use the reboot resource to reboot a node, a necessary step with some
24
+ # installations on certain platforms. This resource is supported for use on
25
+ # the Microsoft Windows, macOS, and Linux platforms.
26
+ #
27
+ # In using this resource via notifications, it's important to *only* use
28
+ # immediate notifications. Delayed notifications produce unintuitive and
29
+ # probably undesired results.
30
+ #
31
+ # @since 12.0
26
32
  class Reboot < Chef::Resource
27
- allowed_actions :request_reboot, :reboot_now, :cancel
28
-
29
- def initialize(name, run_context = nil)
30
- super
31
- @provider = Chef::Provider::Reboot
32
-
33
- @reason = "Reboot by Chef"
34
- @delay_mins = 0
33
+ resource_name :reboot
35
34
 
36
- # no default action.
37
- end
38
-
39
- def reason(arg = nil)
40
- set_or_return(:reason, arg, :kind_of => String)
41
- end
35
+ allowed_actions :request_reboot, :reboot_now, :cancel
36
+ default_action :nothing # make sure people are quite clear what they want
42
37
 
43
- def delay_mins(arg = nil)
44
- set_or_return(:delay_mins, arg, :kind_of => Integer)
45
- end
38
+ property :reason, String, default: "Reboot by Chef"
39
+ property :delay_mins, Integer, default: 0
46
40
  end
47
41
  end
48
42
  end
@@ -21,6 +21,7 @@ require "chef/digester"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the registry_key resource to create and delete registry keys in Microsoft Windows.
24
25
  class RegistryKey < Chef::Resource
25
26
  identity_attr :key
26
27
  state_attrs :values
@@ -23,6 +23,9 @@ require "chef/mixin/securable"
23
23
 
24
24
  class Chef
25
25
  class Resource
26
+ # Use the remote_directory resource to incrementally transfer a directory from a cookbook to a node. The director
27
+ # that is copied from the cookbook should be located under COOKBOOK_NAME/files/default/REMOTE_DIRECTORY. The
28
+ # remote_directory resource will obey file specificity.
26
29
  class RemoteDirectory < Chef::Resource::Directory
27
30
  include Chef::Mixin::Securable
28
31
 
@@ -25,6 +25,8 @@ require "chef/mixin/uris"
25
25
 
26
26
  class Chef
27
27
  class Resource
28
+ # Use the remote_file resource to transfer a file from a remote location using file specificity. This resource is
29
+ # similar to the file resource.
28
30
  class RemoteFile < Chef::Resource::File
29
31
  include Chef::Mixin::Securable
30
32
 
@@ -20,6 +20,10 @@ require "chef/resource"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # @author Tyler Ball
24
+ # @attr [Resource] resource the Chef resource object to notify to
25
+ # @attr [Action] action the action to notify
26
+ # @attr [Resource] notifying_resource the Chef resource performing the notification
23
27
  class Notification
24
28
 
25
29
  attr_accessor :resource, :action, :notifying_resource
@@ -30,6 +34,10 @@ class Chef
30
34
  @notifying_resource = notifying_resource
31
35
  end
32
36
 
37
+ # Is the current notification a duplicate of another notification
38
+ #
39
+ # @param [Notification] another notification object to compare to
40
+ # @return [Boolean] does the resource match
33
41
  def duplicates?(other_notification)
34
42
  unless other_notification.respond_to?(:resource) && other_notification.respond_to?(:action)
35
43
  msg = "only duck-types of Chef::Resource::Notification can be checked for duplication "\
@@ -41,6 +49,9 @@ class Chef
41
49
 
42
50
  # If resource and/or notifying_resource is not a resource object, this will look them up in the resource collection
43
51
  # and fix the references from strings to actual Resource objects.
52
+ # @param [ResourceCollection] resource_collection
53
+ #
54
+ # @return [void]
44
55
  def resolve_resource_reference(resource_collection)
45
56
  return resource if resource.kind_of?(Chef::Resource) && notifying_resource.kind_of?(Chef::Resource)
46
57
 
@@ -55,6 +66,9 @@ class Chef
55
66
 
56
67
  # This will look up the resource if it is not a Resource Object. It will complain if it finds multiple
57
68
  # resources, can't find a resource, or gets invalid syntax.
69
+ # @param [ResourceCollection] resource_collection
70
+ #
71
+ # @return [void]
58
72
  def fix_resource_reference(resource_collection)
59
73
  matching_resource = resource_collection.find(resource)
60
74
  if Array(matching_resource).size > 1
@@ -84,6 +98,9 @@ is defined near #{notifying_resource.source_line}
84
98
 
85
99
  # This will look up the notifying_resource if it is not a Resource Object. It will complain if it finds multiple
86
100
  # resources, can't find a resource, or gets invalid syntax.
101
+ # @param [ResourceCollection] resource_collection
102
+ #
103
+ # @return [void]
87
104
  def fix_notifier_reference(resource_collection)
88
105
  matching_notifier = resource_collection.find(notifying_resource)
89
106
  if Array(matching_notifier).size > 1
@@ -21,6 +21,7 @@ require "chef/resource"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the route resource to manage the system routing table in a Linux environment.
24
25
  class Route < Chef::Resource
25
26
  default_action :add
26
27
  allowed_actions :add, :delete
@@ -21,6 +21,7 @@ require "chef/provider/package/rpm"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the rpm_package resource to manage packages for the RPM Package Manager platform.
24
25
  class RpmPackage < Chef::Resource::Package
25
26
  resource_name :rpm_package
26
27
  provides :rpm_package, os: %w{linux aix}
@@ -21,6 +21,10 @@ require "chef/provider/script"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the ruby resource to execute scripts using the Ruby 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 and
27
+ # only_if to guard this resource for idempotence.
24
28
  class Ruby < Chef::Resource::Script
25
29
  def initialize(name, run_context = nil)
26
30
  super
@@ -22,6 +22,9 @@ require "chef/provider/ruby_block"
22
22
 
23
23
  class Chef
24
24
  class Resource
25
+ # Use the ruby_block resource to execute Ruby code during a chef-client run. Ruby code in the ruby_block resource is
26
+ # evaluated with other resources during convergence, whereas Ruby code outside of a ruby_block resource is evaluated
27
+ # before other resources, as the recipe is compiled.
25
28
  class RubyBlock < Chef::Resource
26
29
  default_action :run
27
30
  allowed_actions :create, :run
@@ -22,6 +22,10 @@ require "chef/provider/script"
22
22
 
23
23
  class Chef
24
24
  class Resource
25
+ # Use the script resource to execute scripts using a specified interpreter, such as Bash, csh, Perl, Python, or Ruby.
26
+ # This resource may also use any of the actions and properties that are available to the execute resource. Commands
27
+ # that are executed with this resource are (by their nature) not idempotent, as they are typically unique to the
28
+ # environment in which they are run. Use not_if and only_if to guard this resource for idempotence.
25
29
  class Script < Chef::Resource::Execute
26
30
  identity_attr :name
27
31
 
@@ -22,6 +22,7 @@ require "shellwords"
22
22
 
23
23
  class Chef
24
24
  class Resource
25
+ # Use the service resource to manage a service.
25
26
  class Service < Chef::Resource
26
27
  identity_attr :service_name
27
28
 
@@ -21,6 +21,7 @@ require "chef/provider/package/smartos"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the smartos_package resource to manage packages for the SmartOS platform.
24
25
  class SmartosPackage < Chef::Resource::Package
25
26
  resource_name :smartos_package
26
27
  provides :package, os: "solaris2", platform_family: "smartos"
@@ -22,6 +22,7 @@ require "chef/provider/package/solaris"
22
22
 
23
23
  class Chef
24
24
  class Resource
25
+ # The solaris_package resource is used to manage packages for the Solaris platform.
25
26
  class SolarisPackage < Chef::Resource::Package
26
27
  resource_name :solaris_package
27
28
  provides :package, os: "solaris2", platform_family: "nexentacore"
@@ -21,6 +21,7 @@ require "chef/resource/scm"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the subversion resource to manage source control resources that exist in a Subversion repository.
24
25
  class Subversion < Chef::Resource::Scm
25
26
  allowed_actions :force_export
26
27
 
@@ -21,6 +21,9 @@ require "iniparse"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the systemd_unit resource to create, manage, and run systemd units.
25
+ #
26
+ # @since 12.11
24
27
  class SystemdUnit < Chef::Resource
25
28
  resource_name :systemd_unit
26
29
 
@@ -46,6 +49,9 @@ class Chef
46
49
  default: true, desired_state: false
47
50
  property :verify, [TrueClass, FalseClass],
48
51
  default: true, desired_state: false
52
+ property :unit_name, String, desired_state: false,
53
+ identity: true,
54
+ name_property: true
49
55
 
50
56
  def to_ini
51
57
  case content
@@ -24,6 +24,15 @@ require "chef/mixin/securable"
24
24
 
25
25
  class Chef
26
26
  class Resource
27
+ # A cookbook template is an Embedded Ruby (ERB) template that is used to dynamically generate static text files.
28
+ # Templates may contain Ruby expressions and statements, and are a great way to manage configuration files. Use the
29
+ # template resource to add cookbook templates to recipes; place the corresponding Embedded Ruby (ERB) template file
30
+ # in a cookbook’s /templates directory.
31
+ #
32
+ # Use the template resource to manage the contents of a file using an Embedded Ruby (ERB) template by transferring
33
+ # files from a sub-directory of COOKBOOK_NAME/templates/ to a specified path located on a host that is running the
34
+ # chef-client. This resource includes actions and properties from the file resource. Template files managed by the
35
+ # template resource follow the same file specificity rules as the remote_file and file resources.
27
36
  class Template < Chef::Resource::File
28
37
  include Chef::Mixin::Securable
29
38
 
@@ -20,6 +20,7 @@ require "chef/resource"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the user resource to add users, update existing users, remove users, and to lock/unlock user passwords.
23
24
  class User < Chef::Resource
24
25
  resource_name :user_resource_abstract_base_class # this prevents magickal class name DSL wiring
25
26
  identity_attr :username
@@ -23,6 +23,8 @@ require "chef/win32/error" if RUBY_PLATFORM =~ /mswin|mingw|windows/
23
23
 
24
24
  class Chef
25
25
  class Resource
26
+ # Use the windows_package resource to manage Microsoft Installer Package (MSI) packages for the Microsoft Windows
27
+ # platform.
26
28
  class WindowsPackage < Chef::Resource::Package
27
29
  include Chef::Mixin::Uris
28
30
 
@@ -20,21 +20,16 @@ require "chef/resource"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the windows_path resource to manage the path environment variable on Microsoft Windows.
24
+ #
25
+ # @since 13.4
23
26
  class WindowsPath < Chef::Resource
24
-
25
- provides :windows_path, os: "windows"
27
+ resource_name :windows_path
28
+ provides :windows_path
26
29
 
27
30
  allowed_actions :add, :remove
28
31
  default_action :add
29
32
 
30
- def initialize(name, run_context = nil)
31
- super
32
- @resource_name = :windows_path
33
- @path = name
34
- @provider = Chef::Provider::WindowsPath
35
- @action = :add
36
- end
37
-
38
33
  property :path, String, name_property: true
39
34
  end
40
35
  end