chef 15.4.45 → 15.5.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (244) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -3
  3. data/Rakefile +5 -3
  4. data/chef.gemspec +2 -1
  5. data/lib/chef/application.rb +2 -2
  6. data/lib/chef/application/client.rb +1 -1
  7. data/lib/chef/application/knife.rb +1 -0
  8. data/lib/chef/application/solo.rb +1 -1
  9. data/lib/chef/chef_class.rb +1 -6
  10. data/lib/chef/chef_fs.rb +1 -1
  11. data/lib/chef/chef_fs/file_pattern.rb +1 -1
  12. data/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb +2 -2
  13. data/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb +2 -2
  14. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_artifact_dir.rb +1 -1
  15. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +7 -1
  16. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +4 -3
  17. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +3 -3
  18. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_versioned_cookbook_dir.rb +1 -1
  19. data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +3 -3
  20. data/lib/chef/chef_fs/knife.rb +1 -1
  21. data/lib/chef/chef_fs/path_utils.rb +2 -2
  22. data/lib/chef/client.rb +4 -5
  23. data/lib/chef/config.rb +3 -2
  24. data/lib/chef/cookbook/chefignore.rb +16 -11
  25. data/lib/chef/cookbook/cookbook_version_loader.rb +1 -1
  26. data/lib/chef/cookbook/syntax_check.rb +5 -3
  27. data/lib/chef/cookbook_loader.rb +3 -3
  28. data/lib/chef/cookbook_uploader.rb +1 -1
  29. data/lib/chef/data_collector.rb +2 -2
  30. data/lib/chef/data_collector/run_end_message.rb +1 -0
  31. data/lib/chef/deprecated.rb +4 -0
  32. data/lib/chef/dsl/core.rb +1 -1
  33. data/lib/chef/dsl/platform_introspection.rb +9 -18
  34. data/lib/chef/event_loggers/windows_eventlog.rb +1 -1
  35. data/lib/chef/file_content_management/deploy.rb +3 -3
  36. data/lib/chef/file_content_management/deploy/mv_windows.rb +2 -2
  37. data/lib/chef/file_content_management/tempfile.rb +1 -1
  38. data/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +2 -2
  39. data/lib/chef/http.rb +1 -1
  40. data/lib/chef/http/socketless_chef_zero_client.rb +1 -1
  41. data/lib/chef/knife.rb +4 -3
  42. data/lib/chef/knife/config_get.rb +2 -1
  43. data/lib/chef/knife/configure.rb +1 -1
  44. data/lib/chef/knife/cookbook_metadata_from_file.rb +6 -0
  45. data/lib/chef/knife/core/generic_presenter.rb +1 -1
  46. data/lib/chef/knife/core/status_presenter.rb +1 -1
  47. data/lib/chef/knife/ssh.rb +6 -0
  48. data/lib/chef/local_mode.rb +1 -1
  49. data/lib/chef/mash.rb +21 -232
  50. data/lib/chef/mixin/file_class.rb +2 -2
  51. data/lib/chef/mixin/lazy_module_include.rb +1 -1
  52. data/lib/chef/mixin/path_sanity.rb +3 -39
  53. data/lib/chef/mixin/securable.rb +1 -1
  54. data/lib/chef/mixin/shell_out.rb +4 -5
  55. data/lib/chef/mixin/template.rb +1 -1
  56. data/lib/chef/mixin/user_context.rb +3 -3
  57. data/lib/chef/mixin/which.rb +10 -38
  58. data/lib/chef/mixin/windows_architecture_helper.rb +6 -6
  59. data/lib/chef/mixin/windows_env_helper.rb +5 -5
  60. data/lib/chef/node/attribute.rb +2 -2
  61. data/lib/chef/node_map.rb +17 -4
  62. data/lib/chef/platform/query_helpers.rb +4 -2
  63. data/lib/chef/platform/rebooter.rb +1 -1
  64. data/lib/chef/platform/service_helpers.rb +14 -85
  65. data/lib/chef/provider.rb +2 -0
  66. data/lib/chef/provider/file.rb +2 -2
  67. data/lib/chef/provider/ifconfig/redhat.rb +1 -1
  68. data/lib/chef/provider/link.rb +3 -3
  69. data/lib/chef/provider/mount/solaris.rb +1 -1
  70. data/lib/chef/provider/package/yum.rb +1 -1
  71. data/lib/chef/provider/registry_key.rb +1 -1
  72. data/lib/chef/provider/remote_directory.rb +3 -3
  73. data/lib/chef/provider/remote_file/fetcher.rb +2 -2
  74. data/lib/chef/provider/remote_file/local_file.rb +1 -1
  75. data/lib/chef/provider/script.rb +3 -3
  76. data/lib/chef/provider/service.rb +5 -2
  77. data/lib/chef/provider/service/arch.rb +1 -1
  78. data/lib/chef/provider/service/debian.rb +4 -4
  79. data/lib/chef/provider/service/init.rb +1 -1
  80. data/lib/chef/provider/service/insserv.rb +4 -4
  81. data/lib/chef/provider/service/invokercd.rb +4 -4
  82. data/lib/chef/provider/service/redhat.rb +4 -4
  83. data/lib/chef/provider/service/systemd.rb +19 -3
  84. data/lib/chef/provider/service/upstart.rb +3 -3
  85. data/lib/chef/provider/subversion.rb +1 -1
  86. data/lib/chef/provider/systemd_unit.rb +26 -2
  87. data/lib/chef/provider/windows_path.rb +3 -3
  88. data/lib/chef/provider/windows_task.rb +4 -4
  89. data/lib/chef/resource.rb +1 -0
  90. data/lib/chef/resource/bash.rb +2 -0
  91. data/lib/chef/resource/batch.rb +2 -0
  92. data/lib/chef/resource/breakpoint.rb +3 -1
  93. data/lib/chef/resource/build_essential.rb +3 -3
  94. data/lib/chef/resource/chef_sleep.rb +70 -0
  95. data/lib/chef/resource/cookbook_file.rb +2 -1
  96. data/lib/chef/resource/csh.rb +2 -0
  97. data/lib/chef/resource/directory.rb +2 -0
  98. data/lib/chef/resource/dmg_package.rb +1 -1
  99. data/lib/chef/resource/dnf_package.rb +1 -1
  100. data/lib/chef/resource/execute.rb +2 -0
  101. data/lib/chef/resource/file.rb +2 -1
  102. data/lib/chef/resource/git.rb +2 -0
  103. data/lib/chef/resource/group.rb +1 -1
  104. data/lib/chef/resource/homebrew_package.rb +1 -1
  105. data/lib/chef/resource/http_request.rb +2 -0
  106. data/lib/chef/resource/ifconfig.rb +3 -1
  107. data/lib/chef/resource/ksh.rb +2 -0
  108. data/lib/chef/resource/link.rb +4 -2
  109. data/lib/chef/resource/locale.rb +1 -1
  110. data/lib/chef/resource/log.rb +2 -0
  111. data/lib/chef/resource/ohai.rb +2 -0
  112. data/lib/chef/resource/perl.rb +2 -0
  113. data/lib/chef/resource/python.rb +2 -0
  114. data/lib/chef/resource/reboot.rb +2 -0
  115. data/lib/chef/resource/registry_key.rb +2 -0
  116. data/lib/chef/resource/remote_directory.rb +3 -2
  117. data/lib/chef/resource/remote_file.rb +1 -0
  118. data/lib/chef/resource/ruby.rb +2 -0
  119. data/lib/chef/resource/ruby_block.rb +2 -0
  120. data/lib/chef/resource/scm.rb +2 -0
  121. data/lib/chef/resource/script.rb +2 -0
  122. data/lib/chef/resource/service.rb +9 -1
  123. data/lib/chef/resource/solaris_package.rb +1 -1
  124. data/lib/chef/resource/subversion.rb +2 -0
  125. data/lib/chef/resource/sudo.rb +1 -1
  126. data/lib/chef/resource/systemd_unit.rb +1 -0
  127. data/lib/chef/resource/template.rb +2 -0
  128. data/lib/chef/resource/user.rb +2 -0
  129. data/lib/chef/resource/user/aix_user.rb +2 -0
  130. data/lib/chef/resource/user/linux_user.rb +2 -0
  131. data/lib/chef/resource/user/pw_user.rb +2 -0
  132. data/lib/chef/resource/user/solaris_user.rb +2 -0
  133. data/lib/chef/resource/user/windows_user.rb +2 -0
  134. data/lib/chef/resource/whyrun_safe_ruby_block.rb +1 -0
  135. data/lib/chef/resource/windows_ad_join.rb +1 -1
  136. data/lib/chef/resource/windows_env.rb +1 -1
  137. data/lib/chef/resource/windows_feature.rb +2 -2
  138. data/lib/chef/resource/windows_feature_powershell.rb +1 -1
  139. data/lib/chef/resource/windows_firewall_rule.rb +11 -6
  140. data/lib/chef/resource/windows_script.rb +3 -1
  141. data/lib/chef/resource/yum_package.rb +1 -1
  142. data/lib/chef/resource_reporter.rb +1 -1
  143. data/lib/chef/resources.rb +1 -0
  144. data/lib/chef/run_context.rb +1 -1
  145. data/lib/chef/run_lock.rb +5 -5
  146. data/lib/chef/search/query.rb +0 -3
  147. data/lib/chef/train_transport.rb +3 -1
  148. data/lib/chef/util/powershell/ps_credential.rb +2 -2
  149. data/lib/chef/util/selinux.rb +1 -1
  150. data/lib/chef/util/windows/logon_session.rb +2 -2
  151. data/lib/chef/version.rb +1 -1
  152. data/lib/chef/win32/eventlog.rb +2 -2
  153. data/spec/data/cookbooks/starter/chefignore +8 -0
  154. data/spec/data/cookbooks/starter/files/sample.txt +1 -0
  155. data/spec/data/cookbooks/starter/metadata.rb +2 -0
  156. data/spec/data/cookbooks/starter/recipes/default.rb +4 -0
  157. data/spec/functional/event_loggers/windows_eventlog_spec.rb +1 -1
  158. data/spec/functional/mixin/user_context_spec.rb +2 -2
  159. data/spec/functional/rebooter_spec.rb +1 -1
  160. data/spec/functional/resource/cookbook_file_spec.rb +2 -2
  161. data/spec/functional/resource/template_spec.rb +1 -1
  162. data/spec/functional/version_spec.rb +1 -1
  163. data/spec/functional/win32/crypto_spec.rb +1 -1
  164. data/spec/functional/win32/security_spec.rb +1 -1
  165. data/spec/functional/win32/service_manager_spec.rb +1 -1
  166. data/spec/functional/win32/sid_spec.rb +2 -2
  167. data/spec/functional/win32/version_info_spec.rb +1 -1
  168. data/spec/functional/win32/versions_spec.rb +1 -1
  169. data/spec/integration/knife/config_get_profile_spec.rb +2 -2
  170. data/spec/integration/knife/config_get_spec.rb +9 -2
  171. data/spec/integration/knife/config_list_profiles_spec.rb +2 -2
  172. data/spec/integration/knife/config_use_profile_spec.rb +2 -2
  173. data/spec/integration/knife/list_spec.rb +2 -2
  174. data/spec/integration/solo/solo_spec.rb +1 -1
  175. data/spec/support/matchers/leak.rb +1 -1
  176. data/spec/support/mock/platform.rb +1 -1
  177. data/spec/support/platform_helpers.rb +2 -0
  178. data/spec/support/shared/integration/integration_helper.rb +1 -1
  179. data/spec/support/shared/integration/knife_support.rb +1 -1
  180. data/spec/support/shared/unit/provider/file.rb +4 -4
  181. data/spec/unit/application/client_spec.rb +2 -2
  182. data/spec/unit/application/knife_spec.rb +17 -0
  183. data/spec/unit/application_spec.rb +1 -1
  184. data/spec/unit/chef_fs/file_pattern_spec.rb +2 -2
  185. data/spec/unit/chef_fs/path_util_spec.rb +3 -3
  186. data/spec/unit/client_spec.rb +2 -2
  187. data/spec/unit/cookbook/chefignore_spec.rb +31 -11
  188. data/spec/unit/cookbook/cookbook_version_loader_spec.rb +1 -1
  189. data/spec/unit/cookbook/syntax_check_spec.rb +2 -2
  190. data/spec/unit/cookbook_loader_spec.rb +2 -2
  191. data/spec/unit/cookbook_uploader_spec.rb +6 -1
  192. data/spec/unit/data_bag_spec.rb +2 -2
  193. data/spec/unit/data_collector_spec.rb +7 -0
  194. data/spec/unit/dsl/platform_introspection_spec.rb +31 -1
  195. data/spec/unit/file_content_management/deploy/mv_windows_spec.rb +1 -1
  196. data/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +1 -1
  197. data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +7 -0
  198. data/spec/unit/knife/cookbook_show_spec.rb +1 -1
  199. data/spec/unit/knife/core/gem_glob_loader_spec.rb +1 -1
  200. data/spec/unit/knife/core/hashed_command_loader_spec.rb +1 -1
  201. data/spec/unit/knife/core/subcommand_loader_spec.rb +1 -1
  202. data/spec/unit/knife/core/ui_spec.rb +2 -2
  203. data/spec/unit/knife/data_bag_from_file_spec.rb +2 -2
  204. data/spec/unit/knife/environment_from_file_spec.rb +2 -2
  205. data/spec/unit/knife/ssh_spec.rb +27 -17
  206. data/spec/unit/knife/status_spec.rb +1 -1
  207. data/spec/unit/knife/supermarket_install_spec.rb +1 -1
  208. data/spec/unit/mixin/path_sanity_spec.rb +3 -3
  209. data/spec/unit/mixin/shell_out_spec.rb +2 -3
  210. data/spec/unit/mixin/template_spec.rb +4 -4
  211. data/spec/unit/mixin/user_context_spec.rb +3 -3
  212. data/spec/unit/node_map_spec.rb +12 -12
  213. data/spec/unit/platform/query_helpers_spec.rb +9 -9
  214. data/spec/unit/provider/execute_spec.rb +1 -1
  215. data/spec/unit/provider/link_spec.rb +5 -5
  216. data/spec/unit/provider/package/openbsd_spec.rb +1 -1
  217. data/spec/unit/provider/package/smartos_spec.rb +1 -1
  218. data/spec/unit/provider/package/windows/exe_spec.rb +1 -1
  219. data/spec/unit/provider/package/windows_spec.rb +2 -2
  220. data/spec/unit/provider/remote_file/fetcher_spec.rb +2 -2
  221. data/spec/unit/provider/remote_file/local_file_spec.rb +1 -1
  222. data/spec/unit/provider/remote_file/network_file_spec.rb +1 -1
  223. data/spec/unit/provider/script_spec.rb +2 -2
  224. data/spec/unit/provider/service/systemd_service_spec.rb +26 -2
  225. data/spec/unit/provider/subversion_spec.rb +3 -3
  226. data/spec/unit/provider/systemd_unit_spec.rb +53 -4
  227. data/spec/unit/provider/user/dscl_spec.rb +1 -1
  228. data/spec/unit/provider_resolver_spec.rb +41 -61
  229. data/spec/unit/resource/chef_sleep_spec.rb +30 -0
  230. data/spec/unit/resource/cookbook_file_spec.rb +3 -3
  231. data/spec/unit/resource/remote_file_spec.rb +3 -3
  232. data/spec/unit/resource/windows_firewall_rule_spec.rb +69 -12
  233. data/spec/unit/role_spec.rb +2 -2
  234. data/spec/unit/shell_spec.rb +1 -1
  235. data/spec/unit/util/selinux_spec.rb +2 -2
  236. data/spec/unit/win32/error_spec.rb +1 -1
  237. data/spec/unit/win32/link_spec.rb +1 -1
  238. data/spec/unit/win32/security_spec.rb +1 -1
  239. data/spec/unit/windows_service_spec.rb +1 -1
  240. data/tasks/docs.rb +10 -2
  241. data/tasks/rspec.rb +8 -6
  242. metadata +32 -8
  243. data/lib/chef/mixin/train_helpers.rb +0 -60
  244. data/spec/unit/mash_spec.rb +0 -51
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Nimisha Sharad (<nimisha.sharad@msystechnologies.com>)
3
- # Copyright:: Copyright 2008-2017, Chef Software Inc.
3
+ # Copyright:: Copyright 2008-2019, Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,14 +16,14 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require_relative "../mixin/windows_env_helper" if Chef::Platform.windows?
19
+ require_relative "../mixin/windows_env_helper" if ChefUtils.windows?
20
20
  require_relative "../mixin/wide_string"
