chef 15.12.22-universal-mingw32 → 15.16.4-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +10 -10
  3. data/Rakefile +11 -17
  4. data/chef-universal-mingw32.gemspec +4 -4
  5. data/chef.gemspec +22 -4
  6. data/lib/chef/api_client/registration.rb +2 -2
  7. data/lib/chef/chef_fs/file_system/repository/base_file.rb +1 -0
  8. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +2 -2
  9. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +1 -1
  10. data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -2
  11. data/lib/chef/chef_fs/file_system/repository/directory.rb +1 -1
  12. data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +1 -1
  13. data/lib/chef/deprecated.rb +4 -0
  14. data/lib/chef/environment.rb +2 -2
  15. data/lib/chef/exceptions.rb +3 -0
  16. data/lib/chef/http.rb +2 -1
  17. data/lib/chef/knife/bootstrap.rb +3 -3
  18. data/lib/chef/knife/bootstrap/train_connector.rb +1 -0
  19. data/lib/chef/knife/cookbook_download.rb +1 -1
  20. data/lib/chef/knife/cookbook_metadata.rb +1 -1
  21. data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
  22. data/lib/chef/knife/core/hashed_command_loader.rb +3 -2
  23. data/lib/chef/knife/core/subcommand_loader.rb +1 -1
  24. data/lib/chef/knife/exec.rb +2 -2
  25. data/lib/chef/knife/ssh.rb +20 -1
  26. data/lib/chef/log.rb +1 -1
  27. data/lib/chef/mixin/openssl_helper.rb +26 -3
  28. data/lib/chef/mixin/template.rb +1 -0
  29. data/lib/chef/node_map.rb +5 -2
  30. data/lib/chef/provider/mount/solaris.rb +0 -1
  31. data/lib/chef/provider/package/dnf/dnf_helper.py +5 -0
  32. data/lib/chef/provider/package/freebsd/pkgng.rb +3 -1
  33. data/lib/chef/provider/package/yum/yum_helper.py +4 -0
  34. data/lib/chef/provider/package/zypper.rb +0 -1
  35. data/lib/chef/provider/service/arch.rb +2 -2
  36. data/lib/chef/provider/service/debian.rb +1 -1
  37. data/lib/chef/provider/service/gentoo.rb +2 -2
  38. data/lib/chef/provider/service/macosx.rb +2 -2
  39. data/lib/chef/provider/service/openbsd.rb +1 -1
  40. data/lib/chef/provider/service/redhat.rb +2 -2
  41. data/lib/chef/provider/service/upstart.rb +1 -1
  42. data/lib/chef/provider/yum_repository.rb +1 -1
  43. data/lib/chef/provider/zypper_repository.rb +1 -1
  44. data/lib/chef/resource.rb +2 -0
  45. data/lib/chef/resource/cron_access.rb +2 -2
  46. data/lib/chef/resource/cron_d.rb +2 -1
  47. data/lib/chef/resource/homebrew_cask.rb +3 -3
  48. data/lib/chef/resource/hostname.rb +18 -18
  49. data/lib/chef/resource/locale.rb +1 -1
  50. data/lib/chef/resource/lwrp_base.rb +7 -0
  51. data/lib/chef/resource/ssh_known_hosts_entry.rb +1 -1
  52. data/lib/chef/resource/sudo.rb +2 -2
  53. data/lib/chef/resource/windows_feature_powershell.rb +6 -2
  54. data/lib/chef/resource/windows_font.rb +2 -1
  55. data/lib/chef/role.rb +2 -2
  56. data/lib/chef/shell.rb +32 -1
  57. data/lib/chef/shell/shell_session.rb +2 -0
  58. data/lib/chef/util/diff.rb +1 -1
  59. data/lib/chef/util/dsc/configuration_generator.rb +1 -1
  60. data/lib/chef/util/powershell/cmdlet.rb +1 -1
  61. data/lib/chef/version.rb +2 -2
  62. data/lib/chef/version_string.rb +1 -1
  63. data/lib/chef/win32/file.rb +2 -2
  64. data/spec/functional/knife/ssh_spec.rb +4 -4
  65. data/spec/functional/resource/aix_service_spec.rb +0 -1
  66. data/spec/functional/resource/aixinit_service_spec.rb +7 -8
  67. data/spec/functional/resource/apt_package_spec.rb +0 -1
  68. data/spec/functional/resource/bff_spec.rb +2 -2
  69. data/spec/functional/resource/cookbook_file_spec.rb +1 -1
  70. data/spec/functional/resource/cron_spec.rb +0 -1
  71. data/spec/functional/resource/dsc_resource_spec.rb +1 -1
  72. data/spec/functional/resource/insserv_spec.rb +4 -5
  73. data/spec/functional/resource/link_spec.rb +17 -17
  74. data/spec/functional/resource/rpm_spec.rb +2 -2
  75. data/spec/functional/resource/user/dscl_spec.rb +1 -1
  76. data/spec/functional/resource/user/mac_user_spec.rb +1 -1
  77. data/spec/functional/resource/windows_certificate_spec.rb +3 -3
  78. data/spec/functional/resource/windows_font_spec.rb +49 -0
  79. data/spec/functional/run_lock_spec.rb +2 -1
  80. data/spec/functional/shell_spec.rb +5 -5
  81. data/spec/functional/util/powershell/cmdlet_spec.rb +1 -1
  82. data/spec/functional/version_spec.rb +1 -1
  83. data/spec/functional/win32/service_manager_spec.rb +1 -1
  84. data/spec/integration/recipes/accumulator_spec.rb +1 -1
  85. data/spec/integration/recipes/lwrp_inline_resources_spec.rb +2 -2
  86. data/spec/integration/recipes/lwrp_spec.rb +1 -1
  87. data/spec/integration/recipes/notifies_spec.rb +1 -1
  88. data/spec/integration/recipes/notifying_block_spec.rb +1 -1
  89. data/spec/integration/recipes/recipe_dsl_spec.rb +1 -1
  90. data/spec/integration/recipes/resource_converge_if_changed_spec.rb +2 -0
  91. data/spec/integration/recipes/resource_load_spec.rb +1 -0
  92. data/spec/integration/recipes/unified_mode_spec.rb +1 -1
  93. data/spec/scripts/ssl-serve.rb +1 -1
  94. data/spec/spec_helper.rb +10 -8
  95. data/spec/support/platform_helpers.rb +12 -42
  96. data/spec/support/platforms/win32/spec_service.rb +1 -1
  97. data/spec/support/shared/functional/directory_resource.rb +1 -1
  98. data/spec/support/shared/functional/execute_resource.rb +1 -1
  99. data/spec/support/shared/functional/file_resource.rb +2 -2
  100. data/spec/support/shared/functional/win32_service.rb +1 -1
  101. data/spec/support/shared/functional/windows_script.rb +3 -3
  102. data/spec/support/shared/integration/knife_support.rb +2 -5
  103. data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +2 -4
  104. data/spec/unit/cookbook/gem_installer_spec.rb +2 -1
  105. data/spec/unit/dsl/platform_introspection_spec.rb +1 -0
  106. data/spec/unit/environment_spec.rb +7 -7
  107. data/spec/unit/event_dispatch/dispatcher_spec.rb +3 -0
  108. data/spec/unit/knife/bootstrap_spec.rb +14 -14
  109. data/spec/unit/knife/cookbook_download_spec.rb +4 -4
  110. data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +1 -1
  111. data/spec/unit/knife/cookbook_upload_spec.rb +5 -6
  112. data/spec/unit/knife/core/hashed_command_loader_spec.rb +3 -3
  113. data/spec/unit/knife/ssh_spec.rb +2 -2
  114. data/spec/unit/knife/supermarket_share_spec.rb +5 -3
  115. data/spec/unit/lwrp_spec.rb +4 -4
  116. data/spec/unit/mixin/securable_spec.rb +0 -1
  117. data/spec/unit/property_spec.rb +5 -5
  118. data/spec/unit/provider/package/dnf/python_helper_spec.rb +1 -1
  119. data/spec/unit/provider/package/freebsd/pkgng_spec.rb +1 -1
  120. data/spec/unit/provider/package/rubygems_spec.rb +5 -10
  121. data/spec/unit/provider/package/windows_spec.rb +30 -53
  122. data/spec/unit/provider/service/arch_service_spec.rb +3 -2
  123. data/spec/unit/provider/service/debian_service_spec.rb +1 -1
  124. data/spec/unit/provider/service/gentoo_service_spec.rb +7 -7
  125. data/spec/unit/provider/service/macosx_spec.rb +3 -3
  126. data/spec/unit/provider/service/redhat_spec.rb +2 -2
  127. data/spec/unit/provider/service/upstart_service_spec.rb +3 -3
  128. data/spec/unit/provider/service/windows_spec.rb +2 -6
  129. data/spec/unit/provider/systemd_unit_spec.rb +28 -24
  130. data/spec/unit/provider_spec.rb +1 -0
  131. data/spec/unit/resource/windows_feature_powershell_spec.rb +30 -4
  132. data/spec/unit/resource/windows_package_spec.rb +1 -0
  133. data/spec/unit/role_spec.rb +11 -11
  134. data/spec/unit/run_context/cookbook_compiler_spec.rb +1 -1
  135. data/spec/unit/win32/security_spec.rb +4 -3
  136. metadata +48 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d7d10dc56cf8158118e798321235a2e20cd396d0c271c1d8da451394f99cd5dc
