chef 15.11.3-universal-mingw32 → 15.15.0-universal-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +7 -9
- data/README.md +3 -3
- data/chef-universal-mingw32.gemspec +2 -2
- data/chef.gemspec +12 -3
- data/distro/powershell/chef/chef.psm1 +3 -3
- data/distro/templates/powershell/chef/chef.psm1.erb +3 -3
- data/lib/chef/api_client/registration.rb +2 -2
- data/lib/chef/application/apply.rb +1 -1
- 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/chef_fs/path_utils.rb +3 -3
- data/lib/chef/cookbook/file_system_file_vendor.rb +1 -1
- data/lib/chef/data_bag.rb +2 -2
- data/lib/chef/data_collector/error_handlers.rb +1 -1
- data/lib/chef/deprecated.rb +12 -0
- data/lib/chef/dsl/declare_resource.rb +1 -1
- data/lib/chef/dsl/platform_introspection.rb +2 -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 +8 -10
- data/lib/chef/knife/bootstrap/templates/chef-full.erb +9 -9
- 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/cab.rb +1 -1
- data/lib/chef/provider/package/chocolatey.rb +1 -1
- data/lib/chef/provider/package/msu.rb +1 -0
- data/lib/chef/provider/package/powershell.rb +5 -1
- data/lib/chef/provider/package/snap.rb +96 -27
- 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 +31 -11
- data/lib/chef/resource.rb +2 -0
- data/lib/chef/resource/archive_file.rb +28 -8
- data/lib/chef/resource/cron_access.rb +13 -5
- data/lib/chef/resource/cron_d.rb +2 -1
- data/lib/chef/resource/homebrew_cask.rb +3 -3
- data/lib/chef/resource/hostname.rb +19 -18
- data/lib/chef/resource/locale.rb +1 -1
- data/lib/chef/resource/lwrp_base.rb +7 -0
- data/lib/chef/resource/msu_package.rb +5 -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 +1 -1
- data/lib/chef/shell/shell_session.rb +2 -0
- data/lib/chef/util/diff.rb +1 -1
- data/lib/chef/util/powershell/cmdlet.rb +1 -1
- data/lib/chef/version.rb +2 -2
- 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/msu_package_spec.rb +5 -2
- 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/resource/windows_task_spec.rb +8 -8
- 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 +26 -8
- data/spec/support/chef_helpers.rb +1 -1
- 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/application_spec.rb +7 -0
- 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/data_bag_spec.rb +1 -1
- data/spec/unit/data_collector_spec.rb +1 -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/file_access_control_spec.rb +1 -1
- data/spec/unit/json_compat_spec.rb +1 -1
- data/spec/unit/knife/bootstrap_spec.rb +16 -16
- 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 +1 -1
- data/spec/unit/lwrp_spec.rb +4 -4
- data/spec/unit/mixin/securable_spec.rb +0 -1
- data/spec/unit/mixin/user_context_spec.rb +1 -9
- data/spec/unit/property_spec.rb +6 -6
- data/spec/unit/provider/apt_repository_spec.rb +2 -2
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +1 -1
- data/spec/unit/provider/package/powershell_spec.rb +95 -86
- data/spec/unit/provider/package/rubygems_spec.rb +5 -10
- data/spec/unit/provider/package/snap_spec.rb +1 -1
- 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/zypper_repository_spec.rb +75 -25
- data/spec/unit/provider_spec.rb +1 -0
- data/spec/unit/resource/archive_file_spec.rb +11 -2
- data/spec/unit/resource/msu_package_spec.rb +4 -0
- data/spec/unit/resource/windows_dns_record_spec.rb +3 -3
- data/spec/unit/resource/windows_dns_zone_spec.rb +2 -2
- data/spec/unit/resource/windows_feature_powershell_spec.rb +30 -4
- data/spec/unit/resource/windows_package_spec.rb +1 -0
- data/spec/unit/resource/windows_task_spec.rb +1 -1
- data/spec/unit/resource/windows_uac_spec.rb +2 -2
- data/spec/unit/resource/yum_repository_spec.rb +21 -21
- data/spec/unit/resource_reporter_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +1 -1
- data/spec/unit/role_spec.rb +11 -11
- data/spec/unit/run_context/cookbook_compiler_spec.rb +1 -1
- data/spec/unit/run_lock_spec.rb +1 -1
- data/spec/unit/scan_access_control_spec.rb +1 -1
- data/spec/unit/util/threaded_job_queue_spec.rb +9 -0
- data/spec/unit/win32/security_spec.rb +4 -3
- data/tasks/rspec.rb +5 -13
- metadata +38 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3ed1c0dd69916ac09312344f7b95abb2d39f57e879fb1519ae0124be2404c5e
|
4
|
+
data.tar.gz: ee28504924ec8a8682ca9a48112ea9a5c00e619a19189512ab919a8ec891fd5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16bd70181dc355bc0f723e12ea78c173003d406ed277f571e6d58f30ac26b6c12b06c56deeb938cd5e0006a32040eebcb7a87bbde597f4cc349374e6a24d0d60
|
7
|
+
data.tar.gz: 6e4b67e78b219853051b242f63f9ec0698b0521559ada79c87a99273b8ee25e3a539c140d24fd290d4070ef402af6ce5a69a2a12b876e8df974489760c9ffa1b
|
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
|
@@ -22,8 +22,7 @@ end
|
|
22
22
|
|
23
23
|
gem "cheffish", "~> 14"
|
24
24
|
|
25
|
-
|
26
|
-
gem "chef-telemetry", "=1.0.3"
|
25
|
+
gem "chef-telemetry", ">=1.0.8" # 1.0.8 removes the http dep
|
27
26
|
|
28
27
|
group(:omnibus_package) do
|
29
28
|
gem "appbundler"
|
@@ -39,7 +38,7 @@ group(:omnibus_package, :pry) do
|
|
39
38
|
gem "pry"
|
40
39
|
gem "pry-byebug"
|
41
40
|
gem "pry-remote"
|
42
|
-
gem "pry-stack_explorer"
|
41
|
+
gem "pry-stack_explorer", "~> 0.4.0" # pin to allow Ruby 2.5
|
43
42
|
end
|
44
43
|
|
45
44
|
group(:docgen) do
|
@@ -72,8 +71,7 @@ group(:development, :test) do
|
|
72
71
|
end
|
73
72
|
|
74
73
|
group(:chefstyle) do
|
75
|
-
# for
|
76
|
-
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
|
77
75
|
end
|
78
76
|
|
79
77
|
instance_eval(ENV["GEMFILE_MOD"]) if ENV["GEMFILE_MOD"]
|
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
|
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-
|
49
|
+
Copyright 2008-2020, Chef Software, Inc.
|
50
50
|
|
51
51
|
```
|
52
52
|
Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -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
|
|
@@ -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", "
|
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}/**/*")
|
data/chef.gemspec
CHANGED
@@ -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", "<
|
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", "
|
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"
|
@@ -62,4 +62,13 @@ Gem::Specification.new do |s|
|
|
62
62
|
Dir.glob("{lib,spec}/**/*", File::FNM_DOTMATCH).reject { |f| File.directory?(f) } +
|
63
63
|
Dir.glob("*.gemspec") +
|
64
64
|
Dir.glob("tasks/rspec.rb")
|
65
|
+
|
66
|
+
s.metadata = {
|
67
|
+
"bug_tracker_uri" => "https://github.com/chef/chef/issues",
|
68
|
+
"changelog_uri" => "https://github.com/chef/chef/blob/master/CHANGELOG.md",
|
69
|
+
"documentation_uri" => "https://docs.chef.io/",
|
70
|
+
"homepage_uri" => "https://www.chef.io",
|
71
|
+
"mailing_list_uri" => "https://discourse.chef.io/",
|
72
|
+
"source_code_uri" => "https://github.com/chef/chef/",
|
73
|
+
}
|
65
74
|
end
|
@@ -358,7 +358,7 @@ function Run-RubyCommand($command, $argList) {
|
|
358
358
|
# When arguments come into this method, the standard PS rules for interpreting cmdlet arguments
|
359
359
|
# apply. When using & (call operator) and providing an array of arguments, powershell (verified
|
360
360
|
# on PS 4.0 on Windows Server 2012R2) will not evaluate them but (contrary to documentation),
|
361
|
-
# it will still marginally interpret them. The
|
361
|
+
# it will still marginally interpret them. The behavior of PS 5.0 seems to be different but
|
362
362
|
# ignore that for now. If any of the provided arguments has a space in it, powershell checks
|
363
363
|
# the first and last character to ensure that they are " characters (and that's all it checks).
|
364
364
|
# If they are not, it will blindly surround that argument with " characters. It won't do this
|
@@ -381,10 +381,10 @@ function Run-RubyCommand($command, $argList) {
|
|
381
381
|
# Command line:
|
382
382
|
# "C:\Program Files (x86)\PowerShell Community Extensions\Pscx3\Pscx\Apps\EchoArgs.exe" "foo '' bar "baz"" "foo '' bar "baz""
|
383
383
|
#
|
384
|
-
# $x = "abc'123'nospace`"
|
384
|
+
# $x = "abc'123'nospace`"lol`"!!!"
|
385
385
|
# & EchoArgs @($x, $x)
|
386
386
|
# Command line:
|
387
|
-
# "C:\Program Files (x86)\PowerShell Community Extensions\Pscx3\Pscx\Apps\EchoArgs.exe" abc'123'nospace"
|
387
|
+
# "C:\Program Files (x86)\PowerShell Community Extensions\Pscx3\Pscx\Apps\EchoArgs.exe" abc'123'nospace"lol"!!! abc'123'nospace"lol"!!!
|
388
388
|
#
|
389
389
|
# $x = "`"`"Look ma! Tonnes of spaces! 'foo' 'bar'`"`""
|
390
390
|
# & EchoArgs @($x, $x)
|
@@ -358,7 +358,7 @@ function Run-RubyCommand($command, $argList) {
|
|
358
358
|
# When arguments come into this method, the standard PS rules for interpreting cmdlet arguments
|
359
359
|
# apply. When using & (call operator) and providing an array of arguments, powershell (verified
|
360
360
|
# on PS 4.0 on Windows Server 2012R2) will not evaluate them but (contrary to documentation),
|
361
|
-
# it will still marginally interpret them. The
|
361
|
+
# it will still marginally interpret them. The behavior of PS 5.0 seems to be different but
|
362
362
|
# ignore that for now. If any of the provided arguments has a space in it, powershell checks
|
363
363
|
# the first and last character to ensure that they are " characters (and that's all it checks).
|
364
364
|
# If they are not, it will blindly surround that argument with " characters. It won't do this
|
@@ -381,10 +381,10 @@ function Run-RubyCommand($command, $argList) {
|
|
381
381
|
# Command line:
|
382
382
|
# "C:\Program Files (x86)\PowerShell Community Extensions\Pscx3\Pscx\Apps\EchoArgs.exe" "foo '' bar "baz"" "foo '' bar "baz""
|
383
383
|
#
|
384
|
-
# $x = "abc'123'nospace`"
|
384
|
+
# $x = "abc'123'nospace`"lol`"!!!"
|
385
385
|
# & EchoArgs @($x, $x)
|
386
386
|
# Command line:
|
387
|
-
# "C:\Program Files (x86)\PowerShell Community Extensions\Pscx3\Pscx\Apps\EchoArgs.exe" abc'123'nospace"
|
387
|
+
# "C:\Program Files (x86)\PowerShell Community Extensions\Pscx3\Pscx\Apps\EchoArgs.exe" abc'123'nospace"lol"!!! abc'123'nospace"lol"!!!
|
388
388
|
#
|
389
389
|
# $x = "`"`"Look ma! Tonnes of spaces! 'foo' 'bar'`"`""
|
390
390
|
# & EchoArgs @($x, $x)
|
@@ -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
|
@@ -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 /
|
75
|
-
# PathUtils.realest_path('/x/y/z') == '/
|
76
|
-
# PathUtils.realest_path('/x/*/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
|
-
#
|
30
|
+
# nonsensical.
|
31
31
|
class FileSystemFileVendor < FileVendor
|
32
32
|
|
33
33
|
attr_reader :cookbook_name
|
data/lib/chef/data_bag.rb
CHANGED
@@ -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}'
|
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}'
|
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
|
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
|
#
|
data/lib/chef/deprecated.rb
CHANGED
@@ -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/
|
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)
|
@@ -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
|
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!
|
@@ -597,11 +597,8 @@ class Chef
|
|
597
597
|
|
598
598
|
bootstrap_context.client_pem = client_builder.client_path
|
599
599
|
else
|
600
|
-
ui.
|
601
|
-
|
602
|
-
Delete your validation key in order to use your user credentials for client registration instead.
|
603
|
-
EOM
|
604
|
-
|
600
|
+
ui.warn "Performing legacy client registration with the validation key at #{Chef::Config[:validation_key]}..."
|
601
|
+
ui.warn "Remove the key file or remove the 'validation_key' configuration option from your config.rb (knife.rb) to use more secure user credentials for client registration."
|
605
602
|
end
|
606
603
|
end
|
607
604
|
|
@@ -619,7 +616,7 @@ class Chef
|
|
619
616
|
end
|
620
617
|
|
621
618
|
def connect!
|
622
|
-
ui.info("Connecting to #{ui.color(server_name, :bold)}")
|
619
|
+
ui.info("Connecting to #{ui.color(server_name, :bold)} using #{connection_protocol}")
|
623
620
|
opts ||= connection_opts.dup
|
624
621
|
do_connect(opts)
|
625
622
|
rescue Train::Error => e
|
@@ -1108,7 +1105,8 @@ class Chef
|
|
1108
1105
|
# These keys are available in Chef::Config, and are prefixed with the protocol name.
|
1109
1106
|
# For example, :user CLI option will map to :winrm_user and :ssh_user Chef::Config keys,
|
1110
1107
|
# based on the connection protocol in use.
|
1111
|
-
def knife_key_for_protocol(
|
1108
|
+
def knife_key_for_protocol(new_option, option = nil)
|
1109
|
+
option = new_option if option.nil? # hacky compat with both old Chef-15 style and new Chef-16 style API signature
|
1112
1110
|
"#{connection_protocol}_#{option}".to_sym
|
1113
1111
|
end
|
1114
1112
|
|