chef 13.6.4 → 13.7.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (257) hide show
  1. checksums.yaml +4 -4
  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 +6 -6
  256. data/acceptance/top-cookbooks/.kitchen.docker.yml +0 -13
  257. data/acceptance/top-cookbooks/.kitchen.git.yml +0 -11
@@ -20,6 +20,8 @@ require "chef/resource/package"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the gem_package resource to manage gem packages that are only included in recipes. When a package is installed
24
+ # from a local file, it must be added to the node using the remote_file or cookbook_file resources.
23
25
  class GemPackage < Chef::Resource::Package
24
26
  resource_name :gem_package
25
27
 
@@ -20,6 +20,8 @@ require "chef/resource/scm"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the git resource to manage source control resources that exist in a git repository. git version 1.6.5 (or higher)
24
+ # is required to use all of the functionality in the git resource.
23
25
  class Git < Chef::Resource::Scm
24
26
 
25
27
  def initialize(name, run_context = nil)
@@ -19,6 +19,7 @@
19
19
 
20
20
  class Chef
21
21
  class Resource
22
+ # Use the group resource to manage a local group.
22
23
  class Group < Chef::Resource
23
24
 
24
25
  identity_attr :group_name
@@ -23,6 +23,9 @@ require "chef/resource/package"
23
23
 
24
24
  class Chef
25
25
  class Resource
26
+ # Use the homebrew_package resource to manage packages for the macOS platform.
27
+ #
28
+ # @since 12.0
26
29
  class HomebrewPackage < Chef::Resource::Package
27
30
  resource_name :homebrew_package
28
31
  provides :package, os: "darwin"
@@ -22,6 +22,8 @@ require "chef/provider/http_request"
22
22
 
23
23
  class Chef
24
24
  class Resource
25
+ # Use the http_request resource to send an HTTP request (GET, PUT, POST, DELETE, HEAD, or OPTIONS) with an arbitrary
26
+ # message. This resource is often useful when custom callbacks are necessary.
25
27
  class HttpRequest < Chef::Resource
26
28
 
27
29
  identity_attr :url
@@ -21,163 +21,36 @@ require "chef/resource"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # use the ifconfig resource to manage interfaces on *nix systems
25
+ #
26
+ # @example set a static ip on eth1
27
+ # ifconfig '33.33.33.80' do
28
+ # device 'eth1'
29
+ # end
24
30
  class Ifconfig < Chef::Resource
25
-
26
- identity_attr :device
31
+ resource_name :ifconfig
27
32
 
28
33
  state_attrs :inet_addr, :mask
29
34
 
30
35
  default_action :add
31
36
  allowed_actions :add, :delete, :enable, :disable
32
37
 
33
- def initialize(name, run_context = nil)
34
- super
35
- @target = name
36
- @hwaddr = nil
37
- @mask = nil
38
- @inet_addr = nil
39
- @bcast = nil
40
- @mtu = nil
41
- @metric = nil
42
- @device = nil
43
- @onboot = nil
44
- @network = nil
45
- @bootproto = nil
46
- @onparent = nil
47
- @ethtool_opts = nil
48
- @bonding_opts = nil
49
- @master = nil
50
- @slave = nil
51
- end
52
-
53
- def target(arg = nil)
54
- set_or_return(
55
- :target,
56
- arg,
57
- :kind_of => String
58
- )
59
- end
60
-
61
- def device(arg = nil)
62
- set_or_return(
63
- :device,
64
- arg,
65
- :kind_of => String
66
- )
67
- end
68
-
69
- def hwaddr(arg = nil)
70
- set_or_return(
71
- :hwaddr,
72
- arg,
73
- :kind_of => String
74
- )
75
- end
76
-
77
- def inet_addr(arg = nil)
78
- set_or_return(
79
- :inet_addr,
80
- arg,
81
- :kind_of => String
82
- )
83
- end
84
-
85
- def bcast(arg = nil)
86
- set_or_return(
87
- :bcast,
88
- arg,
89
- :kind_of => String
90
- )
91
- end
92
-
93
- def mask(arg = nil)
94
- set_or_return(
95
- :mask,
96
- arg,
97
- :kind_of => String
98
- )
99
- end
100
-
101
- def mtu(arg = nil)
102
- set_or_return(
103
- :mtu,
104
- arg,
105
- :kind_of => String
106
- )
107
- end
108
-
109
- def metric(arg = nil)
110
- set_or_return(
111
- :metric,
112
- arg,
113
- :kind_of => String
114
- )
115
- end
116
-
117
- def onboot(arg = nil)
118
- set_or_return(
119
- :onboot,
120
- arg,
121
- :kind_of => String
122
- )
123
- end
124
-
125
- def network(arg = nil)
126
- set_or_return(
127
- :network,
128
- arg,
129
- :kind_of => String
130
- )
131
- end
132
-
133
- def bootproto(arg = nil)
134
- set_or_return(
135
- :bootproto,
136
- arg,
137
- :kind_of => String
138
- )
139
- end
140
-
141
- def onparent(arg = nil)
142
- set_or_return(
143
- :onparent,
144
- arg,
145
- :kind_of => String
146
- )
147
- end
148
-
149
- def ethtool_opts(arg = nil)
150
- set_or_return(
151
- :ethtool_opts,
152
- arg,
153
- :kind_of => String
154
- )
155
- end
156
-
157
- def bonding_opts(arg = nil)
158
- set_or_return(
159
- :bonding_opts,
160
- arg,
161
- :kind_of => String
162
- )
163
- end
164
-
165
- def master(arg = nil)
166
- set_or_return(
167
- :master,
168
- arg,
169
- :kind_of => String
170
- )
171
- end
172
-
173
- def slave(arg = nil)
174
- set_or_return(
175
- :slave,
176
- arg,
177
- :kind_of => String
178
- )
179
- end
38
+ property :target, String, name_property: true
39
+ property :hwaddr, String
40
+ property :mask, String
41
+ property :inet_addr, String
42
+ property :bcast, String
43
+ property :mtu, String
44
+ property :metric, String
45
+ property :device, String, identity: true
46
+ property :onboot, String
47
+ property :network, String
48
+ property :bootproto, String
49
+ property :onparent, String
50
+ property :ethtool_opts, String
51
+ property :bonding_opts, String
52
+ property :master, String
53
+ property :slave, String
180
54
  end
