chef 15.10.12 → 15.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +10 -10
  3. data/README.md +3 -3
  4. data/Rakefile +1 -1
  5. data/chef-universal-mingw32.gemspec +2 -2
  6. data/chef.gemspec +3 -3
  7. data/lib/chef/api_client/registration.rb +2 -2
  8. data/lib/chef/application/apply.rb +2 -2
  9. data/lib/chef/application/exit_code.rb +2 -2
  10. data/lib/chef/chef_fs/chef_fs_data_store.rb +3 -3
  11. data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +1 -1
  12. data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +1 -1
  13. data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +1 -1
  14. data/lib/chef/chef_fs/file_system/repository/base_file.rb +1 -0
  15. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +2 -2
  16. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +1 -1
  17. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -2
  18. data/lib/chef/chef_fs/file_system/repository/directory.rb +1 -1
  19. data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +1 -1
  20. data/lib/chef/chef_fs/path_utils.rb +3 -3
  21. data/lib/chef/cookbook/file_system_file_vendor.rb +1 -1
  22. data/lib/chef/cookbook_version.rb +4 -4
  23. data/lib/chef/data_bag.rb +2 -2
  24. data/lib/chef/data_collector/error_handlers.rb +1 -1
  25. data/lib/chef/deprecated.rb +13 -1
  26. data/lib/chef/dsl/declare_resource.rb +1 -1
  27. data/lib/chef/dsl/platform_introspection.rb +3 -1
  28. data/lib/chef/environment.rb +2 -2
  29. data/lib/chef/exceptions.rb +3 -0
  30. data/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +2 -2
  31. data/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +7 -7
  32. data/lib/chef/http.rb +2 -1
  33. data/lib/chef/knife.rb +26 -20
  34. data/lib/chef/knife/bootstrap.rb +30 -31
  35. data/lib/chef/knife/bootstrap/chef_vault_handler.rb +12 -8
  36. data/lib/chef/knife/bootstrap/client_builder.rb +23 -19
  37. data/lib/chef/knife/bootstrap/templates/chef-full.erb +9 -9
  38. data/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb +3 -1
  39. data/lib/chef/knife/bootstrap/train_connector.rb +1 -0
  40. data/lib/chef/knife/cookbook_download.rb +1 -1
  41. data/lib/chef/knife/cookbook_metadata.rb +1 -1
  42. data/lib/chef/knife/cookbook_site_search.rb +1 -1
  43. data/lib/chef/knife/cookbook_site_show.rb +1 -1
  44. data/lib/chef/knife/cookbook_site_unshare.rb +1 -1
  45. data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
  46. data/lib/chef/knife/core/hashed_command_loader.rb +3 -2
  47. data/lib/chef/knife/core/subcommand_loader.rb +1 -1
  48. data/lib/chef/knife/core/windows_bootstrap_context.rb +18 -3
  49. data/lib/chef/knife/exec.rb +2 -2
  50. data/lib/chef/knife/ssh.rb +21 -2
  51. data/lib/chef/log.rb +1 -1
  52. data/lib/chef/mixin/create_path.rb +8 -8
  53. data/lib/chef/mixin/openssl_helper.rb +26 -3
  54. data/lib/chef/mixin/template.rb +1 -0
  55. data/lib/chef/node/mixin/deep_merge_cache.rb +7 -7
  56. data/lib/chef/node_map.rb +5 -2
  57. data/lib/chef/provider/mount/solaris.rb +0 -1
  58. data/lib/chef/provider/package/cab.rb +1 -1
  59. data/lib/chef/provider/package/chocolatey.rb +4 -3
  60. data/lib/chef/provider/package/msu.rb +1 -0
  61. data/lib/chef/provider/package/powershell.rb +5 -1
  62. data/lib/chef/provider/package/snap.rb +96 -27
  63. data/lib/chef/provider/package/zypper.rb +0 -1
  64. data/lib/chef/provider/service/arch.rb +2 -2
  65. data/lib/chef/provider/service/debian.rb +1 -1
  66. data/lib/chef/provider/service/gentoo.rb +2 -2
  67. data/lib/chef/provider/service/macosx.rb +2 -2
  68. data/lib/chef/provider/service/openbsd.rb +1 -1
  69. data/lib/chef/provider/service/redhat.rb +2 -2
  70. data/lib/chef/provider/service/simple.rb +3 -3
  71. data/lib/chef/provider/service/upstart.rb +1 -1
  72. data/lib/chef/provider/windows_task.rb +1 -1
  73. data/lib/chef/provider/yum_repository.rb +1 -1
  74. data/lib/chef/provider/zypper_repository.rb +31 -11
  75. data/lib/chef/resource.rb +2 -0
  76. data/lib/chef/resource/archive_file.rb +28 -8
  77. data/lib/chef/resource/build_essential.rb +1 -1
  78. data/lib/chef/resource/cron_access.rb +13 -5
  79. data/lib/chef/resource/cron_d.rb +1 -1
  80. data/lib/chef/resource/hostname.rb +19 -18
  81. data/lib/chef/resource/launchd.rb +4 -4
  82. data/lib/chef/resource/lwrp_base.rb +7 -0
  83. data/lib/chef/resource/macos_userdefaults.rb +3 -3
  84. data/lib/chef/resource/msu_package.rb +5 -0
  85. data/lib/chef/resource/ssh_known_hosts_entry.rb +1 -1
  86. data/lib/chef/resource/sudo.rb +2 -2
  87. data/lib/chef/resource/windows_feature_powershell.rb +6 -2
  88. data/lib/chef/resource/windows_firewall_rule.rb +8 -4
  89. data/lib/chef/resource/windows_font.rb +2 -1
  90. data/lib/chef/resource/windows_share.rb +4 -4
  91. data/lib/chef/resource/windows_task.rb +13 -13
  92. data/lib/chef/resource_inspector.rb +4 -3
  93. data/lib/chef/role.rb +2 -2
  94. data/lib/chef/shell.rb +1 -1
  95. data/lib/chef/shell/shell_session.rb +2 -0
  96. data/lib/chef/util/diff.rb +1 -1
  97. data/lib/chef/util/dsc/lcm_output_parser.rb +3 -3
  98. data/lib/chef/util/powershell/cmdlet.rb +1 -1
  99. data/lib/chef/version.rb +2 -2
  100. data/lib/chef/win32/api/command_line_helper.rb +89 -0
  101. data/lib/chef/win32/api/file.rb +18 -18
  102. data/lib/chef/win32/file.rb +3 -3
  103. data/lib/chef/win32/process.rb +2 -2
  104. data/spec/functional/knife/ssh_spec.rb +4 -4
  105. data/spec/functional/resource/aix_service_spec.rb +0 -1
  106. data/spec/functional/resource/aixinit_service_spec.rb +7 -8
  107. data/spec/functional/resource/apt_package_spec.rb +0 -1
  108. data/spec/functional/resource/bff_spec.rb +2 -2
  109. data/spec/functional/resource/chocolatey_package_spec.rb +29 -0
  110. data/spec/functional/resource/cookbook_file_spec.rb +1 -1
  111. data/spec/functional/resource/cron_spec.rb +0 -1
  112. data/spec/functional/resource/dsc_resource_spec.rb +1 -1
  113. data/spec/functional/resource/insserv_spec.rb +4 -5
  114. data/spec/functional/resource/link_spec.rb +17 -17
  115. data/spec/functional/resource/msu_package_spec.rb +5 -2
  116. data/spec/functional/resource/rpm_spec.rb +2 -2
  117. data/spec/functional/resource/user/dscl_spec.rb +2 -2
  118. data/spec/functional/resource/user/mac_user_spec.rb +2 -2
  119. data/spec/functional/resource/windows_certificate_spec.rb +3 -3
  120. data/spec/functional/resource/windows_font_spec.rb +49 -0
  121. data/spec/functional/resource/windows_task_spec.rb +8 -8
  122. data/spec/functional/run_lock_spec.rb +2 -1
  123. data/spec/functional/util/powershell/cmdlet_spec.rb +1 -1
  124. data/spec/functional/version_spec.rb +1 -1
  125. data/spec/functional/win32/service_manager_spec.rb +1 -1
  126. data/spec/integration/recipes/accumulator_spec.rb +1 -1
  127. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +2 -2
  128. data/spec/integration/recipes/lwrp_spec.rb +1 -1
  129. data/spec/integration/recipes/notifies_spec.rb +1 -1
  130. data/spec/integration/recipes/notifying_block_spec.rb +1 -1
  131. data/spec/integration/recipes/recipe_dsl_spec.rb +1 -1
  132. data/spec/integration/recipes/resource_converge_if_changed_spec.rb +2 -0
  133. data/spec/integration/recipes/resource_load_spec.rb +1 -0
  134. data/spec/integration/recipes/unified_mode_spec.rb +1 -1
  135. data/spec/scripts/ssl-serve.rb +1 -1
  136. data/spec/spec_helper.rb +26 -19
  137. data/spec/support/chef_helpers.rb +1 -1
  138. data/spec/support/platform_helpers.rb +12 -42
  139. data/spec/support/platforms/win32/spec_service.rb +1 -1
  140. data/spec/support/shared/functional/directory_resource.rb +1 -1
  141. data/spec/support/shared/functional/execute_resource.rb +1 -1
  142. data/spec/support/shared/functional/file_resource.rb +3 -3
  143. data/spec/support/shared/functional/win32_service.rb +1 -1
  144. data/spec/support/shared/functional/windows_script.rb +3 -3
  145. data/spec/support/shared/integration/knife_support.rb +2 -5
  146. data/spec/unit/application_spec.rb +7 -0
  147. data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +2 -4
  148. data/spec/unit/cookbook/gem_installer_spec.rb +2 -1
  149. data/spec/unit/data_bag_spec.rb +1 -1
  150. data/spec/unit/data_collector_spec.rb +1 -1
  151. data/spec/unit/dsl/platform_introspection_spec.rb +1 -0
  152. data/spec/unit/environment_spec.rb +7 -7
  153. data/spec/unit/event_dispatch/dispatcher_spec.rb +3 -0
  154. data/spec/unit/file_access_control_spec.rb +1 -1
  155. data/spec/unit/json_compat_spec.rb +1 -1
  156. data/spec/unit/knife/bootstrap_spec.rb +26 -29
  157. data/spec/unit/knife/cookbook_download_spec.rb +4 -4
  158. data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +1 -1
  159. data/spec/unit/knife/cookbook_upload_spec.rb +5 -6
  160. data/spec/unit/knife/core/hashed_command_loader_spec.rb +3 -3
  161. data/spec/unit/knife/core/windows_bootstrap_context_spec.rb +6 -0
  162. data/spec/unit/knife/role_env_run_list_add_spec.rb +6 -6
  163. data/spec/unit/knife/role_env_run_list_clear_spec.rb +4 -4
  164. data/spec/unit/knife/role_env_run_list_remove_spec.rb +4 -4
  165. data/spec/unit/knife/role_env_run_list_replace_spec.rb +4 -4
  166. data/spec/unit/knife/role_env_run_list_set_spec.rb +4 -4
  167. data/spec/unit/knife/role_run_list_add_spec.rb +6 -6
  168. data/spec/unit/knife/role_run_list_clear_spec.rb +4 -4
  169. data/spec/unit/knife/role_run_list_remove_spec.rb +4 -4
  170. data/spec/unit/knife/role_run_list_replace_spec.rb +4 -4
  171. data/spec/unit/knife/role_run_list_set_spec.rb +4 -4
  172. data/spec/unit/knife/ssh_spec.rb +2 -2
  173. data/spec/unit/knife/supermarket_share_spec.rb +1 -1
  174. data/spec/unit/lwrp_spec.rb +4 -4
  175. data/spec/unit/mixin/securable_spec.rb +0 -1
  176. data/spec/unit/mixin/user_context_spec.rb +1 -9
  177. data/spec/unit/property_spec.rb +6 -6
  178. data/spec/unit/provider/apt_repository_spec.rb +2 -2
  179. data/spec/unit/provider/git_spec.rb +3 -3
  180. data/spec/unit/provider/osx_profile_spec.rb +2 -2
  181. data/spec/unit/provider/package/chocolatey_spec.rb +1 -1
  182. data/spec/unit/provider/package/dnf/python_helper_spec.rb +1 -1
  183. data/spec/unit/provider/package/msu_spec.rb +3 -3
  184. data/spec/unit/provider/package/powershell_spec.rb +95 -86
  185. data/spec/unit/provider/package/rubygems_spec.rb +5 -10
  186. data/spec/unit/provider/package/snap_spec.rb +1 -1
  187. data/spec/unit/provider/package/windows_spec.rb +30 -53
  188. data/spec/unit/provider/service/arch_service_spec.rb +3 -2
  189. data/spec/unit/provider/service/debian_service_spec.rb +1 -1
  190. data/spec/unit/provider/service/gentoo_service_spec.rb +8 -8
  191. data/spec/unit/provider/service/macosx_spec.rb +3 -3
  192. data/spec/unit/provider/service/redhat_spec.rb +2 -2
  193. data/spec/unit/provider/service/upstart_service_spec.rb +3 -3
  194. data/spec/unit/provider/service/windows_spec.rb +2 -6
  195. data/spec/unit/provider/systemd_unit_spec.rb +28 -24
  196. data/spec/unit/provider/zypper_repository_spec.rb +75 -25
  197. data/spec/unit/provider_resolver_spec.rb +9 -9
  198. data/spec/unit/provider_spec.rb +1 -0
  199. data/spec/unit/resource/archive_file_spec.rb +11 -2
  200. data/spec/unit/resource/msu_package_spec.rb +4 -0
  201. data/spec/unit/resource/windows_dns_record_spec.rb +3 -3
  202. data/spec/unit/resource/windows_dns_zone_spec.rb +2 -2
  203. data/spec/unit/resource/windows_feature_powershell_spec.rb +30 -4
  204. data/spec/unit/resource/windows_package_spec.rb +1 -0
  205. data/spec/unit/resource/windows_task_spec.rb +1 -1
  206. data/spec/unit/resource/windows_uac_spec.rb +2 -2
  207. data/spec/unit/resource/yum_repository_spec.rb +21 -21
  208. data/spec/unit/resource_reporter_spec.rb +1 -1
  209. data/spec/unit/resource_spec.rb +1 -1
  210. data/spec/unit/role_spec.rb +11 -11
  211. data/spec/unit/run_context/cookbook_compiler_spec.rb +1 -1
  212. data/spec/unit/run_context_spec.rb +1 -1
  213. data/spec/unit/run_lock_spec.rb +1 -1
  214. data/spec/unit/scan_access_control_spec.rb +1 -1
  215. data/spec/unit/util/threaded_job_queue_spec.rb +9 -0
  216. data/spec/unit/win32/security_spec.rb +4 -3
  217. data/tasks/rspec.rb +5 -13
  218. metadata +24 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15c622f47a07b44645c9f6da22621ce55a591c5a4125eab5cc4f10b9dc129911
