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.
- checksums.yaml +4 -4
- data/Gemfile +10 -10
- data/Rakefile +11 -17
- data/chef-universal-mingw32.gemspec +4 -4
- data/chef.gemspec +22 -4
- data/lib/chef/api_client/registration.rb +2 -2
- data/lib/chef/chef_fs/file_system/repository/base_file.rb +1 -0
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/repository/directory.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +1 -1
- data/lib/chef/deprecated.rb +4 -0
- data/lib/chef/environment.rb +2 -2
- data/lib/chef/exceptions.rb +3 -0
- data/lib/chef/http.rb +2 -1
- data/lib/chef/knife/bootstrap.rb +3 -3
- data/lib/chef/knife/bootstrap/train_connector.rb +1 -0
- data/lib/chef/knife/cookbook_download.rb +1 -1
- data/lib/chef/knife/cookbook_metadata.rb +1 -1
- data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
- data/lib/chef/knife/core/hashed_command_loader.rb +3 -2
- data/lib/chef/knife/core/subcommand_loader.rb +1 -1
- data/lib/chef/knife/exec.rb +2 -2
- data/lib/chef/knife/ssh.rb +20 -1
- data/lib/chef/log.rb +1 -1
- data/lib/chef/mixin/openssl_helper.rb +26 -3
- data/lib/chef/mixin/template.rb +1 -0
- data/lib/chef/node_map.rb +5 -2
- data/lib/chef/provider/mount/solaris.rb +0 -1
- data/lib/chef/provider/package/dnf/dnf_helper.py +5 -0
- data/lib/chef/provider/package/freebsd/pkgng.rb +3 -1
- data/lib/chef/provider/package/yum/yum_helper.py +4 -0
- data/lib/chef/provider/package/zypper.rb +0 -1
- data/lib/chef/provider/service/arch.rb +2 -2
- data/lib/chef/provider/service/debian.rb +1 -1
- data/lib/chef/provider/service/gentoo.rb +2 -2
- data/lib/chef/provider/service/macosx.rb +2 -2
- data/lib/chef/provider/service/openbsd.rb +1 -1
- data/lib/chef/provider/service/redhat.rb +2 -2
- data/lib/chef/provider/service/upstart.rb +1 -1
- data/lib/chef/provider/yum_repository.rb +1 -1
- data/lib/chef/provider/zypper_repository.rb +1 -1
- data/lib/chef/resource.rb +2 -0
- data/lib/chef/resource/cron_access.rb +2 -2
- data/lib/chef/resource/cron_d.rb +2 -1
- data/lib/chef/resource/homebrew_cask.rb +3 -3
- data/lib/chef/resource/hostname.rb +18 -18
- data/lib/chef/resource/locale.rb +1 -1
- data/lib/chef/resource/lwrp_base.rb +7 -0
- data/lib/chef/resource/ssh_known_hosts_entry.rb +1 -1
- data/lib/chef/resource/sudo.rb +2 -2
- data/lib/chef/resource/windows_feature_powershell.rb +6 -2
- data/lib/chef/resource/windows_font.rb +2 -1
- data/lib/chef/role.rb +2 -2
- data/lib/chef/shell.rb +32 -1
- data/lib/chef/shell/shell_session.rb +2 -0
- data/lib/chef/util/diff.rb +1 -1
- data/lib/chef/util/dsc/configuration_generator.rb +1 -1
- data/lib/chef/util/powershell/cmdlet.rb +1 -1
- data/lib/chef/version.rb +2 -2
- data/lib/chef/version_string.rb +1 -1
- data/lib/chef/win32/file.rb +2 -2
- data/spec/functional/knife/ssh_spec.rb +4 -4
- data/spec/functional/resource/aix_service_spec.rb +0 -1
- data/spec/functional/resource/aixinit_service_spec.rb +7 -8
- data/spec/functional/resource/apt_package_spec.rb +0 -1
- data/spec/functional/resource/bff_spec.rb +2 -2
- data/spec/functional/resource/cookbook_file_spec.rb +1 -1
- data/spec/functional/resource/cron_spec.rb +0 -1
- data/spec/functional/resource/dsc_resource_spec.rb +1 -1
- data/spec/functional/resource/insserv_spec.rb +4 -5
- data/spec/functional/resource/link_spec.rb +17 -17
- data/spec/functional/resource/rpm_spec.rb +2 -2
- data/spec/functional/resource/user/dscl_spec.rb +1 -1
- data/spec/functional/resource/user/mac_user_spec.rb +1 -1
- data/spec/functional/resource/windows_certificate_spec.rb +3 -3
- data/spec/functional/resource/windows_font_spec.rb +49 -0
- data/spec/functional/run_lock_spec.rb +2 -1
- data/spec/functional/shell_spec.rb +5 -5
- data/spec/functional/util/powershell/cmdlet_spec.rb +1 -1
- data/spec/functional/version_spec.rb +1 -1
- data/spec/functional/win32/service_manager_spec.rb +1 -1
- data/spec/integration/recipes/accumulator_spec.rb +1 -1
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +2 -2
- data/spec/integration/recipes/lwrp_spec.rb +1 -1
- data/spec/integration/recipes/notifies_spec.rb +1 -1
- data/spec/integration/recipes/notifying_block_spec.rb +1 -1
- data/spec/integration/recipes/recipe_dsl_spec.rb +1 -1
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +2 -0
- data/spec/integration/recipes/resource_load_spec.rb +1 -0
- data/spec/integration/recipes/unified_mode_spec.rb +1 -1
- data/spec/scripts/ssl-serve.rb +1 -1
- data/spec/spec_helper.rb +10 -8
- data/spec/support/platform_helpers.rb +12 -42
- data/spec/support/platforms/win32/spec_service.rb +1 -1
- data/spec/support/shared/functional/directory_resource.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +1 -1
- data/spec/support/shared/functional/file_resource.rb +2 -2
- data/spec/support/shared/functional/win32_service.rb +1 -1
- data/spec/support/shared/functional/windows_script.rb +3 -3
- data/spec/support/shared/integration/knife_support.rb +2 -5
- data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +2 -4
- data/spec/unit/cookbook/gem_installer_spec.rb +2 -1
- data/spec/unit/dsl/platform_introspection_spec.rb +1 -0
- data/spec/unit/environment_spec.rb +7 -7
- data/spec/unit/event_dispatch/dispatcher_spec.rb +3 -0
- data/spec/unit/knife/bootstrap_spec.rb +14 -14
- data/spec/unit/knife/cookbook_download_spec.rb +4 -4
- data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +1 -1
- data/spec/unit/knife/cookbook_upload_spec.rb +5 -6
- data/spec/unit/knife/core/hashed_command_loader_spec.rb +3 -3
- data/spec/unit/knife/ssh_spec.rb +2 -2
- data/spec/unit/knife/supermarket_share_spec.rb +5 -3
- data/spec/unit/lwrp_spec.rb +4 -4
- data/spec/unit/mixin/securable_spec.rb +0 -1
- data/spec/unit/property_spec.rb +5 -5
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +1 -1
- data/spec/unit/provider/package/freebsd/pkgng_spec.rb +1 -1
- data/spec/unit/provider/package/rubygems_spec.rb +5 -10
- data/spec/unit/provider/package/windows_spec.rb +30 -53
- data/spec/unit/provider/service/arch_service_spec.rb +3 -2
- data/spec/unit/provider/service/debian_service_spec.rb +1 -1
- data/spec/unit/provider/service/gentoo_service_spec.rb +7 -7
- data/spec/unit/provider/service/macosx_spec.rb +3 -3
- data/spec/unit/provider/service/redhat_spec.rb +2 -2
- data/spec/unit/provider/service/upstart_service_spec.rb +3 -3
- data/spec/unit/provider/service/windows_spec.rb +2 -6
- data/spec/unit/provider/systemd_unit_spec.rb +28 -24
- data/spec/unit/provider_spec.rb +1 -0
- data/spec/unit/resource/windows_feature_powershell_spec.rb +30 -4
- data/spec/unit/resource/windows_package_spec.rb +1 -0
- data/spec/unit/role_spec.rb +11 -11
- data/spec/unit/run_context/cookbook_compiler_spec.rb +1 -1
- data/spec/unit/win32/security_spec.rb +4 -3
- metadata +48 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 433887c470a68198fc4f67417c00262ce44efcb612649c47b1c51a4e0adf6a5d
|
4
|
+
data.tar.gz: fe6e207c5ddf1300b9a52290a93af3df27158642032eab244d93689dfe929991
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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("
|
13
|
-
gem "chef-config", path: File.expand_path("
|
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("
|
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("
|
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.
|
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.
|
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
|
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
|
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
|
-
|
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("
|
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.
|
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", "
|
18
|
-
gemspec.add_dependency "win32-certstore", "~> 0.
|
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", "
|
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", "<
|
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", "
|
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", "
|
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.
|
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.
|
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
|
@@ -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.
|
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.
|
135
|
+
File.exist?(uploaded_cookbook_version_path) || children.size > 0
|
136
136
|
end
|
137
137
|
|
138
138
|
protected
|
@@ -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.
|
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.
|
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
|
data/lib/chef/deprecated.rb
CHANGED
data/lib/chef/environment.rb
CHANGED
@@ -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.
|
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.
|
262
|
+
elsif File.exist?(rb_file)
|
263
263
|
environment = Chef::Environment.new
|
264
264
|
environment.name(name)
|
265
265
|
environment.from_file(rb_file)
|
data/lib/chef/exceptions.rb
CHANGED
@@ -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 "
|
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"
|
data/lib/chef/knife/bootstrap.rb
CHANGED
@@ -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.
|
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.
|
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!
|
@@ -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.
|
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.
|
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("
|
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.
|
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.
|
80
|
+
if File.exist?(sc)
|
80
81
|
Kernel.load sc
|
81
82
|
else
|
82
83
|
return false
|