4
- data.tar.gz: d8d9d42fdfd9afe9bff18bf6cee3774518ae3633544d7b40dc8179b4bd6aaed7
3
+ metadata.gz: 433887c470a68198fc4f67417c00262ce44efcb612649c47b1c51a4e0adf6a5d
4
+ data.tar.gz: fe6e207c5ddf1300b9a52290a93af3df27158642032eab244d93689dfe929991
5
5
  SHA512:
6
- metadata.gz: e7dda48107577e29a021c120368b4683a7049660d79df8a2ae45912b198d89ed0c568f80c51cd341dc35aa3801b4319ed568e66f09454f2c903bfc5d4e4100d9
7
- data.tar.gz: ecb3de98f0e4a7c8d765a9f3bf2eebe192377120447f467ea541d9c936e284768a2f96d3ccf6fe6e3459ddcd4c66703e1f188647b02723806f3b9e0b6ef977dc
6
+ metadata.gz: 3687a11de951a498c2d34e751972076f4e8010418ea7bd0141425cdd1e2ac513767dc37b526775b2ab86e2c3cfa7f9bcfe70fe69987c8157a1b8eca4c50e68dd
7
+ data.tar.gz: 28d29e0be852223313874f82fa1ff587dac8d19c5d35af21f0501d8f95adafda7bbfa6c8558efb3909f1fad2bb6e0a40b482472fd22119ace83af3f28a982337
data/Gemfile CHANGED
@@ -9,12 +9,12 @@ gem "chef", path: "."
9
9
 