4
- data.tar.gz: 8c58e0e9cf35a0b5d50e520000ca95d5d380a079ece2a422fef81ae2bce7efd3
3
+ metadata.gz: b9cedb478d0c5c91ba1217dd228387261aa82eeb69b9f572ce7041719ce3f20f
4
+ data.tar.gz: a4c107cea2186b546e20e4a754a6288d5ccd7cae2c88792aa79a4fa2894acc94
5
5
  SHA512:
6
- metadata.gz: ad59d30855ea9f122b6de599a9446d69497a9b38bb3467dfed98669f3327f5df7cad73955a5af19e0805d70b9276de673def7449f0d9aac997df72b02d675bfa
7
- data.tar.gz: 9ca2fb3f58a675b767696909d501ba1d9979a85ecc3f11f31f4a501a23607915fbc065583d3828a82fbb89a3af4ed7a3114d5499b41069576ab15b3f7c26f520
6
+ metadata.gz: 0f116046c01b46cb1de8e2e0eb07fa5bd4dff2045598460c5a7df71d77d2666caac0511071c6b91f1e879a68ae3c10ee72cdb58cbf9ff7b64bc93fbd6903738b
7
+ data.tar.gz: 5732ddd577cd6b20a07ee8c899747cb09fda3752136540f4f6cc16f1d406ad5b9e7365dc53dc3e415028c9e4aa5281dfde445e19f83bbc3b5f4f551ca168aa45
data/Gemfile CHANGED
@@ -7,15 +7,14 @@ source "https://rubygems.org"
7
7
  # of bundler versions prior to 1.12.0 (https://github.com/bundler/bundler/commit/193a14fe5e0d56294c7b370a0e59f93b2c216eed)