181
-
182
55
  end
183
56
  end
@@ -21,6 +21,7 @@ require "chef/provider/package/ips"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the ips_package resource to manage packages (using Image Packaging System (IPS)) on the Solaris 11 platform.
24
25
  class IpsPackage < ::Chef::Resource::Package
25
26
  resource_name :ips_package
26
27
  provides :package, os: "solaris2"
@@ -20,6 +20,12 @@ require "chef/resource/script"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the ksh resource to execute scripts using the Korn shell (ksh) interpreter. This resource may also use any
24
+ # f the actions and properties that are available to the execute resource. Commands that are executed with this
25
+ # resource are (by their nature) not idempotent, as they are typically unique to the environment in which they are
26
+ # run. Use not_if and only_if to guard this resource for idempotence.
27
+ #
28
+ # @since 12.6
23
29
  class Ksh < Chef::Resource::Script
24
30
 
25
31
  def initialize(name, run_context = nil)
@@ -17,19 +17,20 @@
17
17
  #
18
18
 
19
19
  require "chef/resource"
20
- require "chef/provider/launchd"
21
20
 
22
21
  class Chef
23
22
  class Resource
23
+ # Use the launchd resource to manage system-wide services (daemons) and per-user services (agents) on the macOS platform.
24
+ #
25
+ # @since 12.8
24
26
  class Launchd < Chef::Resource
27
+ resource_name :launchd
25
28
  provides :launchd, os: "darwin"
26
29
 
27
- identity_attr :label
28
-
29
30
  default_action :create
30
31
  allowed_actions :create, :create_if_missing, :delete, :enable, :disable, :restart
31
32
 
32
- property :label, String, default: lazy { name }, identity: true
33
+ property :label, String, identity: true, name_property: true
33
34
  property :backup, [Integer, FalseClass]
34
35
  property :cookbook, String
35
36
  property :group, [String, Integer]
@@ -22,6 +22,16 @@ require "chef/mixin/securable"
22
22
 
23
23
  class Chef
24
24
  class Resource
25
+ # Use the link resource to create symbolic or hard links.
26
+ #
27
+ # A symbolic link—sometimes referred to as a soft link—is a directory entry that associates a file name with a string
28
+ # that contains an absolute or relative path to a file on any file system. In other words, “a file that contains a path
29
+ # that points to another file.” A symbolic link creates a new file with a new inode that points to the inode location
30
+ # of the original file.
31
+ #
32
+ # A hard link is a directory entry that associates a file with another file in the same file system. In other words,
33
+ # “multiple directory entries to the same file.” A hard link creates a new file that points to the same inode as the
34
+ # original file.
25
35
  class Link < Chef::Resource
26
36
  include Chef::Mixin::Securable
27
37
 
@@ -18,59 +18,32 @@
18
18
  #
19
19
 
20
20
  require "chef/resource"
21
- require "chef/provider/log"
22
21
 
23
22
  class Chef
24
23
  class Resource