10
10
  gem "ohai", git: "https://github.com/chef/ohai.git", branch: "15-stable"
11
11
 
12
- gem "chef-utils", path: File.expand_path("../chef-utils", __FILE__) if File.exist?(File.expand_path("../chef-utils", __FILE__))
13
- 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__))
14
14
 
15
- if File.exist?(File.expand_path("../chef-bin", __FILE__))
15
+ if File.exist?(File.expand_path("chef-bin", __dir__))
16
16
  # bundling in a git checkout
17
- gem "chef-bin", path: File.expand_path("../chef-bin", __FILE__)
17
+ gem "chef-bin", path: File.expand_path("chef-bin", __dir__)
18
18
  else
19
19
  # bundling in omnibus
20
20
  gem "chef-bin" # rubocop:disable Bundler/DuplicatedGem
@@ -28,10 +28,8 @@ group(:omnibus_package) do
28
28
  gem "appbundler"
29
29
  gem "rb-readline"
30
30
  gem "inspec-core", "~> 4.18"
31
- gem "inspec-core-bin", "~> 4.18" # need to provide the binaries for inspec
31
+ gem "inspec-core-bin", "~> 4.24" # need to provide the binaries for inspec
32
32
  gem "chef-vault"
33
- gem "ed25519" # 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
35
33
  end