8
8
  gem "chef", path: "."
9
9
 
10
- # necessary until we release ohai 15
11
10
  gem "ohai", git: "https://github.com/chef/ohai.git", branch: "15-stable"
12
11
 
13
- gem "chef-utils", path: File.expand_path("../chef-utils", __FILE__) if File.exist?(File.expand_path("../chef-utils", __FILE__))
14
- gem "chef-config", path: File.expand_path("../chef-config", __FILE__) if File.exist?(File.expand_path("../chef-config", __FILE__))
12
+ gem "chef-utils", path: File.expand_path("chef-utils", __dir__) if File.exist?(File.expand_path("chef-utils", __dir__))
13
+ gem "chef-config", path: File.expand_path("chef-config", __dir__) if File.exist?(File.expand_path("chef-config", __dir__))
15
14
 
16
- if File.exist?(File.expand_path("../chef-bin", __FILE__))
15
+ if File.exist?(File.expand_path("chef-bin", __dir__))
17
16
  # bundling in a git checkout
18
- gem "chef-bin", path: File.expand_path("../chef-bin", __FILE__)
17
+ gem "chef-bin", path: File.expand_path("chef-bin", __dir__)
19
18
  else
20
19
  # bundling in omnibus
21
20
  gem "chef-bin" # rubocop:disable Bundler/DuplicatedGem
