chef 16.3.45-universal-mingw32 → 16.4.35-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. checksums.yaml +4 -4
  2. data/chef-universal-mingw32.gemspec +0 -1
  3. data/lib/chef/action_collection.rb +4 -0
  4. data/lib/chef/api_client/registration.rb +2 -2
  5. data/lib/chef/application.rb +1 -1
  6. data/lib/chef/application/apply.rb +5 -5
  7. data/lib/chef/application/windows_service.rb +27 -27
  8. data/lib/chef/chef_class.rb +0 -1
  9. data/lib/chef/chef_fs/chef_fs_data_store.rb +54 -54
  10. data/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb +10 -10
  11. data/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb +8 -8
  12. data/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb +8 -8
  13. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +2 -2
  14. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +1 -1
  15. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +18 -18
  16. data/lib/chef/chef_fs/file_system/repository/directory.rb +1 -1
  17. data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +1 -1
  18. data/lib/chef/client.rb +11 -11
  19. data/lib/chef/data_collector/run_end_message.rb +11 -1
  20. data/lib/chef/dsl/platform_introspection.rb +8 -8
  21. data/lib/chef/encrypted_data_bag_item/decryptor.rb +1 -1
  22. data/lib/chef/environment.rb +2 -2
  23. data/lib/chef/exceptions.rb +1 -1
  24. data/lib/chef/file_content_management/tempfile.rb +9 -9
  25. data/lib/chef/http.rb +2 -1
  26. data/lib/chef/json_compat.rb +1 -1
  27. data/lib/chef/knife/bootstrap.rb +2 -2
  28. data/lib/chef/knife/cookbook_download.rb +1 -1
  29. data/lib/chef/knife/cookbook_metadata.rb +1 -1
  30. data/lib/chef/knife/cookbook_upload.rb +23 -23
  31. data/lib/chef/knife/core/generic_presenter.rb +1 -1
  32. data/lib/chef/knife/core/hashed_command_loader.rb +2 -2
  33. data/lib/chef/knife/core/windows_bootstrap_context.rb +32 -24
  34. data/lib/chef/knife/delete.rb +15 -15
  35. data/lib/chef/knife/exec.rb +2 -2
  36. data/lib/chef/knife/ssh.rb +6 -6
  37. data/lib/chef/knife/xargs.rb +19 -19
  38. data/lib/chef/knife/yaml_convert.rb +1 -1
  39. data/lib/chef/mixin/checksum.rb +0 -1
  40. data/lib/chef/mixin/deep_merge.rb +35 -6
  41. data/lib/chef/mixin/openssl_helper.rb +3 -1
  42. data/lib/chef/mixin/shell_out.rb +1 -1
  43. data/lib/chef/mixin/which.rb +1 -1
  44. data/lib/chef/monkey_patches/webrick-utils.rb +10 -10
  45. data/lib/chef/node/attribute.rb +2 -4
  46. data/lib/chef/platform/service_helpers.rb +1 -1
  47. data/lib/chef/property.rb +1 -1
  48. data/lib/chef/provider/cron/unix.rb +0 -2
  49. data/lib/chef/provider/git.rb +5 -5
  50. data/lib/chef/provider/group.rb +0 -2
  51. data/lib/chef/provider/group/suse.rb +5 -5
  52. data/lib/chef/provider/ifconfig.rb +1 -4
  53. data/lib/chef/provider/mount.rb +0 -2
  54. data/lib/chef/provider/package.rb +0 -2
  55. data/lib/chef/provider/package/rubygems.rb +1 -1
  56. data/lib/chef/provider/package/snap.rb +1 -1
  57. data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +9 -9
  58. data/lib/chef/provider/powershell_script.rb +21 -5
  59. data/lib/chef/provider/route.rb +1 -1
  60. data/lib/chef/provider/service/arch.rb +1 -1
  61. data/lib/chef/provider/service/debian.rb +1 -1
  62. data/lib/chef/provider/service/gentoo.rb +2 -2
  63. data/lib/chef/provider/service/macosx.rb +2 -2
  64. data/lib/chef/provider/service/openbsd.rb +1 -4
  65. data/lib/chef/provider/service/redhat.rb +2 -2
  66. data/lib/chef/provider/service/upstart.rb +1 -1
  67. data/lib/chef/provider/service/windows.rb +10 -10
  68. data/lib/chef/provider/systemd_unit.rb +0 -2
  69. data/lib/chef/provider/template/content.rb +1 -0
  70. data/lib/chef/provider/user/dscl.rb +2 -2
  71. data/lib/chef/provider/user/mac.rb +9 -9
  72. data/lib/chef/provider/windows_task.rb +0 -3
  73. data/lib/chef/provider/zypper_repository.rb +0 -1
  74. data/lib/chef/providers.rb +0 -1
  75. data/lib/chef/recipe.rb +1 -1
  76. data/lib/chef/resource.rb +6 -10
  77. data/lib/chef/resource/apt_repository.rb +1 -10
  78. data/lib/chef/resource/chef_client_systemd_timer.rb +2 -2
  79. data/lib/chef/resource/chef_vault_secret.rb +13 -13
  80. data/lib/chef/resource/execute.rb +2 -3
  81. data/lib/chef/resource/homebrew_update.rb +2 -2
  82. data/lib/chef/resource/openssl_dhparam.rb +2 -0
  83. data/lib/chef/resource/openssl_ec_private_key.rb +2 -0
  84. data/lib/chef/resource/openssl_ec_public_key.rb +2 -0
  85. data/lib/chef/resource/openssl_rsa_private_key.rb +2 -0
  86. data/lib/chef/resource/openssl_rsa_public_key.rb +2 -0
  87. data/lib/chef/resource/openssl_x509_certificate.rb +24 -21
  88. data/lib/chef/resource/openssl_x509_crl.rb +2 -0
  89. data/lib/chef/resource/openssl_x509_request.rb +23 -20
  90. data/lib/chef/resource/osx_profile.rb +227 -5
  91. data/lib/chef/resource/powershell_package_source.rb +1 -1
  92. data/lib/chef/resource/powershell_script.rb +24 -30
  93. data/lib/chef/resource/sudo.rb +1 -1
  94. data/lib/chef/resource/sysctl.rb +5 -5
  95. data/lib/chef/resource/windows_ad_join.rb +2 -0
  96. data/lib/chef/resource/windows_audit_policy.rb +3 -0
  97. data/lib/chef/resource/windows_auto_run.rb +2 -0
  98. data/lib/chef/resource/windows_certificate.rb +2 -0
  99. data/lib/chef/resource/windows_dfs_folder.rb +2 -0
  100. data/lib/chef/resource/windows_dfs_namespace.rb +2 -0
  101. data/lib/chef/resource/windows_dfs_server.rb +2 -0
  102. data/lib/chef/resource/windows_dns_record.rb +10 -7
  103. data/lib/chef/resource/windows_dns_zone.rb +12 -7
  104. data/lib/chef/resource/windows_feature.rb +2 -0
  105. data/lib/chef/resource/windows_feature_dism.rb +10 -0
  106. data/lib/chef/resource/windows_feature_powershell.rb +14 -2
  107. data/lib/chef/resource/windows_firewall_profile.rb +4 -2
  108. data/lib/chef/resource/windows_firewall_rule.rb +5 -3
  109. data/lib/chef/resource/windows_font.rb +3 -1
  110. data/lib/chef/resource/windows_pagefile.rb +4 -0
  111. data/lib/chef/resource/windows_printer.rb +17 -18
  112. data/lib/chef/resource/windows_printer_port.rb +14 -13
  113. data/lib/chef/resource/windows_security_policy.rb +2 -0
  114. data/lib/chef/resource/windows_share.rb +5 -3
  115. data/lib/chef/resource/windows_shortcut.rb +2 -0
  116. data/lib/chef/resource/windows_uac.rb +2 -0
  117. data/lib/chef/resource/windows_user_privilege.rb +2 -0
  118. data/lib/chef/resource/windows_workgroup.rb +2 -3
  119. data/lib/chef/resource_collection/stepable_iterator.rb +1 -2
  120. data/lib/chef/role.rb +2 -2
  121. data/lib/chef/run_context/cookbook_compiler.rb +20 -20
  122. data/lib/chef/run_status.rb +2 -6
  123. data/lib/chef/shell.rb +1 -1
  124. data/lib/chef/util/backup.rb +1 -1
  125. data/lib/chef/util/diff.rb +11 -11
  126. data/lib/chef/util/powershell/cmdlet.rb +1 -1
  127. data/lib/chef/version.rb +1 -1
  128. data/lib/chef/win32/file.rb +2 -2
  129. data/lib/chef/win32/file/version_info.rb +5 -5
  130. data/spec/data/ssl/chef-rspec.cert +15 -15
  131. data/spec/functional/resource/aixinit_service_spec.rb +7 -7
  132. data/spec/functional/resource/bff_spec.rb +2 -2
  133. data/spec/functional/resource/cookbook_file_spec.rb +1 -1
  134. data/spec/functional/resource/dsc_resource_spec.rb +1 -1
  135. data/spec/functional/resource/dsc_script_spec.rb +0 -1
  136. data/spec/functional/resource/group_spec.rb +6 -6
  137. data/spec/functional/resource/insserv_spec.rb +4 -4
  138. data/spec/functional/resource/link_spec.rb +20 -20
  139. data/spec/functional/resource/powershell_script_spec.rb +4 -4
  140. data/spec/functional/resource/rpm_spec.rb +2 -2
  141. data/spec/functional/resource/windows_certificate_spec.rb +3 -3
  142. data/spec/functional/resource/windows_font_spec.rb +49 -0
  143. data/spec/functional/resource/windows_security_policy_spec.rb +0 -3
  144. data/spec/functional/run_lock_spec.rb +24 -24
  145. data/spec/functional/win32/registry_spec.rb +8 -8
  146. data/spec/functional/win32/service_manager_spec.rb +1 -1
  147. data/spec/integration/knife/common_options_spec.rb +12 -12
  148. data/spec/integration/knife/config_get_profile_spec.rb +69 -68
  149. data/spec/integration/knife/config_get_spec.rb +126 -125
  150. data/spec/integration/knife/config_list_profiles_spec.rb +181 -180
  151. data/spec/integration/knife/config_use_profile_spec.rb +110 -109
  152. data/spec/integration/knife/diff_spec.rb +3 -1
  153. data/spec/integration/knife/download_spec.rb +3 -1
  154. data/spec/integration/knife/serve_spec.rb +5 -5
  155. data/spec/integration/knife/upload_spec.rb +3 -1
  156. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +1 -1
  157. data/spec/spec_helper.rb +6 -6
  158. data/spec/support/platform_helpers.rb +9 -9
  159. data/spec/support/platforms/win32/spec_service.rb +1 -1
  160. data/spec/support/shared/functional/directory_resource.rb +1 -1
  161. data/spec/support/shared/functional/execute_resource.rb +1 -1
  162. data/spec/support/shared/functional/file_resource.rb +20 -20
  163. data/spec/support/shared/functional/win32_service.rb +1 -1
  164. data/spec/support/shared/functional/windows_script.rb +3 -3
  165. data/spec/support/shared/integration/integration_helper.rb +22 -52
  166. data/spec/support/shared/unit/script_resource.rb +6 -20
  167. data/spec/support/shared/unit/windows_script_resource.rb +15 -28
  168. data/spec/unit/data_collector_spec.rb +22 -0
  169. data/spec/unit/environment_spec.rb +7 -7
  170. data/spec/unit/knife/bootstrap_spec.rb +14 -14
  171. data/spec/unit/knife/cookbook_download_spec.rb +4 -4
  172. data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +1 -1
  173. data/spec/unit/knife/core/hashed_command_loader_spec.rb +3 -3
  174. data/spec/unit/knife/core/windows_bootstrap_context_spec.rb +21 -12
  175. data/spec/unit/knife/supermarket_share_spec.rb +1 -1
  176. data/spec/unit/mixin/template_spec.rb +30 -30
  177. data/spec/unit/mixin/windows_architecture_helper_spec.rb +4 -4
  178. data/spec/unit/node/immutable_collections_spec.rb +6 -2
  179. data/spec/unit/node_spec.rb +5 -5
  180. data/spec/unit/provider/powershell_script_spec.rb +11 -4
  181. data/spec/unit/provider/remote_directory_spec.rb +9 -9
  182. data/spec/unit/provider/service/arch_service_spec.rb +3 -2
  183. data/spec/unit/provider/service/debian_service_spec.rb +1 -1
  184. data/spec/unit/provider/service/gentoo_service_spec.rb +7 -7
  185. data/spec/unit/provider/service/macosx_spec.rb +3 -3
  186. data/spec/unit/provider/service/redhat_spec.rb +2 -2
  187. data/spec/unit/provider/service/upstart_service_spec.rb +3 -3
  188. data/spec/unit/provider_resolver_spec.rb +6 -6
  189. data/spec/unit/resource/batch_spec.rb +6 -6
  190. data/spec/unit/resource/execute_spec.rb +113 -118
  191. data/spec/unit/resource/osx_profile_spec.rb +233 -0
  192. data/spec/unit/resource/powershell_script_spec.rb +11 -29
  193. data/spec/unit/resource/script_spec.rb +6 -1
  194. data/spec/unit/resource/windows_feature_powershell_spec.rb +30 -4
  195. data/spec/unit/role_spec.rb +11 -11
  196. data/tasks/rspec.rb +1 -1
  197. metadata +7 -22
  198. data/lib/chef/provider/osx_profile.rb +0 -255
  199. data/spec/unit/provider/osx_profile_spec.rb +0 -255