36
34
 
37
35
  group(:omnibus_package, :pry) do
@@ -65,14 +63,13 @@ group(:development, :test) do
65
63
  gem "rspec-core", "~> 3.5"
66
64
  gem "rspec-mocks", "~> 3.5"
67
65
  gem "rspec-expectations", "~> 3.5"
68
- gem "rspec_junit_formatter", "~> 0.2.0"
66
+ gem "rspec_junit_formatter", "~> 0.4.0"
69
67
  gem "webmock"
70
68
  gem "fauxhai-ng" # for chef-utils gem
71
69
  end
72
70
 
73
71
  group(:chefstyle) do
74
- # for testing new chefstyle rules
75
- gem "chefstyle", git: "https://github.com/chef/chefstyle.git", branch: "master"
72
+ gem "chefstyle", "1.2.1" # pinned so we don't have to fixup 2 branches for new rules
76
73
  end
77
74
 
78
75
  instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
@@ -85,6 +82,9 @@ eval_gemfile("./Gemfile.local") if File.exist?("./Gemfile.local")
85
82
  # For FFI to call into PowerShell we need the binaries and assemblies located
86
83
  # in the Ruby bindir.
87
84
  # The Powershell DLL source lives here: https://github.com/chef/chef-powershell-shim
85
+ # Every merge into that repo triggers a Habitat build and promotion. Running
86
+ # the rake :update_chef_exec_dll task in this (chef/chef) repo will pull down
87
+ # the built packages and copy the binaries to distro/ruby_bin_folder.
88
88
  #
89
89
  # We copy (and overwrite) these files every time "bundle <exec|install>" is
90
90
  # executed, just in case they have changed.
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@chef.io>)
3
3
  # Author:: Daniel DeLeo (<dan@chef.io>)
4
- # Copyright:: Copyright 2008-2019, Chef Software Inc.
4
+ # Copyright:: Copyright, 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");
@@ -17,16 +17,20 @@
17
17
  # limitations under the License.
18
18
  #
19
19
 
20
+ # we need this to resolve files required by lib/chef/dist
21
+ $LOAD_PATH.unshift(File.expand_path("chef-config/lib", __dir__))
22
+
20
23
  begin
21
24
  require_relative "tasks/rspec"
22
25
  require_relative "tasks/dependencies"
23
- require_relative "tasks/announce"
24
26
  require_relative "tasks/docs"
25
- require_relative "lib/chef/dist"
27
+ require_relative "lib/chef/dist" unless defined?(Chef::Dist)
26
28
  rescue LoadError => e
27
29
  puts "Skipping missing rake dep: #{e}"
28
30
  end
29
31
 
32
+ require "bundler/gem_helper"
33
+
30
34
  ENV["CHEF_LICENSE"] = "accept-no-persist"
31
35
 
32
36
  # hack the chef-config install to run before the traditional install task
@@ -38,6 +42,7 @@ task :super_install do
38
42
  end
39
43
 
40
44
  # Templating the powershell extensions so we can inject distro constants
45
+ require "erb"
41
46
  template_file = ::File.join(::File.dirname(__FILE__), "distro", "templates", "powershell", "chef", "chef.psm1.erb")
42
47
  psm1_path = ::File.join(::File.dirname(__FILE__), "distro", "powershell", "chef")
43
48
  FileUtils.mkdir_p psm1_path
@@ -55,8 +60,9 @@ Bundler::GemHelper.install_tasks name: gemspec
55
60
  # this gets appended to the normal bundler install helper
56
61
  task :install do