21
21
  require_relative "../exceptions"
22
22
 
23
23
  class Chef
24
24
  class Provider
25
25
  class WindowsPath < Chef::Provider
26
- include Chef::Mixin::WindowsEnvHelper if Chef::Platform.windows?
26
+ include Chef::Mixin::WindowsEnvHelper if ChefUtils.windows?
27
27
 
28
28
  provides :windows_path
29
29
 
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: Nimisha Sharad (<nimisha.sharad@msystechnologies.com>)
3
- # Copyright:: Copyright 2008-2018, Chef Software Inc.
3
+ # Copyright:: Copyright 2008-2019, Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,11 +18,11 @@
18
18
 
19
19
  require_relative "../mixin/shell_out"
20
20
  require "rexml/document" unless defined?(REXML::Document)
21
- require "iso8601" if Chef::Platform.windows?
21
+ require "iso8601" if ChefUtils.windows?
22
22
  require_relative "../mixin/powershell_out"
23
23
  require_relative "../provider"
24
24
  require_relative "../util/path_helper"
25
- require "win32/taskscheduler" if Chef::Platform.windows?
25
+ require "win32/taskscheduler" if ChefUtils.windows?
26
26
 
27
27
  class Chef
28
28
  class Provider
@@ -30,7 +30,7 @@ class Chef
30
30
  include Chef::Mixin::ShellOut