@@ -76,7 +76,7 @@ class Chef::Knife::Exec < Chef::Knife
76
76
  def find_script(x)
77
77
  # Try to find a script. First try expanding the path given.
78
78
  script = File.expand_path(x)
79
- return script if File.exists?(script)
79
+ return script if File.exist?(script)
80
80
 
81
81
  # Failing that, try searching the script path. If we can't find
82
82
  # anything, fail gracefully.
@@ -86,7 +86,7 @@ class Chef::Knife::Exec < Chef::Knife
86
86
  path = File.expand_path(path)
87
87
  test = File.join(path, x)
88
88
  Chef::Log.trace("Testing: #{test}")
89
- if File.exists?(test)
89
+ if File.exist?(test)
90
90
  script = test
91
91
  Chef::Log.trace("Found: #{test}")
92
92
  return script
@@ -525,12 +525,12 @@ class Chef
525
525
  def cssh
526
526
  cssh_cmd = nil
527
527
  %w{csshX cssh}.each do |cmd|
528
- begin
529
- # Unix and Mac only
530
- cssh_cmd = shell_out!("which #{cmd}").stdout.strip
531
- break
532
- rescue Mixlib::ShellOut::ShellCommandFailed
533
- end
528
+
529
+ # Unix and Mac only
530
+ cssh_cmd = shell_out!("which #{cmd}").stdout.strip
531
+ break
532
+ rescue Mixlib::ShellOut::ShellCommandFailed
533
+
534
534
  end