57
62
  chef_bin_path = ::File.join(::File.dirname(__FILE__), "chef-bin")
58
- Dir.chdir(chef_bin_path)
59
- sh("rake install:force")
63
+ Dir.chdir(chef_bin_path) do
64
+ sh("rake install:force")
65
+ end
60
66
  end
61
67
 
62
68
  task :pedant, :chef_zero_spec
@@ -82,15 +88,3 @@ begin
82
88
  rescue LoadError
83
89
  puts "chefstyle/rubocop is not available. bundle install first to make sure all dependencies are installed."
84
90
  end
85
-
86
- begin
87
- require "yard"
88
- DOC_FILES = [ "spec/tiny_server.rb", "lib/**/*.rb" ].freeze
89
-
90
- YARD::Rake::YardocTask.new(:docs) do |t|
91
- t.files = DOC_FILES
92
- t.options = ["--format", "html"]
93
- end
94
- rescue LoadError
95
- puts "yard is not available. bundle install first to make sure all dependencies are installed."
96
- end
@@ -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
 
@@ -10,12 +10,12 @@ gemspec.add_dependency "win32-event", "~> 0.6.1"
10
10
  gemspec.add_dependency "win32-eventlog", "0.6.3"
11
11
  gemspec.add_dependency "win32-mmap", "~> 0.4.1"
12
12
  gemspec.add_dependency "win32-mutex", "~> 0.4.2"
13
- gemspec.add_dependency "win32-process", "~> 0.8.2"
13
+ gemspec.add_dependency "win32-process", "~> 0.9"
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"
18
- gemspec.add_dependency "win32-certstore", "~> 0.3"
17
+ gemspec.add_dependency "iso8601", ">= 0.12.1", "< 0.14" # validate 0.14 when it comes out
18
+ gemspec.add_dependency "win32-certstore", "~> 0.5.0" # 0.5+ required for specifying user vs. system store
19
19
  gemspec.extensions << "ext/win32-eventlog/Rakefile"
20
20
  gemspec.files += Dir.glob("{distro,ext}/**/*")
21
21
 
data/chef.gemspec CHANGED
@@ -1,4 +1,13 @@
1
1
  $:.unshift(File.dirname(__FILE__) + "/lib")
2
+ vs_path = File.expand_path("chef-utils/lib/chef-utils/version_string.rb", __dir__)
3
+
4
+ if File.exist?(vs_path)
5
+ # this is the moral equivalent of a require_relative since bundler makes require_relative here fail hard
6
+ eval(IO.read(vs_path))
7
+ else
8
+ # if the path doesn't exist then we're just in the wild gem and not in the git repo
9
+ require "chef-utils/version_string"
10
+ end
2
11
  require "chef/version"
3
12
 
4
13
  Gem::Specification.new do |s|
@@ -20,7 +29,7 @@ Gem::Specification.new do |s|
20
29
  s.add_dependency "train-core", "~> 3.2", ">= 3.2.28" # 3.2.28 fixes sudo prompts. See https://github.com/chef/chef/pull/9635
21
30
  s.add_dependency "train-winrm", ">= 0.2.5"
22
31
 
23
- s.add_dependency "license-acceptance", "~> 1.0", ">= 1.0.5"
32
+ s.add_dependency "license-acceptance", ">= 1.0.5", "< 3"
24
33
  s.add_dependency "mixlib-cli", ">= 2.1.1", "< 3.0"
25
34
  s.add_dependency "mixlib-log", ">= 2.0.3", "< 4.0"
26
35
  s.add_dependency "mixlib-authentication", ">= 2.1", "< 4"
@@ -35,10 +44,10 @@ Gem::Specification.new do |s|
35
44
  s.add_dependency "net-sftp", ">= 2.1.2", "< 4.0"
36
45
  s.add_dependency "ed25519", "~> 1.2" # ed25519 ssh key support
37
46
  s.add_dependency "bcrypt_pbkdf", "~> 1.0" # ed25519 ssh key support