@@ -23,6 +22,8 @@ end
23
22
 
24
23
  gem "cheffish", "~> 14"
25
24
 
25
+ gem "chef-telemetry", ">=1.0.8" # 1.0.8 removes the http dep
26
+
26
27
  group(:omnibus_package) do
27
28
  gem "appbundler"
28
29
  gem "rb-readline"
@@ -30,14 +31,14 @@ group(:omnibus_package) do
30
31
  gem "inspec-core-bin", "~> 4.18" # need to provide the binaries for inspec
31
32
  gem "chef-vault"
32
33
  gem "ed25519" # ed25519 ssh key support done here as it's a native gem we can't put in train
33
- gem "bcrypt_pbkdf" # ed25519 ssh key support done here as it's a native gem we can't put in train
34
+ gem "bcrypt_pbkdf", ">= 1.1.0.rc1" # ed25519 ssh key support done here as it's a native gem we can't put in train
34
35
  end
35
36
 
36
37
  group(:omnibus_package, :pry) do
37
38
  gem "pry"
38
39
  gem "pry-byebug"
39
40
  gem "pry-remote"
40
- gem "pry-stack_explorer"
41
+ gem "pry-stack_explorer", "~> 0.4.0" # pin to allow Ruby 2.5
41
42
  end
42
43
 
43
44
  group(:docgen) do
@@ -65,14 +66,12 @@ group(:development, :test) do
65
66
  gem "rspec-mocks", "~> 3.5"
66
67
  gem "rspec-expectations", "~> 3.5"
67
68
  gem "rspec_junit_formatter", "~> 0.2.0"