535
535
  raise Chef::Exceptions::Exec, "no command found for cssh" unless cssh_cmd
536
536
 
@@ -204,25 +204,25 @@ class Chef
204
204
  error = false
205
205
  # Create the temporary files
206
206
  tempfiles.each_pair do |tempfile, file|
207
- begin
208
- value = file[:file].read
209
- file[:value] = value
210
- tempfile.open
211
- tempfile.write(value)
212
- tempfile.close
213
- rescue Chef::ChefFS::FileSystem::OperationNotAllowedError => e
214
- ui.error "#{format_path(e.entry)}: #{e.reason}."
215
- error = true
216
- tempfile.close!
217
- tempfiles.delete(tempfile)
218
- next
219
- rescue Chef::ChefFS::FileSystem::NotFoundError => e
220
- ui.error "#{format_path(e.entry)}: No such file or directory"
221
- error = true
222
- tempfile.close!
223
- tempfiles.delete(tempfile)
224
- next
225
- end
207
+
208
+ value = file[:file].read
209
+ file[:value] = value
210
+ tempfile.open
211
+ tempfile.write(value)
212
+ tempfile.close
213
+ rescue Chef::ChefFS::FileSystem::OperationNotAllowedError => e
214
+ ui.error "#{format_path(e.entry)}: #{e.reason}."
215
+ error = true
216
+ tempfile.close!
217
+ tempfiles.delete(tempfile)
218
+ next
219
+ rescue Chef::ChefFS::FileSystem::NotFoundError => e
220
+ ui.error "#{format_path(e.entry)}: No such file or directory"
221
+ error = true
222
+ tempfile.close!
223
+ tempfiles.delete(tempfile)
224
+ next
225
+
226
226
  end