38
- s.add_dependency "highline", ">= 1.6.9", "< 2"
47
+ s.add_dependency "highline", ">= 1.6.9", "< 3"
39
48
  s.add_dependency "tty-screen", "~> 0.6" # knife list
40
49
  s.add_dependency "erubis", "~> 2.7"
41
- s.add_dependency "diff-lcs", "~> 1.2", ">= 1.2.4"
50
+ s.add_dependency "diff-lcs", ">= 1.2.4", "< 1.4.0" # 1.4 breaks output
42
51
  s.add_dependency "ffi-libarchive", "~> 1.0", ">= 1.0.3"
43
52
  s.add_dependency "chef-zero", ">= 14.0.11"
44
53
 
@@ -46,7 +55,7 @@ Gem::Specification.new do |s|
46
55
  s.add_dependency "iniparse", "~> 1.4"
47
56
  s.add_dependency "addressable"
48
57
  s.add_dependency "syslog-logger", "~> 1.6"
49
- s.add_dependency "uuidtools", "~> 2.1.5"
58
+ s.add_dependency "uuidtools", ">= 2.1.5", "< 3.0"
50
59
 
51
60
  s.add_dependency "proxifier", "~> 1.0"
52
61
 
@@ -62,4 +71,13 @@ Gem::Specification.new do |s|
62
71
  Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } +
63
72
  Dir.glob("*.gemspec") +
64
73
  Dir.glob("tasks/rspec.rb")
74
+
75
+ s.metadata = {
76
+ "bug_tracker_uri" => "https://github.com/chef/chef/issues",
77
+ "changelog_uri" => "https://github.com/chef/chef/blob/master/CHANGELOG.md",
78
+ "documentation_uri" => "https://docs.chef.io/",
79
+ "homepage_uri" => "https://www.chef.io",
80
+ "mailing_list_uri" => "https://discourse.chef.io/",
81
+ "source_code_uri" => "https://github.com/chef/chef/",
82
+ }
65
83
  end
@@ -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
@@ -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
@@ -241,6 +241,10 @@ class Chef
241
241
  target 30
242
242
  end
243
243
 
244
+ class ResourceNameWithoutProvides < Base
245
+ target 31
246
+ end
247
+
244
248
  class Generic < Base
245
249
  def url
246
250
  "https://docs.chef.io/chef_deprecations_client/"
@@ -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)
@@ -198,6 +198,7 @@ class Chef
198
198
  class MetadataNotFound < StandardError
199
199
  attr_reader :install_path
200
200
  attr_reader :cookbook_name
201
+
201
202
  def initialize(install_path, cookbook_name)
202
203
  @install_path = install_path
203
204
  @cookbook_name = cookbook_name
@@ -448,6 +449,7 @@ class Chef
448
449
  # to correctly populate the backtrace with the wrapped backtraces.
449
450
  class RunFailedWrappingError < RuntimeError
450
451
  attr_reader :wrapped_errors
452
+
451
453
  def initialize(*errors)
452
454
  errors = errors.select { |e| !e.nil? }
453
455
  output = "Found #{errors.size} errors, they are stored in the backtrace"
@@ -488,6 +490,7 @@ class Chef
488
490
 
489
491
  class MultipleDscResourcesFound < RuntimeError
490
492
  attr_reader :resources_found
493
+
491
494
  def initialize(resources_found)
492
495
  @resources_found = resources_found
493
496
  matches_info = @resources_found.each do |r|
data/lib/chef/http.rb CHANGED
@@ -22,7 +22,8 @@
22
22
  #
23
23
 
24
24
  require "tempfile" unless defined?(Tempfile)
25
- require "net/https"
25
+ require "openssl" unless defined?(OpenSSL)
26
+ require "net/http" unless defined?(Net::HTTP)
26
27
  require "uri" unless defined?(URI)
27
28
  require_relative "http/basic_client"
28
29
  require_relative "monkey_patches/net_http"
@@ -497,7 +497,7 @@ class Chef
497
497
  template = bootstrap_template
498
498
 
499
499
  # Use the template directly if it's a path to an actual file