31
31
  include Chef::Mixin::PowershellOut
32
32
 
33
- if Chef::Platform.windows?
33
+ if ChefUtils.windows?
34
34
  include Win32
35
35
 
36
36
  provides :windows_task
@@ -59,6 +59,7 @@ class Chef
59
59
  extend Chef::Mixin::Provides
60
60
 
61
61
  include Chef::DSL::Universal
62
+ extend Chef::DSL::Universal
62
63
 
63
64
  # Bring in `property` and `property_type`
64
65
  include Chef::Mixin::Properties
@@ -22,6 +22,8 @@ require_relative "../provider/script"
22
22
  class Chef
23
23
  class Resource
24
24
  class Bash < Chef::Resource::Script
25
+ unified_mode true
26
+
25
27
  description "Use the bash resource to execute scripts using the Bash interpreter. This resource may also use any of the actions and properties that are available to the execute resource. Commands that are executed with this resource are (by their nature) not idempotent, as they are typically unique to the environment in which they are run. Use not_if and only_if to guard this resource for idempotence."
26
28
 
27
29
  def initialize(name, run_context = nil)
@@ -21,6 +21,8 @@ require_relative "windows_script"
21
21
  class Chef
22
22
  class Resource
23
23
  class Batch < Chef::Resource::WindowsScript