227
227
 
228
228
  return error if error && tempfiles.size == 0
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require "yaml"
19
+ require "yaml" unless defined?(YAML)
20
20
  require_relative "../knife"
21
21
  class Chef::Knife::YamlConvert < Chef::Knife
22
22
 
@@ -31,7 +31,6 @@ class Chef
31
31
 
32
32
  checksum.slice(0, 6)
33
33
  end
34
-
35
34
  end
36
35
  end
37
36
  end
@@ -19,16 +19,33 @@
19
19
 
20
20
  class Chef
21
21
  module Mixin
22
- # == Chef::Mixin::DeepMerge
23
22
  # Implements a deep merging algorithm for nested data structures.
24
- # ==== Notice:
25
- # This code was originally imported from deep_merge by Steve Midgley.
26
- # deep_merge is available under the MIT license from
27
- # http://trac.misuse.org/science/wiki/DeepMerge
23
+ #
24
+ # This code was originally imported from deep_merge by Steve Midgley.
25
+ # deep_merge is available under the MIT license from
26
+ # http://trac.misuse.org/science/wiki/DeepMerge
27
+ #
28
+ # Note that this is not considered a public interface. It is technically
29
+ # public and has been used and we cannot break the API, but continued
30
+ # external use is discouraged. We are unlikely to change the shape of
31
+ # the API and break anyone, but this code does not serve the purposes of
32
+ # cookbook authors and customers. It is intended only for the purposes
33
+ # of the internal use in the chef-client codebase. We do not accept
34
+ # pull requests to extend the functionality of this algorithm. Users
35
+ # who find this does nearly what they want, should copy and paste the
36
+ # algorithm and tune to their needs. We will not maintain any additional
37
+ # use cases.
38
+ #
39
+ # "It is what it is, and if it isn't what you want, you need to build
40
+ # that yourself"
41
+ #
42
+ # @api private
43
+ #
28
44
  module DeepMerge