24
+ # Use the log resource to create log entries. The log resource behaves like any other resource: built into the resource
25
+ # collection during the compile phase, and then run during the execution phase. (To create a log entry that is not built
26
+ # into the resource collection, use Chef::Log instead of the log resource.)
27
+ #
28
+ # Allows logging a :debug, :info, :warn, and :error levels
29
+ # Defaults to :info level
30
+ #
31
+ # @example logging at default info level
32
+ # log "your string to log"
33
+ #
34
+ # @example logging at specified debug level
35
+ # log "a debug string" do
36
+ # level :debug
37
+ # end
38
+ #
25
39
  class Log < Chef::Resource
40
+ resource_name :log
26
41
 
27
- identity_attr :message
42
+ property :message, String, name_property: true
43
+ property :level, Symbol, equal_to: [ :debug, :info, :warn, :error, :fatal ], default: :info
28
44
 
45
+ allowed_actions :write
29
46
  default_action :write
30
-
31
- # Sends a string from a recipe to a log provider
32
- #
33
- # log "some string to log" do
34
- # level :info # (default) also supports :warn, :debug, and :error
35
- # end
36
- #
37
- # === Example
38
- # log "your string to log"
39
- #
40
- # or
41
- #
42
- # log "a debug string" { level :debug }
43
- #
44
-
45
- # Initialize log resource with a name as the string to log
46
- #
47
- # === Parameters
48
- # name<String>:: Message to log
49
- # collection<Array>:: Collection of included recipes
50
- # node<Chef::Node>:: Node where resource will be used
51
- def initialize(name, run_context = nil)
52
- super
53
- @level = :info
54
- @message = name
55
- end
56
-
57
- def message(arg = nil)
58
- set_or_return(
59
- :message,
60
- arg,
61
- :kind_of => String
62
- )
63
- end
64
-
65
- # <Symbol> Log level, one of :debug, :info, :warn, :error or :fatal
66
- def level(arg = nil)
67
- set_or_return(
68
- :level,
69
- arg,
70
- :equal_to => [ :debug, :info, :warn, :error, :fatal ]
71
- )
72
- end
73
-
74
47
  end
75
48
  end
76
49
  end
@@ -20,6 +20,7 @@ require "chef/resource/package"
20
20
 
21
21
  class Chef
22
22
  class Resource
23
+ # Use the macports_package resource to manage packages for the macOS platform.
23
24
  class MacportsPackage < Chef::Resource::Package
24
25
  resource_name :macports_package
25
26
  end
@@ -21,6 +21,10 @@ require "chef/resource"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the mdadm resource to manage RAID devices in a Linux environment using the mdadm utility. The mdadm resource
25
+ # will create and assemble an array, but it will not create the config file that is used to persist the array upon
26
+ # reboot. If the config file is required, it must be done by specifying a template with the correct array layout,
27
+ # and then by using the mount provider to create a file systems table (fstab) entry.
24
28
  class Mdadm < Chef::Resource
25
29
 
26
30
  identity_attr :raid_device
@@ -21,6 +21,7 @@ require "chef/resource"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the mount resource to manage a mounted file system.
24
25
  class Mount < Chef::Resource
25
26
 
26
27
  identity_attr :device
@@ -21,26 +21,25 @@ require "chef/mixin/uris"
21
21
 
22
22
  class Chef
23
23
  class Resource
24
+ # Use the msu_package resource to install Microsoft Update(MSU) packages on Microsoft Windows machines.
25
+ #
26
+ # @since 12.17
24
27
  class MsuPackage < Chef::Resource::Package
25
28
  include Chef::Mixin::Uris
26
29
 
30
+ resource_name :msu_package
27
31
  provides :msu_package, os: "windows"
28
32
 
29
33
  allowed_actions :install, :remove
30
-
31
- def initialize(name, run_context = nil)
32
- super
33
- @resource_name = :msu_package
34
- @source = name
35
- @action = :install
36
- end
34
+ default_action :install
37
35
 
38
36
  property :source, String,
39
37
  coerce: (proc do |s|
40
38
  unless s.nil?
41
39
  uri_scheme?(s) ? s : Chef::Util::PathHelper.canonical_path(s, false)
42
40
  end
43
- end)
41
+ end),
42
+ default: lazy { |r| r.package_name }
44
43
  property :checksum, String, desired_state: false
45
44
  end
46
45
  end
@@ -19,6 +19,8 @@
19
19
 
20
20
  class Chef
21
21
  class Resource
22
+ # Use the ohai resource to reload the Ohai configuration on a node. This allows recipes that change system attributes
23
+ # (like a recipe that adds a user) to refer to those attributes later on during the chef-client run.
22
24
  class Ohai < Chef::Resource
23
25
  resource_name :ohai
24
26
  provides :ohai