24
+ unified_mode true
25
+
24
26
  provides :batch
25
27
 
26
28
  description "Use the batch resource to execute a batch script using the cmd.exe interpreter on Windows. The batch resource creates and executes a temporary file (similar to how the script resource behaves), rather than running the command inline. Commands that are executed with this resource are (by their nature) not idempotent, as they are typically unique to the environment in which they are run. Use not_if and only_if to guard this resource for idempotence."
@@ -22,10 +22,12 @@ require_relative "../dist"
22
22
  class Chef
23
23
  class Resource
24
24
  class Breakpoint < Chef::Resource
25
+ unified_mode true
26
+
25
27
  provides :breakpoint, target_mode: true
26
28
  resource_name :breakpoint
27
29
 
28
- description "Use the breakpoint resource to add breakpoints to recipes. Run the #{Chef::Dist::SHELL} in #{Chef::Dist::CLIENT} mode, and then use those breakpoints to debug recipes. Breakpoints are ignored by the #{Chef::Dist::CLIENT} during an actual #{Chef::Dist::CLIENT} run. That said, breakpoints are typically used to debug recipes only when running them in a non-production environment, after which they are removed from those recipes before the parent cookbook is uploaded to the Chef server."
30
+ description "Use the breakpoint resource to add breakpoints to recipes. Run the #{Chef::Dist::SHELL} in #{Chef::Dist::PRODUCT} mode, and then use those breakpoints to debug recipes. Breakpoints are ignored by the #{Chef::Dist::CLIENT} during an actual #{Chef::Dist::CLIENT} run. That said, breakpoints are typically used to debug recipes only when running them in a non-production environment, after which they are removed from those recipes before the parent cookbook is uploaded to the Chef server."
29
31
  introduced "12.0"