29
45
 
30
46
  extend self
31
47
 
48
+ # @api private
32
49
  def merge(first, second)
33
50
  first = Mash.new(first) unless first.is_a?(Mash)
34
51
  second = Mash.new(second) unless second.is_a?(Mash)
@@ -38,20 +55,25 @@ class Chef
38
55
 
39
56
  class InvalidParameter < StandardError; end
40
57
 
41
- # Deep Merge core documentation.
42
58
  # deep_merge! method permits merging of arbitrary child elements. The two top level
43
59
  # elements must be hashes. These hashes can contain unlimited (to stack limit) levels
44
60
  # of child elements. These child elements to not have to be of the same types.
45
61
  # Where child elements are of the same type, deep_merge will attempt to merge them together.
46
62
  # Where child elements are not of the same type, deep_merge will skip or optionally overwrite
47
63
  # the destination element with the contents of the source element at that level.
64
+ #
48
65
  # So if you have two hashes like this:
66
+ #
49
67
  # source = {:x => [1,2,3], :y => 2}
50
68
  # dest = {:x => [4,5,'6'], :y => [7,8,9]}
51
69
  # dest.deep_merge!(source)
52
70
  # Results: {:x => [1,2,3,4,5,'6'], :y => 2}
71
+ #
53
72
  # By default, "deep_merge!" will overwrite any unmergeables and merge everything else.
54
73
  # To avoid this, use "deep_merge" (no bang/exclamation mark)
74
+ #
75
+ # @api private
76
+ #
55
77
  def deep_merge!(source, dest)
56
78
  # if dest doesn't exist, then simply copy source to it
57
79
  if dest.nil?
@@ -87,10 +109,12 @@ class Chef
87
109
  dest
88
110
  end # deep_merge!
89
111
 
112
+ # @api private
90
113
  def hash_only_merge(merge_onto, merge_with)
91
114
  hash_only_merge!(safe_dup(merge_onto), safe_dup(merge_with))
92
115
  end