500
- if File.exists?(template)
500
+ if File.exist?(template)
501
501
  Chef::Log.trace("Using the specified bootstrap template: #{File.dirname(template)}")
502
502
  return template
503
503
  end
@@ -512,7 +512,7 @@ class Chef
512
512
 
513
513
  template_file = Array(bootstrap_files).find do |bootstrap_template|
514
514
  Chef::Log.trace("Looking for bootstrap template in #{File.dirname(bootstrap_template)}")
515
- File.exists?(bootstrap_template)
515
+ File.exist?(bootstrap_template)
516
516
  end
517
517
 
518
518
  unless template_file
@@ -555,7 +555,7 @@ class Chef
555
555
  end
556
556
 
557
557
  def run
558
- check_license
558
+ check_license if ChefConfig::Dist::ENFORCE_LICENSE
559
559
 
560
560
  plugin_setup!
561
561
  validate_name_args!
@@ -322,6 +322,7 @@ class Chef
322
322
 
323
323
  class RemoteExecutionFailed < StandardError
324
324
  attr_reader :exit_status, :command, :hostname, :stdout, :stderr
325
+
325
326
  def initialize(hostname, command, result)
326
327
  @hostname = hostname
327
328
  @exit_status = result.exit_status
@@ -73,7 +73,7 @@ class Chef
73
73
  manifest = cookbook.cookbook_manifest
74
74
 
75
75
  basedir = File.join(config[:download_directory], "#{@cookbook_name}-#{cookbook.version}")
76
- if File.exists?(basedir)
76
+ if File.exist?(basedir)
77
77
  if config[:force]
78
78
  Chef::Log.trace("Deleting #{basedir}")
79
79
  FileUtils.rm_rf(basedir)
@@ -62,7 +62,7 @@ class Chef
62
62
  def generate_metadata(cookbook)
63
63
  Array(config[:cookbook_path]).reverse_each do |path|
64
64
  file = File.expand_path(File.join(path, cookbook, "metadata.rb"))
65
- if File.exists?(file)
65
+ if File.exist?(file)
66
66
  generate_metadata_from_file(cookbook, file)
67
67
  else
68
68
  validate_metadata_json(path, cookbook)
@@ -47,7 +47,7 @@ class Chef
47
47
 
48
48
  def find_subcommands_via_dirglob
49
49
  # The "require paths" of the core knife subcommands bundled with chef
50
- files = Dir[File.join(Chef::Util::PathHelper.escape_glob_dir(File.expand_path("../../../knife", __FILE__)), "*.rb")]
50
+ files = Dir[File.join(Chef::Util::PathHelper.escape_glob_dir(File.expand_path("../../knife", __dir__)), "*.rb")]
51
51
  subcommand_files = {}
52
52
  files.each do |knife_file|
53
53
  rel_path = knife_file[/#{CHEF_ROOT}#{Regexp.escape(File::SEPARATOR)}(.*)\.rb/, 1]
@@ -27,6 +27,7 @@ class Chef
27
27
  KEY = "_autogenerated_command_paths".freeze
28
28
 
29
29
  attr_accessor :manifest
30
+
30
31
  def initialize(chef_config_dir, plugin_manifest)
31
32
  super(chef_config_dir)
32
33
  @manifest = plugin_manifest
@@ -52,7 +53,7 @@ class Chef
52
53
  paths = manifest[KEY]["plugins_paths"][command]
53
54
  if paths && paths.is_a?(Array)
54
55
  # It is only an error if all the paths don't exist
55
- if paths.all? { |sc| !File.exists?(sc) }
56
+ if paths.all? { |sc| !File.exist?(sc) }
56
57
  errors[command] = paths
57
58
  end
58
59
  end
@@ -76,7 +77,7 @@ class Chef
76
77
  false
77
78
  else
78
79
  paths.each do |sc|
79
- if File.exists?(sc)
80
+ if File.exist?(sc)
80
81
  Kernel.load sc
81
82
  else
82
83
  return false