30
32
 
31
33
  default_action :break
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright:: 2008-2019, Chef Software, Inc.
2
+ # Copyright:: 2008-2019, Chef Software Inc.
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ class Chef
22
22
  resource_name :build_essential
23
23
  provides(:build_essential) { true }
24
24
 
25
- description "Use the build_essential resource to install packages required for compiling C software from source."
25
+ description "Use the build_essential resource to install the packages required for compiling C software from source."
26
26
  introduced "14.0"
27
27
  examples <<~DOC
28
28
  Install compilation packages
@@ -52,7 +52,7 @@ class Chef
52
52
  case node["platform_family"]
53
53
  when "debian"
54
54
  package %w{ autoconf binutils-doc bison build-essential flex gettext ncurses-dev }
55
- when "amazon", "fedora", "rhel"
55
+ when fedora_derived?
56
56
  package %w{ autoconf bison flex gcc gcc-c++ gettext kernel-devel make m4 ncurses-devel patch }
57
57
 
58
58
  # Ensure GCC 4 is available on older pre-6 EL
@@ -0,0 +1,70 @@
1
+ #
2
+ # Copyright:: 2019, Chef Software Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require_relative "../resource"
18
+ require_relative "../dist"
19
+
20
+ class Chef
21
+ class Resource
22
+ class ChefSleep < Chef::Resource
23
+ resource_name :chef_sleep
24
+ provides :chef_sleep
25
+
26
+ unified_mode true
27
+
28
+ description "Use the chef_sleep resource to set the number of seconds to sleep during a #{Chef::Dist::PRODUCT} run. Only use this resource when a command or service exits successfully but is not ready for the next step of the recipe."
29
+ introduced "15.5"
30
+ examples <<~DOC
31
+ Sleep for 10 seconds
32
+ ```ruby
33
+ chef_sleep '10'
34
+ ```
35
+
36
+ Sleep for 10 seconds with a descriptive resource name for logging
37
+ ```ruby
38
+ chef_sleep 'wait for the service to start' do
39
+ seconds 10
40
+ end
41
+ ````
42
+
43
+ Use a notification from another resource to sleep only when necessary
44
+ ```ruby
45
+ service 'Service that is slow to start and reports as started' do
46
+ service_name 'my_database'
47
+ action :start
48
+ notifies :sleep, chef_sleep['wait for service start']
49
+ end
50
+
51
+ chef_sleep 'wait for service start' do
52
+ seconds 30
53
+ action :nothing
54
+ end
55
+ ```
56
+ DOC
57
+
58
+ property :seconds, [String, Integer],
59
+ description: "The number of seconds to sleep.",
60
+ coerce: proc { |s| Integer(s) },
61
+ name_property: true
62
+
63
+ action :sleep do
64
+ converge_by("sleep #{new_resource.seconds} seconds") do
65
+ sleep(new_resource.seconds)
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -27,10 +27,11 @@ class Chef
27
27
  class Resource
28
28
  class CookbookFile < Chef::Resource::File
29
29
  include Chef::Mixin::Securable
30
+ unified_mode true
30
31
 
31
32
  resource_name :cookbook_file
32
33
 
33
- description "Use the cookbook_file resource to transfer files from a sub-directory of COOKBOOK_NAME/files/ to a specified path located on a host that is running the #{Chef::Dist::CLIENT}. The file is selected according to file specificity, which allows different source files to be used based on the hostname, host platform (operating system, distro, or as appropriate), or platform version. Files that are located in the COOKBOOK_NAME/files/default sub-directory may be used on any platform.\n\nDuring a #{Chef::Dist::CLIENT} run, the checksum for each local file is calculated and then compared against the checksum for the same file as it currently exists in the cookbook on the #{Chef::Dist::SERVER_PRODUCT}. A file is not transferred when the checksums match. Only files that require an update are transferred from the #{Chef::Dist::SERVER_PRODUCT} to a node."
34
+ description "Use the cookbook_file resource to transfer files from a sub-directory of COOKBOOK_NAME/files/ to a specified path located on a host that is running the #{Chef::Dist::PRODUCT}. The file is selected according to file specificity, which allows different source files to be used based on the hostname, host platform (operating system, distro, or as appropriate), or platform version. Files that are located in the COOKBOOK_NAME/files/default sub-directory may be used on any platform.\n\nDuring a #{Chef::Dist::PRODUCT} run, the checksum for each local file is calculated and then compared against the checksum for the same file as it currently exists in the cookbook on the #{Chef::Dist::SERVER_PRODUCT}. A file is not transferred when the checksums match. Only files that require an update are transferred from the #{Chef::Dist::SERVER_PRODUCT} to a node."
34
35
 
35
36
  property :source, [ String, Array ],
36
37
  description: "The name of the file in COOKBOOK_NAME/files/default or the path to a file located in COOKBOOK_NAME/files. The path must include the file name and its extension. This can be used to distribute specific files depending upon the platform used.",
@@ -22,6 +22,8 @@ require_relative "../provider/script"
22
22
  class Chef
23
23
  class Resource
24
24
  class Csh < Chef::Resource::Script
25
+ unified_mode true
26
+
25
27
  description "Use the csh resource to execute scripts using the csh interpreter."\
26
28
  " This resource may also use any of the actions and properties that are"\
27
29
  " available to the execute resource. Commands that are executed with this"\
@@ -24,6 +24,8 @@ require_relative "../mixin/securable"
24
24
  class Chef
25
25
  class Resource
26
26
  class Directory < Chef::Resource
27
+ unified_mode true
28
+
27
29
  resource_name :directory
28
30
 
29
31
  description "Use the directory resource to manage a directory, which is a hierarchy"\
@@ -23,7 +23,7 @@ class Chef
23
23
  resource_name :dmg_package
24
24
  provides(:dmg_package) { true }
25
25
 
26
- description "Use the dmg_package resource to install a dmg 'package'. The resource will retrieve the dmg file from a remote URL, mount it using OS X's hdidutil, copy the application (.app directory) to the specified destination (/Applications), and detach the image using hdiutil. The dmg file will be stored in the Chef::Config[:file_cache_path]."
26
+ description "Use the dmg_package resource to install a package from a .dmg file. The resource will retrieve the dmg file from a remote URL, mount it using OS X's hdidutil, copy the application (.app directory) to the specified destination (/Applications), and detach the image using hdiutil. The dmg file will be stored in the Chef::Config[:file_cache_path]."
27
27
  introduced "14.0"
28
28
  examples <<~DOC
29
29
  Install Google Chrome via the DMG package
@@ -41,7 +41,7 @@ class Chef
41
41
 
42
42
  provides :dnf_package
43
43
 
44
- description "Use the dnf_package resource to install, upgrade, and remove packages with DNF for Fedora platforms. The dnf_package resource is able to resolve provides data for packages much like DNF can do when it is run from the command line. This allows a variety of options for installing packages, like minimum versions, virtual provides and library names."
44
+ description "Use the dnf_package resource to install, upgrade, and remove packages with DNF for Fedora and RHEL 8+. The dnf_package resource is able to resolve provides data for packages much like DNF can do when it is run from the command line. This allows a variety of options for installing packages, like minimum versions, virtual provides and library names."
45
45
  introduced "12.18"
46
46
 
47
47
  allowed_actions :install, :upgrade, :remove, :purge, :reconfig, :lock, :unlock, :flush_cache
@@ -23,6 +23,8 @@ require_relative "../dist"
23
23
  class Chef
24
24
  class Resource
25
25
  class Execute < Chef::Resource
26
+ unified_mode true
27
+
26
28
  resource_name :execute
27
29
  provides :execute, target_mode: true
28
30
 
@@ -28,10 +28,11 @@ class Chef
28
28
  class Resource
29
29
  class File < Chef::Resource
30
30
  include Chef::Mixin::Securable
31
+ unified_mode true
31
32
 
32
33
  description "Use the file resource to manage files directly on a node."
33
34
 
34
- if Platform.windows?
35
+ if ChefUtils.windows?
35
36
  # Use Windows rights instead of standard *nix permissions
36
37
  state_attrs :checksum, :rights, :deny_rights
37
38
  else
@@ -21,6 +21,8 @@ require_relative "scm"
21
21
  class Chef
22
22
  class Resource
23
23
  class Git < Chef::Resource::Scm
24
+ unified_mode true
25
+
24
26
  description "Use the git resource to manage source control resources that exist in a git repository. git version 1.6.5 (or higher) is required to use all of the functionality in the git resource."
25
27
 
26
28
  property :additional_remotes, Hash,
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
3
  # Author:: Tyler Cloke (<tyler@chef.io>)
4
- # Copyright:: Copyright 2008-2018, Chef Software Inc.
4
+ # Copyright:: Copyright 2008-2019, 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");
@@ -32,7 +32,7 @@ class Chef
32
32
  introduced "12.0"
33
33
 
34
34
  property :homebrew_user, [ String, Integer ],
35
- description: "The name of the Homebrew owner to be used by the #{Chef::Dist::CLIENT} when executing a command."
35
+ description: "The name of the Homebrew owner to be used by #{Chef::Dist::PRODUCT} when executing a command."
36
36
 
37
37
  end
38
38
  end
@@ -22,6 +22,8 @@ require_relative "../resource"
22
22
  class Chef
23
23
  class Resource
24
24
  class HttpRequest < Chef::Resource
25
+ unified_mode true
26
+
25
27
  resource_name :http_request
26
28
  provides :http_request
27
29
 
@@ -26,6 +26,8 @@ class Chef
26
26
  # device 'eth1'
27
27
  # end
28
28
  class Ifconfig < Chef::Resource
29
+ unified_mode true
30
+
29
31
  resource_name :ifconfig
30
32
 
31
33
  description "Use the ifconfig resource to manage interfaces on Unix and Linux systems."
@@ -47,7 +49,7 @@ class Chef
47
49
 
48
50
  property :family, String, default: "inet",
49
51
  introduced: "14.0",
50
- description: "Networking family option for Debian-based systems. For example: inet or inet6."
52
+ description: "Networking family option for Debian-based systems; for example: inet or inet6."
51
53
 
52
54
  property :inet_addr, String,
53
55
  description: "The Internet host address for the network interface."
@@ -21,6 +21,8 @@ require_relative "script"
21
21
  class Chef
22
22
  class Resource
23
23
  class Ksh < Chef::Resource::Script
24
+ unified_mode true
25
+
24
26
  description "Use the ksh resource to execute scripts using the Korn shell (ksh)"\
25
27
  " interpreter. This resource may also use any of the actions and properties"\
26
28
  " that are available to the execute resource. Commands that are executed"\
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
3
  # Author:: Tyler Cloke (<tyler@chef.io>)
4
- # Copyright:: Copyright 2008-2018, Chef Software Inc.
4
+ # Copyright:: Copyright 2008-2019, 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");
@@ -24,6 +24,8 @@ class Chef
24
24
  class Resource
25
25
  class Link < Chef::Resource
26
26
  include Chef::Mixin::Securable
27
+ unified_mode true
28
+
27
29
  resource_name :link
28
30
  provides :link
29
31
 
@@ -77,7 +79,7 @@ class Chef
77
79
  # On certain versions of windows links are not supported. Make
78
80
  # sure we are not on such a platform.
79
81
  def verify_links_supported!
80
- if Chef::Platform.windows?
82
+ if ChefUtils.windows?
81
83
  require_relative "../win32/file"
82
84
  begin
83
85
  Chef::ReservedNames::Win32::File.verify_links_supported!
@@ -11,7 +11,7 @@
11
11
  # Unless required by applicable law or agreed to in writing, software
12
12
  # distributed under the License is distributed on an "AS IS" BASIS,
13
13
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- # See the License for the specific slanguage governing permissions and
14
+ # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
  #
17
17
 
@@ -29,6 +29,8 @@ class Chef
29
29
  # level :debug
30
30
  # end
31
31
  class Log < Chef::Resource
32
+ unified_mode true
33
+
32
34
  resource_name :log
33
35
  provides :log, target_mode: true
34
36
 
@@ -23,6 +23,8 @@ require_relative "../dist"
23
23
  class Chef
24
24
  class Resource
25
25
  class Ohai < Chef::Resource
26
+ unified_mode true
27
+
26
28
  resource_name :ohai
27
29
  provides :ohai
28
30
 
@@ -22,6 +22,8 @@ require_relative "../provider/script"
22
22
  class Chef
23
23
  class Resource
24
24
  class Perl < Chef::Resource::Script
25
+ unified_mode true
26
+
25
27
  def initialize(name, run_context = nil)
26
28
  super
27
29
  @interpreter = "perl"
@@ -21,6 +21,8 @@ require_relative "../provider/script"
21
21
  class Chef
22
22
  class Resource
23
23
  class Python < Chef::Resource::Script
24
+ unified_mode true
25
+
24
26
  def initialize(name, run_context = nil)
25
27
  super
26
28
  @interpreter = "python"
@@ -22,6 +22,8 @@ require_relative "../dist"
22
22
  class Chef
23
23
  class Resource
24
24
  class Reboot < Chef::Resource
25
+ unified_mode true
26
+
25
27
  resource_name :reboot
26
28
 
27
29
  description "Use the reboot resource to reboot a node, a necessary step with some"\
@@ -22,6 +22,8 @@ require_relative "../digester"
22
22
  class Chef
23
23
  class Resource
24
24
  class RegistryKey < Chef::Resource
25
+ unified_mode true
26
+
25
27
  resource_name :registry_key
26
28
  provides(:registry_key) { true }
27
29
 
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
3
  # Author:: Tyler Cloke (<tyler@chef.io>)
4
- # Copyright:: Copyright 2008-2018, Chef Software Inc.
4
+ # Copyright:: Copyright 2008-2019, 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");
@@ -25,6 +25,7 @@ class Chef
25
25
  class Resource
26
26
  class RemoteDirectory < Chef::Resource::Directory
27
27
  include Chef::Mixin::Securable
28
+ unified_mode true
28
29
 
29
30
  description "Use the remote_directory resource to incrementally transfer a directory from a cookbook to a node. The director that is copied from the cookbook should be located under COOKBOOK_NAME/files/default/REMOTE_DIRECTORY. The remote_directory resource will obey file specificity."
30
31
 
@@ -36,7 +37,7 @@ class Chef
36
37
  @delete = false
37
38
  end
38
39
 
39
- if Chef::Platform.windows?
40
+ if ChefUtils.windows?
40
41
  # create a second instance of the 'rights' attribute (property)
41
42
  rights_attribute(:files_rights)
42
43
  end