93
116
 
117
+ # @api private
94
118
  def safe_dup(thing)
95
119
  thing.dup
96
120
  rescue TypeError
@@ -101,6 +125,9 @@ class Chef
101
125
  # `merge_onto` is the object that will "lose" in case of conflict.
102
126
  # `merge_with` is the object whose values will replace `merge_onto`s
103
127
  # values when there is a conflict.
128
+ #
129
+ # @api private
130
+ #
104
131
  def hash_only_merge!(merge_onto, merge_with)
105
132
  # If there are two Hashes, recursively merge.
106
133
  if merge_onto.is_a?(Hash) && merge_with.is_a?(Hash)
@@ -131,6 +158,8 @@ class Chef
131
158
  end
132
159
  end
133
160
 
161
+ # @api private
162
+ #
134
163
  def deep_merge(source, dest)
135
164
  deep_merge!(safe_dup(source), safe_dup(dest))
136
165
  end
@@ -412,7 +412,7 @@ class Chef
412
412
  # @param [string] cert_file path of the cert file or cert content
413
413
  # @param [integer] renew_before_expiry number of days before expiration
414
414
  # @return [true, false]
415
- def cert_need_renewall?(cert_file, renew_before_expiry)
415
+ def cert_need_renewal?(cert_file, renew_before_expiry)
416
416
  resp = true
417
417
  cert_content = ::File.exist?(cert_file) ? File.read(cert_file) : cert_file
418
418
  begin
@@ -428,6 +428,8 @@ class Chef
428
428
  resp
429
429
  end
430
430
 
431
+ alias_method :cert_need_renewall?, :cert_need_renewal?
432
+
431
433
  private
432
434
 
433
435
  def __openssl_config
@@ -16,7 +16,7 @@
16
16
  # limitations under the License.
17
17
 
18
18
  require "mixlib/shellout/helper" unless defined?(Mixlib::ShellOut::Helper)
19
- require "chef/mixin/chef_utils_wiring" unless defined?(Chef::Mixin::ChefUtilsWiring)
19
+ require_relative "chef_utils_wiring" unless defined?(Chef::Mixin::ChefUtilsWiring)
20
20
 
21
21
  class Chef
22
22
  module Mixin
@@ -17,7 +17,7 @@
17
17
 
18
18
  require "chef-utils/dsl/which" unless defined?(ChefUtils::DSL::Which)
19
19
  require "chef-utils/dsl/default_paths" unless defined?(ChefUtils::DSL::DefaultPaths)
20
- require "chef/mixin/chef_utils_wiring" unless defined?(Chef::Mixin::ChefUtilsWiring)
20
+ require_relative "chef_utils_wiring" unless defined?(Chef::Mixin::ChefUtilsWiring)
21
21
 
22
22
  class Chef
23
23
  module Mixin
@@ -33,16 +33,16 @@ module WEBrick
33
33
  last_error = nil
34
34
  sockets = []
35
35
  res.each do |ai|
36
- begin
37
- logger.debug("TCPServer.new(#{ai[3]}, #{port})") if logger
38
- sock = TCPServer.new(ai[3], port)
39
- port = sock.addr[1] if port == 0
40
- Utils.set_close_on_exec(sock)
41
- sockets << sock
42
- rescue => ex
43
- logger.warn("TCPServer Error: #{ex}") if logger
44
- last_error = ex
45
- end
36
+
37
+ logger.debug("TCPServer.new(#{ai[3]}, #{port})") if logger
38
+ sock = TCPServer.new(ai[3], port)
39
+ port = sock.addr[1] if port == 0
40
+ Utils.set_close_on_exec(sock)
41
+ sockets << sock
42
+ rescue => ex
43
+ logger.warn("TCPServer Error: #{ex}") if logger
44
+ last_error = ex
45
+
46
46
  end
47
47
  raise last_error if sockets.empty?
48
48
 
@@ -563,11 +563,10 @@ class Chef
563
563
  # @param path [Array] Array of args to method chain to descend into the node object
564
564
  # @return [attr] Deep Merged values (may be VividMash, Hash, Array, etc) from the node object
565
565
  def merge_defaults(path)