68
- gem "simplecov"
69
69
  gem "webmock"
70
70
  gem "fauxhai-ng" # for chef-utils gem
71
71
  end
72
72
 
73
73
  group(:chefstyle) do
74
- # for testing new chefstyle rules
75
- gem "chefstyle", git: "https://github.com/chef/chefstyle.git", branch: "master"
74
+ gem "chefstyle", "1.2.1" # pinned so we don't have to fixup 2 branches for new rules
76
75
  end
77
76
 
78
77
  instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
@@ -84,6 +83,7 @@ eval_gemfile("./Gemfile.local") if File.exist?("./Gemfile.local")
84
83
  # These lines added for Windows development only.
85
84
  # For FFI to call into PowerShell we need the binaries and assemblies located
86
85
  # in the Ruby bindir.
86
+ # The Powershell DLL source lives here: https://github.com/chef/chef-powershell-shim
87
87
  #
88
88
  # We copy (and overwrite) these files every time "bundle <exec|install>" is
89
89
  # executed, just in case they have changed.
data/README.md CHANGED
@@ -18,7 +18,7 @@ Chef Infra is a configuration management tool designed to bring automation to yo
18
18
 
19
19
  ### Want to try Chef Infra?
20
20
 
21
- For Chef Infra usage, please refer to our [Learn Chef Rally](https://learn.chef.io/) website, which includes module-based training for Chef Infra, as well as Automate, Habitat, and InSpec.
21
+ For Chef Infra usage, please refer to [Learn Chef](https://learn.chef.io/), our self-paced, entirely free learning platform. Learn Chef also includes module-based training for Chef Infra, as well as Chef Automate, Chef Habitat, and Chef InSpec.
22
22
 
23
23
  Other useful resources for Chef Infra users:
24
24
 
@@ -26,7 +26,7 @@ Other useful resources for Chef Infra users:
26
26
  - Source: <https://github.com/chef/chef/tree/master>
27
27
  - Tickets/Issues: <https://github.com/chef/chef/issues>
28
28
  - Slack: [Chef Community Slack](https://community-slack.chef.io/)
29
- - Mailing list: <https://discourse.chef.io>
29
+ - Mailing list/Forum: <https://discourse.chef.io>
30
30
 
31
31
  ## Reporting Issues
32
32
 
@@ -46,7 +46,7 @@ We'd love to have your help developing Chef Infra. See our [Contributing Documen
46
46
 
47
47
  ## License and Copyright
48
48
 
49
- Copyright 2008-2019, Chef Software, Inc.
49
+ Copyright 2008-2020, Chef Software, Inc.
50
50
 
51
51
  ```
52
52
  Licensed under the Apache License, Version 2.0 (the "License");
data/Rakefile CHANGED
@@ -37,7 +37,7 @@ task :super_install do
37
37
  sh("rake install")
38
38
  end
39
39
 
40
- # Templating the powershell extensions so we can inject distro constants
40
+ # Templating the powershell extensions so we can inject distro constants
41
41
  template_file = ::File.join(::File.dirname(__FILE__), "distro", "templates", "powershell", "chef", "chef.psm1.erb")
42
42
  psm1_path = ::File.join(::File.dirname(__FILE__), "distro", "powershell", "chef")
43
43
  FileUtils.mkdir_p psm1_path
@@ -1,4 +1,4 @@
1
- gemspec = eval(IO.read(File.expand_path("../chef.gemspec", __FILE__)))
1
+ gemspec = eval(IO.read(File.expand_path("chef.gemspec", __dir__)))
2
2
 
3
3
  gemspec.platform = Gem::Platform.new(%w{universal mingw32})
4
4
 
@@ -14,7 +14,7 @@ gemspec.add_dependency "win32-process", "~> 0.8.2"
14
14
  gemspec.add_dependency "win32-service", ">= 2.1.5", "< 3.0"
15
15
  gemspec.add_dependency "wmi-lite", "~> 1.0"
16
16
  gemspec.add_dependency "win32-taskscheduler", "~> 2.0"
17
- gemspec.add_dependency "iso8601", "~> 0.12.1"
17
+ gemspec.add_dependency "iso8601", ">= 0.12.1", "< 0.14" # validate 0.14 when it comes out
18
18
  gemspec.add_dependency "win32-certstore", "~> 0.3"
19
19
  gemspec.extensions << "ext/win32-eventlog/Rakefile"
20
20
  gemspec.files += Dir.glob("{distro,ext}/**/*")
@@ -30,16 +30,16 @@ Gem::Specification.new do |s|
30
30
 
31
31
  s.add_dependency "ffi", "~> 1.9", ">= 1.9.25"
32
32
  s.add_dependency "ffi-yajl", "~> 2.2"
33
- s.add_dependency "net-ssh", ">= 4.2", "< 6"
33
+ s.add_dependency "net-ssh", ">= 4.2", "< 7"
34
34
  s.add_dependency "net-ssh-multi", "~> 1.2", ">= 1.2.1"
35
- s.add_dependency "net-sftp", "~> 2.1", ">= 2.1.2"
35
+ s.add_dependency "net-sftp", ">= 2.1.2", "< 4.0"
36
36
  s.add_dependency "ed25519", "~> 1.2" # ed25519 ssh key support
37
37
  s.add_dependency "bcrypt_pbkdf", "~> 1.0" # ed25519 ssh key support
38
38
  s.add_dependency "highline", ">= 1.6.9", "< 2"
39
39
  s.add_dependency "tty-screen", "~> 0.6" # knife list
40
40
  s.add_dependency "erubis", "~> 2.7"
41
41
  s.add_dependency "diff-lcs", "~> 1.2", ">= 1.2.4"
42
- s.add_dependency "ffi-libarchive"
42
+ s.add_dependency "ffi-libarchive", "~> 1.0", ">= 1.0.3"
43
43
  s.add_dependency "chef-zero", ">= 14.0.11"
44
44
 
45
45
  s.add_dependency "plist", "~> 3.2"
@@ -72,14 +72,14 @@ class Chef
72
72
 
73
73
  def assert_destination_writable!
74
74
  abs_path = File.expand_path(destination)
75
- unless File.exists?(File.dirname(abs_path))
75
+ unless File.exist?(File.dirname(abs_path))
76
76
  begin
77
77
  FileUtils.mkdir_p(File.dirname(abs_path))
78
78
  rescue Errno::EACCES
79
79
  raise Chef::Exceptions::CannotWritePrivateKey, "I can't create the configuration directory at #{File.dirname(abs_path)} - check permissions?"
80
80
  end
81
81
  end
82
- if (File.exists?(abs_path) && !File.writable?(abs_path)) || !File.writable?(File.dirname(abs_path))
82
+ if (File.exist?(abs_path) && !File.writable?(abs_path)) || !File.writable?(File.dirname(abs_path))
83
83
  raise Chef::Exceptions::CannotWritePrivateKey, "I can't write your private key to #{abs_path} - check permissions?"
84
84
  end
85
85
  end
@@ -215,8 +215,8 @@ class Chef::Application::Apply < Chef::Application
215
215
  Chef::Application.fatal!("#{e.class}: #{e.message}", e)
216
216
  end
217
217
 
218
- # Get this party started
219
- def run(enforce_license = false)
218
+ # Get this party started
219
+ def run(enforce_license: false)
220
220
  reconfigure
221
221
  check_license_acceptance if enforce_license
222
222
  run_application
@@ -139,8 +139,8 @@ class Chef
139
139
  def notify_on_deprecation(message)
140
140
  Chef.deprecated(:exit_code, message)
141
141
  rescue Chef::Exceptions::DeprecatedFeatureError
142
- # Have to rescue this, otherwise this unhandled error preempts
143
- # the current exit code assignment.
142
+ # Have to rescue this, otherwise this unhandled error preempts
143
+ # the current exit code assignment.
144
144
  end
145
145
 
146
146
  def non_standard_exit_code_warning(exit_code)
@@ -204,7 +204,7 @@ class Chef
204
204
  @memory_store.create(path, name, data, *options)
205
205
 
206
206
  elsif path[0] == "cookbooks" && path.length == 2
207
- # Do nothing. The entry gets created when the cookbook is created.
207
+ # Do nothing. The entry gets created when the cookbook is created.
208
208
 
209
209
  # /policy_groups/GROUP/policies/NAME
210
210
  elsif path[0] == "policy_groups" && path[2] == "policies"
@@ -724,8 +724,8 @@ class Chef
724
724
  path[-1] = "#{path[-1]}.json"
725
725
  end
726
726
 
727
- # /acls/containers|nodes|... do NOT drop into the next elsif, and do
728
- # not get .json appended
727
+ # /acls/containers|nodes|... do NOT drop into the next elsif, and do
728
+ # not get .json appended
729
729
 
730
730
  # /nodes|clients|.../x.json
731
731
  elsif path.length == 2
@@ -66,7 +66,7 @@ class Chef
66
66
  # }
67
67
  # }
68
68
  def children
69
- # Grab the names of the children, append json, and make child entries
69
+ # Grab the names of the children, append json, and make child entries
70
70
  @children ||= begin
71
71
  result = []
72
72
  data = root.get_json(api_path)
@@ -71,7 +71,7 @@ class Chef
71
71
  # Children are foo.json and bar.json in this case.
72
72
  #
73
73
  def children
74
- # Grab the names of the children, append json, and make child entries
74
+ # Grab the names of the children, append json, and make child entries
75
75
  @children ||= root.get_json(api_path).keys.sort.map do |key|
76
76
  make_child_entry(key, true)
77
77
  end
@@ -19,7 +19,7 @@ class Chef
19
19
  def children
20
20
  result = []
21
21
  seen = {}
22
- # If multiple things have the same name, the first one wins.
22
+ # If multiple things have the same name, the first one wins.
23
23
  multiplexed_dirs.each do |dir|
24
24
  dir.children.each do |child|
25
25
  if seen[child.name]
@@ -92,6 +92,7 @@ class Chef
92
92
  end
93
93
 
94
94
  attr_writer :write_pretty_json
95
+
95
96
  def write_pretty_json
96
97
  @write_pretty_json.nil? ? root.write_pretty_json : @write_pretty_json
97
98
  end
@@ -76,7 +76,7 @@ class Chef
76
76
 
77
77
  # Write out .uploaded-cookbook-version.json
78
78
  # cookbook_file_path = File.join(file_path, cookbook_name) <- this should be the same as self.file_path
79
- unless File.exists?(file_path)
79
+ unless File.exist?(file_path)
80
80
  FileUtils.mkdir_p(file_path)
81
81
  end
82
82
  uploaded_cookbook_version_path = File.join(file_path, Chef::Cookbook::CookbookVersionLoader::UPLOADED_COOKBOOK_VERSION_FILE)
@@ -132,7 +132,7 @@ class Chef
132
132
  end
133
133
 
134
134
  def can_upload?
135
- File.exists?(uploaded_cookbook_version_path) || children.size > 0
135
+ File.exist?(uploaded_cookbook_version_path) || children.size > 0
136
136
  end
137
137
 
138
138
  protected
@@ -137,7 +137,7 @@ class Chef
137
137
  end
138
138
 
139
139
  def exists?
140
- File.exists?(file_path) && (parent.nil? || parent.can_have_child?(name, dir?))
140
+ File.exist?(file_path) && (parent.nil? || parent.can_have_child?(name, dir?))
141
141
  end
142
142
 
143
143
  def read
@@ -161,7 +161,7 @@ class Chef
161
161
  # members.json and org.json may be found.
162
162
  #
163
163
  def root_dir
164
- existing_paths = root_paths.select { |path| File.exists?(path) }
164
+ existing_paths = root_paths.select { |path| File.exist?(path) }
165
165
  if existing_paths.size > 0
166
166
  MultiplexedDir.new(existing_paths.map do |path|
167
167
  dir = FileSystemEntry.new(name, parent, path)
@@ -184,7 +184,7 @@ class Chef
184
184
  return root_dir.child(name)
185
185
  end
186
186
 
187
- paths = (child_paths[name] || []).select { |path| File.exists?(path) }
187
+ paths = (child_paths[name] || []).select { |path| File.exist?(path) }
188
188
  if paths.size == 0
189
189
  return NonexistentFSObject.new(name, self)
190
190
  end
@@ -151,7 +151,7 @@ class Chef
151
151
  end
152
152
 
153
153
  def exists?
154
- File.exists?(file_path)
154
+ File.exist?(file_path)
155
155
  end
156
156
 
157
157
  protected
@@ -122,7 +122,7 @@ class Chef
122
122
  end
123
123
 
124
124
  def exists?
125
- File.exists?(file_path) && (parent.nil? || parent.can_have_child?(name, dir?))
125
+ File.exist?(file_path) && (parent.nil? || parent.can_have_child?(name, dir?))
126
126
  end
127
127
 
128
128
  def read
@@ -71,9 +71,9 @@ class Chef
71
71
  # part that actually exists. The paths operated on here are not Chef-FS paths.
72
72
  # These are OS paths that may contain symlinks but may not also fully exist.
73
73
  #
74
- # If /x is a symlink to /blarghle, and has no subdirectories, then:
75
- # PathUtils.realest_path('/x/y/z') == '/blarghle/y/z'
76
- # PathUtils.realest_path('/x/*/z') == '/blarghle/*/z'
74
+ # If /x is a symlink to /foo_bar, and has no subdirectories, then:
75
+ # PathUtils.realest_path('/x/y/z') == '/foo_bar/y/z'
76
+ # PathUtils.realest_path('/x/*/z') == '/foo_bar/*/z'
77
77
  # PathUtils.realest_path('/*/y/z') == '/*/y/z'
78
78
  #
79
79
  # TODO: Move this to wherever util/path_helper is these days.
@@ -27,7 +27,7 @@ class Chef
27
27
  # and throws the rest away then re-builds the list of files on the
28
28
  # disk. This is due to the manifest not having the on-disk file
29
29
  # locations, since in the chef-client case, that information is
30
- # non-sensical.
30
+ # nonsensical.
31
31
  class FileSystemFileVendor < FileVendor
32
32
 
33
33
  attr_reader :cookbook_name
@@ -327,10 +327,10 @@ class Chef
327
327
 
328
328
  # extract the preference part from the path.
329
329
  if manifest_record_path =~ %r{(#{Regexp.escape(segment.to_s)}/[^/]+/#{Regexp.escape(dirname)})/.+$}
330
- # Note the specificy_dirname includes the segment and
331
- # dirname argument as above, which is what
332
- # preferences_for_path returns. It could be
333
- # "files/ubuntu-9.10/dirname", for example.
330
+ # Note the specificy_dirname includes the segment and
331
+ # dirname argument as above, which is what
332
+ # preferences_for_path returns. It could be
333
+ # "files/ubuntu-9.10/dirname", for example.
334
334
  specificity_dirname = $1
335
335
 
336
336
  # Record the specificity_dirname only if it's in the list of
@@ -94,7 +94,7 @@ class Chef
94
94
  names = []
95
95
  paths.each do |path|
96
96
  unless File.directory?(path)
97
- raise Chef::Exceptions::InvalidDataBagPath, "Data bag path '#{path}' is invalid"
97
+ raise Chef::Exceptions::InvalidDataBagPath, "Data bag path '#{path}' not found. Please create this directory."
98
98
  end
99
99
 
100
100
  names += Dir.glob(File.join(
@@ -122,7 +122,7 @@ class Chef
122
122
  data_bag = {}
123
123
  paths.each do |path|
124
124
  unless File.directory?(path)
125
- raise Chef::Exceptions::InvalidDataBagPath, "Data bag path '#{path}' is invalid"
125
+ raise Chef::Exceptions::InvalidDataBagPath, "Data bag path '#{path}' not found. Please create this directory."
126
126
  end
127
127
 
128
128
  Dir.glob(File.join(Chef::Util::PathHelper.escape_glob_dir(path, name.to_s), "*.json")).inject({}) do |bag, f|
@@ -18,7 +18,7 @@
18
18
  class Chef
19
19
  class DataCollector
20
20
 
21
- # This module isolates the handling of collecting error descriptions to insert into the data_colletor
21
+ # This module isolates the handling of collecting error descriptions to insert into the data_collector
22
22
  # report output. For very early errors it is responsible for collecting the node_name for the report
23
23
  # to use. For all failure conditions that have an ErrorMapper it collects the output.
24
24
  #
@@ -72,7 +72,7 @@ class Chef
72
72
  # Just in case someone uses a symbol in the config by mistake.
73
73
  silence_spec = silence_spec.to_s
74
74
  end
75
- # Check for a silence by deprecation name, or by location.
75
+ # Check for a silence by deprecation name, or by location.
76
76
  self.class.deprecation_key == silence_spec || self.class.deprecation_id.to_s == silence_spec || "chef-#{self.class.deprecation_id}" == silence_spec.downcase || location.include?(silence_spec)
77
77
  end
78
78
  # check if this warning has been silenced by inline comment.
@@ -233,6 +233,18 @@ class Chef
233
233
  target 28
234
234
  end
235
235
 
236
+ class KnifeBootstrapApis < Base
237
+ target 29
238
+ end
239
+
240
+ class ArchiveFileIntegerFileMode < Base
241
+ target 30
242
+ end
243
+
244
+ class ResourceNameWithoutProvides < Base
245
+ target 31
246
+ end
247
+
236
248
  class Generic < Base
237
249
  def url
238
250
  "https://docs.chef.io/chef_deprecations_client/"
@@ -151,7 +151,7 @@ class Chef
151
151
  # source "y.txt.erb"
152
152
  # variables {}
153
153
  # end
154
- # resource.variables.merge!({ home: "/home/klowns" })
154
+ # resource.variables.merge!({ home: "/home/clowns" })
155
155
  #
156
156
  def edit_resource(type, name, created_at: nil, run_context: self.run_context, &resource_attrs_block)
157
157
  edit_resource!(type, name, created_at: created_at, run_context: run_context, &resource_attrs_block)
@@ -168,7 +168,7 @@ class Chef
168
168
  has_platform
169
169
  end
170
170
 
171
- # Implementation class for determining platform family dependent values
171
+ # Implementation class for determining platform family dependent values
172
172
  class PlatformFamilyDependentValue
173
173
 
174
174
  # Create a platform family dependent value object.
@@ -248,6 +248,8 @@ class Chef
248
248
  end
249
249
 
250
250
  # a simple helper to determine if we're on a windows release pre-2012 / 8
251
+ #
252
+ # @deprecated Windows releases before Windows 2012 and 8 are no longer supported
251
253
  # @return [Boolean] Is the system older than Windows 8 / 2012
252
254
  def older_than_win_2012_or_8?(node = run_context.nil? ? nil : run_context.node)
253
255
  node["platform_version"].to_f < 6.2
@@ -255,11 +255,11 @@ class Chef
255
255
  js_file = File.join(Chef::Config[:environment_path], "#{name}.json")
256
256
  rb_file = File.join(Chef::Config[:environment_path], "#{name}.rb")
257
257
 
258
- if File.exists?(js_file)
258
+ if File.exist?(js_file)
259
259
  # from_json returns object.class => json_class in the JSON.
260
260
  hash = Chef::JSONCompat.parse(IO.read(js_file))
261
261
  from_hash(hash)
262
- elsif File.exists?(rb_file)
262
+ elsif File.exist?(rb_file)
263
263
  environment = Chef::Environment.new
264
264
  environment.name(name)
265
265
  environment.from_file(rb_file)