chef 15.10.12-universal-mingw32 → 15.14.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 +10 -10
- data/README.md +3 -3
- data/Rakefile +1 -1
- data/chef-universal-mingw32.gemspec +2 -2
- data/chef.gemspec +3 -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 +2 -2
- data/lib/chef/application/exit_code.rb +2 -2
- data/lib/chef/chef_fs/chef_fs_data_store.rb +3 -3
- data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/multiplexed_dir.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/cookbook_version.rb +4 -4
- data/lib/chef/data_bag.rb +2 -2
- data/lib/chef/data_collector/error_handlers.rb +1 -1
- data/lib/chef/deprecated.rb +13 -1
- data/lib/chef/dsl/declare_resource.rb +1 -1
- data/lib/chef/dsl/platform_introspection.rb +3 -1
- data/lib/chef/environment.rb +2 -2
- data/lib/chef/exceptions.rb +3 -0
- data/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +2 -2
- data/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +7 -7
- data/lib/chef/http.rb +2 -1
- data/lib/chef/knife.rb +26 -20
- data/lib/chef/knife/bootstrap.rb +30 -31
- data/lib/chef/knife/bootstrap/chef_vault_handler.rb +12 -8
- data/lib/chef/knife/bootstrap/client_builder.rb +23 -19
- data/lib/chef/knife/bootstrap/templates/chef-full.erb +9 -9
- data/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb +3 -1
- 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/cookbook_site_search.rb +1 -1
- data/lib/chef/knife/cookbook_site_show.rb +1 -1
- data/lib/chef/knife/cookbook_site_unshare.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/core/windows_bootstrap_context.rb +18 -3
- data/lib/chef/knife/exec.rb +2 -2
- data/lib/chef/knife/ssh.rb +21 -2
- data/lib/chef/log.rb +1 -1
- data/lib/chef/mixin/create_path.rb +8 -8
- data/lib/chef/mixin/openssl_helper.rb +26 -3
- data/lib/chef/mixin/template.rb +1 -0
- data/lib/chef/node/mixin/deep_merge_cache.rb +7 -7
- 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 +4 -3
- 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/simple.rb +3 -3
- data/lib/chef/provider/service/upstart.rb +1 -1
- data/lib/chef/provider/windows_task.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/build_essential.rb +1 -1
- data/lib/chef/resource/cron_access.rb +13 -5
- data/lib/chef/resource/cron_d.rb +1 -1
- data/lib/chef/resource/hostname.rb +19 -18
- data/lib/chef/resource/launchd.rb +4 -4
- data/lib/chef/resource/lwrp_base.rb +7 -0
- data/lib/chef/resource/macos_userdefaults.rb +3 -3
- 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_firewall_rule.rb +8 -4
- data/lib/chef/resource/windows_font.rb +2 -1
- data/lib/chef/resource/windows_share.rb +4 -4
- data/lib/chef/resource/windows_task.rb +13 -13
- data/lib/chef/resource_inspector.rb +4 -3
- 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/dsc/lcm_output_parser.rb +3 -3
- data/lib/chef/util/powershell/cmdlet.rb +1 -1
- data/lib/chef/version.rb +2 -2
- data/lib/chef/win32/api/command_line_helper.rb +89 -0
- data/lib/chef/win32/api/file.rb +18 -18
- data/lib/chef/win32/file.rb +3 -3
- data/lib/chef/win32/process.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/chocolatey_package_spec.rb +29 -0
- 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 +2 -2
- data/spec/functional/resource/user/mac_user_spec.rb +2 -2
- 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/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 -19
- 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 +3 -3
- 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 +26 -29
- 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/core/windows_bootstrap_context_spec.rb +6 -0
- data/spec/unit/knife/role_env_run_list_add_spec.rb +6 -6
- data/spec/unit/knife/role_env_run_list_clear_spec.rb +4 -4
- data/spec/unit/knife/role_env_run_list_remove_spec.rb +4 -4
- data/spec/unit/knife/role_env_run_list_replace_spec.rb +4 -4
- data/spec/unit/knife/role_env_run_list_set_spec.rb +4 -4
- data/spec/unit/knife/role_run_list_add_spec.rb +6 -6
- data/spec/unit/knife/role_run_list_clear_spec.rb +4 -4
- data/spec/unit/knife/role_run_list_remove_spec.rb +4 -4
- data/spec/unit/knife/role_run_list_replace_spec.rb +4 -4
- data/spec/unit/knife/role_run_list_set_spec.rb +4 -4
- 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/git_spec.rb +3 -3
- data/spec/unit/provider/osx_profile_spec.rb +2 -2
- data/spec/unit/provider/package/chocolatey_spec.rb +1 -1
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +1 -1
- data/spec/unit/provider/package/msu_spec.rb +3 -3
- 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 +8 -8
- 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_resolver_spec.rb +9 -9
- 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_context_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 +32 -18
@@ -185,50 +185,50 @@ if test "x$tmp_dir" != "x"; then
|
|
185
185
|
rm -r "$tmp_dir"
|
186
186
|
fi
|
187
187
|
|
188
|
-
mkdir -p
|
188
|
+
mkdir -p /etc/chef
|
189
189
|
|
190
190
|
<% if client_pem -%>
|
191
|
-
(umask 077 && (cat >
|
191
|
+
(umask 077 && (cat > /etc/chef/client.pem <<'EOP'
|
192
192
|
<%= ::File.read(::File.expand_path(client_pem)) %>
|
193
193
|
EOP
|
194
194
|
)) || exit 1
|
195
195
|
<% end -%>
|
196
196
|
|
197
197
|
<% if validation_key -%>
|
198
|
-
(umask 077 && (cat >
|
198
|
+
(umask 077 && (cat > /etc/chef/validation.pem <<'EOP'
|
199
199
|
<%= validation_key %>
|
200
200
|
EOP
|
201
201
|
)) || exit 1
|
202
202
|
<% end -%>
|
203
203
|
|
204
204
|
<% if encrypted_data_bag_secret -%>
|
205
|
-
(umask 077 && (cat >
|
205
|
+
(umask 077 && (cat > /etc/chef/encrypted_data_bag_secret <<'EOP'
|
206
206
|
<%= encrypted_data_bag_secret %>
|
207
207
|
EOP
|
208
208
|
)) || exit 1
|
209
209
|
<% end -%>
|
210
210
|
|
211
211
|
<% unless trusted_certs.empty? -%>
|
212
|
-
mkdir -p
|
212
|
+
mkdir -p /etc/chef/trusted_certs
|
213
213
|
<%= trusted_certs %>
|
214
214
|
<% end -%>
|
215
215
|
|
216
216
|
<%# Generate Ohai Hints -%>
|
217
217
|
<% unless @chef_config[:knife][:hints].nil? || @chef_config[:knife][:hints].empty? -%>
|
218
|
-
mkdir -p
|
218
|
+
mkdir -p /etc/chef/ohai/hints
|
219
219
|
|
220
220
|
<% @chef_config[:knife][:hints].each do |name, hash| -%>
|
221
|
-
cat >
|
221
|
+
cat > /etc/chef/ohai/hints/<%= name %>.json <<'EOP'
|
222
222
|
<%= Chef::JSONCompat.to_json(hash) %>
|
223
223
|
EOP
|
224
224
|
<% end -%>
|
225
225
|
<% end -%>
|
226
226
|
|
227
|
-
cat >
|
227
|
+
cat > /etc/chef/client.rb <<'EOP'
|
228
228
|
<%= config_content %>
|
229
229
|
EOP
|
230
230
|
|
231
|
-
cat >
|
231
|
+
cat > /etc/chef/first-boot.json <<'EOP'
|
232
232
|
<%= Chef::JSONCompat.to_json(first_boot) %>
|
233
233
|
EOP
|
234
234
|
|
@@ -202,10 +202,12 @@ If !ERRORLEVEL!==0 (
|
|
202
202
|
) else (
|
203
203
|
@echo Installation completed successfully
|
204
204
|
del /f /q "%CHEF_CLIENT_MSI_LOG_PATH%"
|
205
|
-
|
205
|
+
)
|
206
206
|
|
207
207
|
<% end %>
|
208
208
|
|
209
|
+
@rem This line is required to separate the key_create label from the "block boundary"
|
210
|
+
@rem Removing these lines will cause the error "The system cannot find the batch label specified - key_create"
|
209
211
|
:key_create
|
210
212
|
@endlocal
|
211
213
|
|
@@ -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)
|
@@ -24,7 +24,7 @@ class Chef
|
|
24
24
|
class Knife
|
25
25
|
class CookbookSiteSearch < Knife::SupermarketSearch
|
26
26
|
|
27
|
-
|
27
|
+
# Handle the subclassing (knife doesn't do this :()
|
28
28
|
dependency_loaders.concat(superclass.dependency_loaders)
|
29
29
|
|
30
30
|
banner "knife cookbook site search QUERY (options)"
|
@@ -24,7 +24,7 @@ class Chef
|
|
24
24
|
class Knife
|
25
25
|
class CookbookSiteShow < Knife::SupermarketShow
|
26
26
|
|
27
|
-
|
27
|
+
# Handle the subclassing (knife doesn't do this :()
|
28
28
|
dependency_loaders.concat(superclass.dependency_loaders)
|
29
29
|
|
30
30
|
banner "knife cookbook site show COOKBOOK [VERSION] (options)"
|
@@ -25,7 +25,7 @@ class Chef
|
|
25
25
|
class Knife
|
26
26
|
class CookbookSiteUnshare < Knife::SupermarketUnshare
|
27
27
|
|
28
|
-
|
28
|
+
# Handle the subclassing (knife doesn't do this :()
|
29
29
|
dependency_loaders.concat(superclass.dependency_loaders)
|
30
30
|
|
31
31
|
banner "knife cookbook site unshare COOKBOOK (options)"
|
@@ -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
|
@@ -125,7 +125,7 @@ class Chef
|
|
125
125
|
#
|
126
126
|
def find_subcommands_via_dirglob
|
127
127
|
# The "require paths" of the core knife subcommands bundled with chef
|
128
|
-
files = Dir[File.join(Chef::Util::PathHelper.escape_glob_dir(File.expand_path("
|
128
|
+
files = Dir[File.join(Chef::Util::PathHelper.escape_glob_dir(File.expand_path("../../knife", __dir__)), "*.rb")]
|
129
129
|
subcommand_files = {}
|
130
130
|
files.each do |knife_file|
|
131
131
|
rel_path = knife_file[/#{CHEF_ROOT}#{Regexp.escape(File::SEPARATOR)}(.*)\.rb/, 1]
|
@@ -39,6 +39,21 @@ class Chef
|
|
39
39
|
super(config, run_list, chef_config, secret)
|
40
40
|
end
|
41
41
|
|
42
|
+
# This is a duplicate of ChefConfig::PathHelper.cleanpath, however
|
43
|
+
# this presumes Windows so we can avoid changing the method definitions
|
44
|
+
# across Chef, ChefConfig, and ChefUtils for the circumstance where
|
45
|
+
# the methods are being run for a system other than the one Ruby is
|
46
|
+
# executing on.
|
47
|
+
#
|
48
|
+
# We only need to cleanpath the paths that we are passing to cmd.exe,
|
49
|
+
# anything written to a configuration file or passed as an argument
|
50
|
+
# will be interpreted by ruby later and do the right thing.
|
51
|
+
def cleanpath(path)
|
52
|
+
path = Pathname.new(path).cleanpath.to_s
|
53
|
+
path = path.gsub(File::SEPARATOR, '\\')
|
54
|
+
path
|
55
|
+
end
|
56
|
+
|
42
57
|
def validation_key
|
43
58
|
if File.exist?(File.expand_path(@chef_config[:validation_key]))
|
44
59
|
IO.read(File.expand_path(@chef_config[:validation_key]))
|
@@ -158,8 +173,8 @@ class Chef
|
|
158
173
|
|
159
174
|
def start_chef
|
160
175
|
bootstrap_environment_option = bootstrap_environment.nil? ? "" : " -E #{bootstrap_environment}"
|
161
|
-
start_chef = "SET \"PATH=%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;C:\\ruby\\bin;#{ChefConfig::Config.c_opscode_dir}
|
162
|
-
start_chef << "
|
176
|
+
start_chef = "SET \"PATH=%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;C:\\ruby\\bin;#{ChefConfig::Config.c_opscode_dir}\\bin;#{ChefConfig::Config.c_opscode_dir}\\embedded\\bin\;%PATH%\"\n"
|
177
|
+
start_chef << "#{Chef::Dist::CLIENT} -c #{ChefConfig::Config.etc_chef_dir(true)}/client.rb -j #{ChefConfig::Config.etc_chef_dir(true)}/first-boot.json#{bootstrap_environment_option}\n"
|
163
178
|
end
|
164
179
|
|
165
180
|
def win_wget
|
@@ -260,7 +275,7 @@ class Chef
|
|
260
275
|
end
|
261
276
|
|
262
277
|
def bootstrap_directory
|
263
|
-
ChefConfig::Config.etc_chef_dir(true)
|
278
|
+
cleanpath(ChefConfig::Config.etc_chef_dir(true))
|
264
279
|
end
|
265
280
|
|
266
281
|
def local_download_path
|
data/lib/chef/knife/exec.rb
CHANGED
@@ -76,7 +76,7 @@ class Chef::Knife::Exec < Chef::Knife
|
|
76
76
|
def find_script(x)
|
77
77
|
# Try to find a script. First try expanding the path given.
|
78
78
|
script = File.expand_path(x)
|
79
|
-
return script if File.
|
79
|
+
return script if File.exist?(script)
|
80
80
|
|
81
81
|
# Failing that, try searching the script path. If we can't find
|
82
82
|
# anything, fail gracefully.
|
@@ -86,7 +86,7 @@ class Chef::Knife::Exec < Chef::Knife
|
|
86
86
|
path = File.expand_path(path)
|
87
87
|
test = File.join(path, x)
|
88
88
|
Chef::Log.trace("Testing: #{test}")
|
89
|
-
if File.
|
89
|
+
if File.exist?(test)
|
90
90
|
script = test
|
91
91
|
Chef::Log.trace("Found: #{test}")
|
92
92
|
return script
|
data/lib/chef/knife/ssh.rb
CHANGED
@@ -298,6 +298,10 @@ class Chef
|
|
298
298
|
opts[:keepalive] = true
|
299
299
|
opts[:keepalive_interval] = ssh_config[:keepalive_interval]
|
300
300
|
end
|
301
|
+
# maintain support for legacy key types / ciphers / key exchange algorithms.
|
302
|
+
# most importantly this adds back support for DSS host keys
|
303
|
+
# See https://github.com/net-ssh/net-ssh/pull/709
|
304
|
+
opts[:append_all_supported_algorithms] = true
|
301
305
|
end
|
302
306
|
end
|
303
307
|
|
@@ -358,11 +362,21 @@ class Chef
|
|
358
362
|
subsession ||= session
|
359
363
|
command = fixup_sudo(command)
|
360
364
|
command.force_encoding("binary") if command.respond_to?(:force_encoding)
|
365
|
+
begin
|
366
|
+
open_session(subsession, command)
|
367
|
+
rescue => e
|
368
|
+
open_session(subsession, command, true)
|
369
|
+
end
|
370
|
+
end
|
371
|
+
|
372
|
+
def open_session(subsession, command, pty = false)
|
373
|
+
stderr = ""
|
374
|
+
exit_status = 0
|
361
375
|
subsession.open_channel do |chan|
|
362
376
|
if config[:on_error] && exit_status != 0
|
363
377
|
chan.close
|
364
378
|
else
|
365
|
-
chan.request_pty
|
379
|
+
chan.request_pty if pty
|
366
380
|
chan.exec command do |ch, success|
|
367
381
|
raise ArgumentError, "Cannot execute #{command}" unless success
|
368
382
|
|
@@ -373,6 +387,11 @@ class Chef
|
|
373
387
|
ichannel.send_data("#{get_password}\n")
|
374
388
|
end
|
375
389
|
end
|
390
|
+
|
391
|
+
ch.on_extended_data do |_, _type, data|
|
392
|
+
stderr += data
|
393
|
+
end
|
394
|
+
|
376
395
|
ch.on_request "exit-status" do |ichannel, data|
|
377
396
|
exit_status = [exit_status, data.read_long].max
|
378
397
|
end
|
@@ -547,7 +566,7 @@ class Chef
|
|
547
566
|
end
|
548
567
|
|
549
568
|
def get_stripped_unfrozen_value(value)
|
550
|
-
return nil
|
569
|
+
return nil unless value
|
551
570
|
|
552
571
|
value.strip
|
553
572
|
end
|
data/lib/chef/log.rb
CHANGED
@@ -47,7 +47,7 @@ class Chef
|
|
47
47
|
def self.caller_location
|
48
48
|
# Pick the first caller that is *not* part of the Chef gem, that's the
|
49
49
|
# thing the user wrote. Or failing that, the most recent caller.
|
50
|
-
chef_gem_path = File.expand_path("
|
50
|
+
chef_gem_path = File.expand_path("..", __dir__)
|
51
51
|
caller(0..20).find { |c| !c.start_with?(chef_gem_path) } || caller(0..1)[0]
|
52
52
|
end
|
53
53
|
|
@@ -53,14 +53,14 @@ class Chef
|
|
53
53
|
private
|
54
54
|
|
55
55
|
def create_dir(path)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
56
|
+
# When doing multithreaded downloads into the file cache, the following
|
57
|
+
# interleaving raises an error here:
|
58
|
+
#
|
59
|
+
# thread1 thread2
|
60
|
+
# File.directory?(create_path) <- false
|
61
|
+
# File.directory?(create_path) <- false
|
62
|
+
# Dir.mkdir(create_path)
|
63
|
+
# Dir.mkdir(create_path) <- raises Errno::EEXIST
|
64
64
|
Chef::Log.trace("Creating directory #{path}")
|
65
65
|
Dir.mkdir(path)
|
66
66
|
rescue Errno::EEXIST
|
@@ -282,7 +282,9 @@ class Chef
|
|
282
282
|
ef.issuer_certificate = info["issuer"]
|
283
283
|
end
|
284
284
|
ef.subject_certificate = cert
|
285
|
-
|
285
|
+
if openssl_config = __openssl_config
|
286
|
+
ef.config = openssl_config
|
287
|
+
end
|
286
288
|
|
287
289
|
cert.extensions = extension
|
288
290
|
cert.add_extension ef.create_extension("subjectKeyIdentifier", "hash")
|
@@ -313,7 +315,9 @@ class Chef
|
|
313
315
|
crl.last_update = Time.now
|
314
316
|
crl.next_update = Time.now + 3600 * 24 * info["validity"]
|
315
317
|
|
316
|
-
|
318
|
+
if openssl_config = __openssl_config
|
319
|
+
ef.config = openssl_config
|
320
|
+
end
|
317
321
|
ef.issuer_certificate = info["issuer"]
|
318
322
|
|
319
323
|
crl.add_extension ::OpenSSL::X509::Extension.new("crlNumber", ::OpenSSL::ASN1::Integer(1))
|
@@ -391,7 +395,9 @@ class Chef
|
|
391
395
|
crl.next_update = crl.last_update + 3600 * 24 * info["validity"]
|
392
396
|
|
393
397
|
ef = ::OpenSSL::X509::ExtensionFactory.new
|
394
|
-
|
398
|
+
if openssl_config = __openssl_config
|
399
|
+
ef.config = openssl_config
|
400
|
+
end
|
395
401
|
ef.issuer_certificate = info["issuer"]
|
396
402
|
|
397
403
|
crl.extensions = [ ::OpenSSL::X509::Extension.new("crlNumber",
|
@@ -422,6 +428,23 @@ class Chef
|
|
422
428
|
|
423
429
|
resp
|
424
430
|
end
|
431
|
+
|
432
|
+
private
|
433
|
+
|
434
|
+
def __openssl_config
|
435
|
+
path = if File.exist?(::OpenSSL::Config::DEFAULT_CONFIG_FILE)
|
436
|
+
OpenSSL::Config::DEFAULT_CONFIG_FILE
|
437
|
+
else
|
438
|
+
Dir[File.join(RbConfig::CONFIG["prefix"], "**", "openssl.cnf")].first
|
439
|
+
end
|
440
|
+
|
441
|
+
if File.exist?(path)
|
442
|
+
::OpenSSL::Config.load(path)
|
443
|
+
else
|
444
|
+
Chef::Log.warn("Couldn't find OpenSSL config file")
|
445
|
+
nil
|
446
|
+
end
|
447
|
+
end
|
425
448
|
end
|
426
449
|
end
|
427
450
|
end
|
data/lib/chef/mixin/template.rb
CHANGED
@@ -19,9 +19,9 @@ class Chef
|
|
19
19
|
class Node
|
20
20
|
module Mixin
|
21
21
|
module DeepMergeCache
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
# Cache of deep merged values by top-level key. This is a simple hash which has keys that are the
|
23
|
+
# top-level keys of the node object, and we save the computed deep-merge for that key here. There is
|
24
|
+
# no cache of subtrees.
|
25
25
|
attr_accessor :deep_merge_cache
|
26
26
|
|
27
27
|
def initialize
|
@@ -31,10 +31,10 @@ class Chef
|
|
31
31
|
@deep_merge_cache = {}
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
# Invalidate a key in the deep_merge_cache. If called with nil, or no arg, this will invalidate
|
35
|
+
# the entire deep_merge cache. In the case of the user doing node.default['foo']['bar']['baz']=
|
36
|
+
# that eventually results in a call to reset_cache('foo') here. A node.default=hash_thing call
|
37
|
+
# must invalidate the entire cache and re-deep-merge the entire node object.
|
38
38
|
def reset_cache(path = nil)
|
39
39
|
if path.nil?
|
40
40
|
deep_merge_cache.clear
|
data/lib/chef/node_map.rb
CHANGED
@@ -35,10 +35,13 @@
|
|
35
35
|
#
|
36
36
|
# XXX: confusingly, in the *_priority_map the :klass may be an array of Strings of class names
|
37
37
|
#
|
38
|
+
|
39
|
+
require_relative "dist"
|
40
|
+
|
38
41
|
class Chef
|
39
42
|
class NodeMap
|
40
43
|
COLLISION_WARNING = <<~EOH.gsub(/\s+/, " ").strip
|
41
|
-
%{type_caps} %{key}
|
44
|
+
%{type_caps} %{key} built into %{client_name} is being overridden by the %{type} from a cookbook. Please upgrade your cookbook
|
42
45
|
or remove the cookbook from your run_list.
|
43
46
|
EOH
|
44
47
|
|
@@ -84,7 +87,7 @@ class Chef
|
|
84
87
|
else
|
85
88
|
klass.superclass.to_s
|
86
89
|
end
|
87
|
-
Chef::Log.warn( COLLISION_WARNING % { type: type_of_thing, key: key, type_caps: type_of_thing.capitalize } )
|
90
|
+
Chef::Log.warn( COLLISION_WARNING % { type: type_of_thing, key: key, type_caps: type_of_thing.capitalize, client_name: Chef::Dist::PRODUCT } )
|
88
91
|
end
|
89
92
|
|
90
93
|
# The map is sorted in order of preference already; we just need to find
|