566
- ret = DEFAULT_COMPONENTS.inject(NIL) do |merged, component_ivar|
566
+ DEFAULT_COMPONENTS.inject(NIL) do |merged, component_ivar|
567
567
  component_value = apply_path(instance_variable_get(component_ivar), path)
568
568
  deep_merge!(merged, component_value)
569
569
  end
570
- ret
571
570
  end
572
571
 
573
572
  # Deep merge the override attribute levels with array merging.
@@ -577,11 +576,10 @@ class Chef
577
576
  # @param path [Array] Array of args to method chain to descend into the node object
578
577
  # @return [attr] Deep Merged values (may be VividMash, Hash, Array, etc) from the node object
579
578
  def merge_overrides(path)
580
- ret = OVERRIDE_COMPONENTS.inject(NIL) do |merged, component_ivar|
579
+ OVERRIDE_COMPONENTS.inject(NIL) do |merged, component_ivar|
581
580
  component_value = apply_path(instance_variable_get(component_ivar), path)
582
581
  deep_merge!(merged, component_value)
583
582
  end
584
- ret
585
583
  end
586
584
 
587
585
  # needed for __path__
@@ -18,7 +18,7 @@
18
18
 
19
19
  require_relative "../chef_class"
20
20
  require "chef-utils" unless defined?(ChefUtils::CANARY)
21
- require "chef/mixin/chef_utils_wiring" unless defined?(Chef::Mixin::ChefUtilsWiring)
21
+ require_relative "../mixin/chef_utils_wiring" unless defined?(Chef::Mixin::ChefUtilsWiring)
22
22
 
23
23
  class Chef
24
24
  class Platform
@@ -706,7 +706,7 @@ class Chef
706
706
  # As of this writing, `name` is the only Chef::Resource property created with the
707
707
  # `property` definition, but this will allow for future properties to be extended
708
708
  # as needed.
709
- !Chef::Resource.properties.keys.include?(name)
709
+ !Chef::Resource.properties.key?(name)
710
710
  end
711
711
 
712
712
  def exec_in_resource(resource, proc, *args)
@@ -26,8 +26,6 @@ class Chef
26
26
  class Provider
27
27
  class Cron
28
28
  class Unix < Chef::Provider::Cron
29
- include Chef::Mixin::ShellOut
30
-
31
29
  provides :cron, os: "solaris2"
32
30
 
33
31
  private
@@ -44,11 +44,11 @@ class Chef
44
44
  unless new_resource.user.nil?
45
45
  requirements.assert(:all_actions) do |a|
46
46
  a.assertion do
47
- begin
48
- get_homedir(new_resource.user)
49
- rescue ArgumentError
50
- false
51
- end
47
+
48
+ get_homedir(new_resource.user)
49
+ rescue ArgumentError
50
+ false
51
+
52
52
  end
53
53
  a.whyrun("User #{new_resource.user} does not exist, this run will fail unless it has been previously created. Assuming it would have been created.")
54
54
  a.failure_message(Chef::Exceptions::User, "#{new_resource.user} required by resource #{new_resource.name} does not exist")
@@ -17,13 +17,11 @@
17
17
  #
18
18
 
19
19
  require_relative "../provider"
20
- require_relative "../mixin/shell_out"
21
20
  require "etc" unless defined?(Etc)
22
21
 
23
22
  class Chef
24
23
  class Provider
25
24
  class Group < Chef::Provider
26
- include Chef::Mixin::ShellOut
27
25
  attr_accessor :group_exists
28
26
  attr_accessor :change_desc
29
27
 
@@ -39,11 +39,11 @@ class Chef
39
39
 
40
40
  requirements.assert(:create, :manage, :modify) do |a|
41
41
  a.assertion do
42
- begin
43
- to_add(new_resource.members).all? { |member| Etc.getpwnam(member) }
44
- rescue
45
- false
46
- end
42
+
43
+ to_add(new_resource.members).all? { |member| Etc.getpwnam(member) }
44
+ rescue
45
+ false
46
+
47
47
  end
48
48
  a.failure_message Chef::Exceptions::Group, "Could not add users #{to_add(new_resource.members).join(", ")} to #{new_resource.group_name}: one of these users does not exist"
49
49
  a.whyrun "Could not find one of these users: #{to_add(new_resource.members).join(", ")}. Assuming it will be created by a prior step"
@@ -17,11 +17,10 @@
17
17
  #
18
18
 
19
19
  require_relative "../log"
20
- require_relative "../mixin/shell_out"
21
20
  require_relative "../provider"
22
21
  require_relative "../resource/file"
23
22
  require_relative "../exceptions"
24
- require "erb"
23
+ require "erb" unless defined?(Erb)
25
24
 
26
25
  class Chef
27
26
  class Provider
@@ -34,8 +33,6 @@ class Chef
34
33
  class Ifconfig < Chef::Provider
35
34
  provides :ifconfig
36
35
 
37
- include Chef::Mixin::ShellOut
38
-
39
36
  attr_accessor :config_template
40
37
  attr_accessor :config_path
41
38
 
@@ -18,13 +18,11 @@
18
18
  #
19
19
 
20
20
  require_relative "../log"
21
- require_relative "../mixin/shell_out"
22
21
  require_relative "../provider"
23
22
 
24
23
  class Chef
25
24
  class Provider
26
25
  class Mount < Chef::Provider
27
- include Chef::Mixin::ShellOut
28
26
 
29
27
  attr_accessor :unmount_retries
30
28
 
@@ -16,7 +16,6 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require_relative "../mixin/shell_out"
20
19
  require_relative "../mixin/subclass_directive"
21
20
  require_relative "../log"
22
21
  require_relative "../file_cache"
@@ -27,7 +26,6 @@ require "shellwords" unless defined?(Shellwords)
27
26
  class Chef
28
27
  class Provider
29
28
  class Package < Chef::Provider
30
- include Chef::Mixin::ShellOut
31
29
  extend Chef::Mixin::SubclassDirective
32
30
 
33
31
  # subclasses declare this if they want all their arguments as arrays of packages and names
@@ -188,7 +188,7 @@ class Chef
188
188
  # Use the API that 'gem install' calls which does not pull down the rubygems universe
189
189
  begin
190
190
  rs = dependency_installer.resolve_dependencies gem_dependency.name, gem_dependency.requirement
191
- rs.specs.select { |s| s.name == gem_dependency.name }.first
191
+ rs.specs.find { |s| s.name == gem_dependency.name }
192
192
  rescue Gem::UnsatisfiableDependencyError
193
193
  nil
194
194
  end
@@ -20,7 +20,7 @@ require_relative "../package"
20
20
  require_relative "../../resource/snap_package"
21
21
  require_relative "../../mixin/shell_out"
22
22
  require "socket" unless defined?(Socket)
23
- require "json"
23
+ require "json" unless defined?(JSON)
24
24
 
25
25
  class Chef
26
26
  class Provider
@@ -37,16 +37,16 @@ class Chef
37
37
  begin
38
38
  ::Win32::Registry.open(hkey[0], UNINSTALL_SUBKEY, desired) do |reg|
39
39
  reg.each_key do |key, _wtime|
40
- begin
41
- entry = reg.open(key, desired)
42
- display_name = read_registry_property(entry, "DisplayName")
43
- if display_name.to_s.rstrip == package_name
44
- quiet_uninstall_string = RegistryUninstallEntry.read_registry_property(entry, "QuietUninstallString")
45
- entries.push(quiet_uninstall_string_key?(quiet_uninstall_string, hkey, key, entry))
46
- end
47
- rescue ::Win32::Registry::Error => ex
48
- logger.trace("Registry error opening key '#{key}' on node #{desired}: #{ex}")
40
+
41
+ entry = reg.open(key, desired)
42
+ display_name = read_registry_property(entry, "DisplayName")
43
+ if display_name.to_s.rstrip == package_name
44
+ quiet_uninstall_string = RegistryUninstallEntry.read_registry_property(entry, "QuietUninstallString")
45
+ entries.push(quiet_uninstall_string_key?(quiet_uninstall_string, hkey, key, entry))
49
46
  end
47
+ rescue ::Win32::Registry::Error => ex
48
+ logger.trace("Registry error opening key '#{key}' on node #{desired}: #{ex}")
49
+
50
50
  end
51
51
  end
52
52
  rescue ::Win32::Registry::Error => ex