chef 12.18.31-universal-mingw32 → 12.19.33-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 +5 -4
- data/README.md +12 -13
- data/VERSION +1 -1
- data/acceptance/Gemfile +4 -4
- data/acceptance/Gemfile.lock +70 -69
- data/chef-universal-mingw32.gemspec +2 -3
- data/chef.gemspec +6 -6
- data/lib/chef/api_client.rb +8 -10
- data/lib/chef/api_client_v1.rb +9 -11
- data/lib/chef/application/apply.rb +8 -10
- data/lib/chef/application/client.rb +1 -1
- data/lib/chef/application/exit_code.rb +3 -5
- data/lib/chef/application/knife.rb +2 -2
- data/lib/chef/application/windows_service.rb +29 -30
- data/lib/chef/application/windows_service_manager.rb +1 -1
- data/lib/chef/audit/audit_event_proxy.rb +2 -2
- data/lib/chef/audit/control_group_data.rb +1 -1
- data/lib/chef/chef_class.rb +1 -0
- data/lib/chef/chef_fs/chef_fs_data_store.rb +5 -7
- data/lib/chef/chef_fs/command_line.rb +15 -16
- data/lib/chef/chef_fs/data_handler/client_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/container_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/environment_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/group_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/node_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/organization_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/role_data_handler.rb +1 -1
- data/lib/chef/chef_fs/data_handler/user_data_handler.rb +1 -1
- data/lib/chef/chef_fs/file_pattern.rb +2 -2
- data/lib/chef/chef_fs/file_system.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_dir.rb +5 -6
- data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +8 -10
- data/lib/chef/chef_fs/file_system/chef_server/data_bags_dir.rb +8 -10
- data/lib/chef/chef_fs/file_system/chef_server/nodes_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb +28 -30
- data/lib/chef/chef_fs/file_system/chef_server/policy_group_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb +27 -29
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb +18 -24
- data/lib/chef/chef_fs/file_system/memory/memory_file.rb +1 -1
- data/lib/chef/chef_fs/file_system/multiplexed_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +10 -12
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +9 -13
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -0
- data/lib/chef/chef_fs/file_system/repository/cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/nodes_dir.rb +3 -0
- data/lib/chef/chef_fs/parallelizer.rb +9 -11
- data/lib/chef/cookbook/cookbook_version_loader.rb +25 -31
- data/lib/chef/cookbook/metadata.rb +26 -26
- data/lib/chef/cookbook/syntax_check.rb +1 -1
- data/lib/chef/cookbook_version.rb +3 -3
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +3 -3
- data/lib/chef/data_collector.rb +3 -4
- data/lib/chef/decorator.rb +1 -1
- data/lib/chef/deprecated.rb +30 -0
- data/lib/chef/dsl/audit.rb +2 -2
- data/lib/chef/dsl/declare_resource.rb +1 -1
- data/lib/chef/dsl/platform_introspection.rb +29 -31
- data/lib/chef/dsl/reboot_pending.rb +1 -1
- data/lib/chef/dsl/resources.rb +6 -8
- data/lib/chef/encrypted_data_bag_item.rb +2 -2
- data/lib/chef/environment.rb +9 -11
- data/lib/chef/event_loggers/windows_eventlog.rb +1 -1
- data/lib/chef/exceptions.rb +4 -1
- data/lib/chef/file_access_control/unix.rb +14 -14
- data/lib/chef/file_access_control/windows.rb +1 -1
- data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +4 -5
- data/lib/chef/formatters/error_mapper.rb +6 -6
- data/lib/chef/http/api_versions.rb +50 -0
- data/lib/chef/http/validate_content_length.rb +2 -2
- data/lib/chef/json_compat.rb +6 -10
- data/lib/chef/key.rb +5 -5
- data/lib/chef/knife.rb +4 -4
- data/lib/chef/knife/cookbook_site_install.rb +2 -2
- data/lib/chef/knife/core/cookbook_scm_repo.rb +2 -2
- data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
- data/lib/chef/knife/core/status_presenter.rb +1 -1
- data/lib/chef/knife/core/ui.rb +19 -25
- data/lib/chef/knife/data_bag_secret_options.rb +1 -1
- data/lib/chef/knife/deps.rb +32 -34
- data/lib/chef/knife/help.rb +1 -1
- data/lib/chef/knife/list.rb +1 -1
- data/lib/chef/knife/search.rb +2 -2
- data/lib/chef/knife/ssh.rb +37 -27
- data/lib/chef/knife/ssl_check.rb +1 -1
- data/lib/chef/knife/user_delete.rb +1 -1
- data/lib/chef/mash.rb +1 -1
- data/lib/chef/mixin/command.rb +2 -2
- data/lib/chef/mixin/create_path.rb +3 -5
- data/lib/chef/mixin/from_file.rb +2 -2
- data/lib/chef/mixin/get_source_from_package.rb +2 -2
- data/lib/chef/mixin/notifying_block.rb +7 -9
- data/lib/chef/mixin/params_validate.rb +3 -3
- data/lib/chef/mixin/securable.rb +1 -1
- data/lib/chef/mixin/shell_out.rb +23 -3
- data/lib/chef/mixin/unformatter.rb +2 -2
- data/lib/chef/mixin/uris.rb +4 -6
- data/lib/chef/mixin/versioned_api.rb +69 -0
- data/lib/chef/mixin/which.rb +25 -8
- data/lib/chef/mixin/windows_architecture_helper.rb +2 -2
- data/lib/chef/mixin/xml_escape.rb +3 -5
- data/lib/chef/monkey_patches/webrick-utils.rb +1 -1
- data/lib/chef/node.rb +8 -8
- data/lib/chef/node/attribute.rb +4 -4
- data/lib/chef/node/common_api.rb +5 -7
- data/lib/chef/org.rb +10 -12
- data/lib/chef/platform/provider_mapping.rb +7 -7
- data/lib/chef/platform/query_helpers.rb +1 -1
- data/lib/chef/policy_builder/policyfile.rb +1 -0
- data/lib/chef/property.rb +31 -0
- data/lib/chef/provider/batch.rb +1 -1
- data/lib/chef/provider/breakpoint.rb +1 -1
- data/lib/chef/provider/cookbook_file.rb +3 -3
- data/lib/chef/provider/cron.rb +38 -38
- data/lib/chef/provider/deploy.rb +81 -81
- data/lib/chef/provider/deploy/revision.rb +3 -5
- data/lib/chef/provider/directory.rb +32 -32
- data/lib/chef/provider/dsc_resource.rb +22 -6
- data/lib/chef/provider/env.rb +28 -28
- data/lib/chef/provider/env/windows.rb +1 -1
- data/lib/chef/provider/erl_call.rb +13 -13
- data/lib/chef/provider/execute.rb +5 -2
- data/lib/chef/provider/file.rb +49 -51
- data/lib/chef/provider/git.rb +55 -55
- data/lib/chef/provider/http_request.rb +36 -36
- data/lib/chef/provider/launchd.rb +2 -2
- data/lib/chef/provider/link.rb +50 -50
- data/lib/chef/provider/log.rb +2 -2
- data/lib/chef/provider/mdadm.rb +25 -25
- data/lib/chef/provider/mount/aix.rb +2 -2
- data/lib/chef/provider/mount/mount.rb +2 -2
- data/lib/chef/provider/ohai.rb +1 -1
- data/lib/chef/provider/osx_profile.rb +23 -23
- data/lib/chef/provider/package.rb +74 -56
- data/lib/chef/provider/package/aix.rb +55 -52
- data/lib/chef/provider/package/apt.rb +15 -13
- data/lib/chef/provider/package/cab.rb +49 -20
- data/lib/chef/provider/package/chocolatey.rb +9 -10
- data/lib/chef/provider/package/dnf.rb +20 -18
- data/lib/chef/provider/package/dnf/dnf_helper.py +1 -1
- data/lib/chef/provider/package/dnf/python_helper.rb +63 -26
- data/lib/chef/provider/package/dnf/version.rb +1 -1
- data/lib/chef/provider/package/dpkg.rb +8 -9
- data/lib/chef/provider/package/easy_install.rb +22 -22
- data/lib/chef/provider/package/freebsd/base.rb +10 -10
- data/lib/chef/provider/package/freebsd/pkg.rb +15 -15
- data/lib/chef/provider/package/freebsd/pkgng.rb +13 -15
- data/lib/chef/provider/package/freebsd/port.rb +7 -7
- data/lib/chef/provider/package/homebrew.rb +11 -10
- data/lib/chef/provider/package/ips.rb +18 -23
- data/lib/chef/provider/package/macports.rb +23 -23
- data/lib/chef/provider/package/msu.rb +11 -11
- data/lib/chef/provider/package/openbsd.rb +25 -22
- data/lib/chef/provider/package/pacman.rb +16 -16
- data/lib/chef/provider/package/paludis.rb +26 -27
- data/lib/chef/provider/package/portage.rb +22 -22
- data/lib/chef/provider/package/powershell.rb +17 -17
- data/lib/chef/provider/package/rpm.rb +25 -25
- data/lib/chef/provider/package/rubygems.rb +60 -60
- data/lib/chef/provider/package/smartos.rb +16 -16
- data/lib/chef/provider/package/solaris.rb +44 -44
- data/lib/chef/provider/package/windows.rb +3 -3
- data/lib/chef/provider/package/windows/exe.rb +6 -6
- data/lib/chef/provider/package/windows/msi.rb +6 -6
- data/lib/chef/provider/package/yum.rb +318 -268
- data/lib/chef/provider/package/yum/rpm_utils.rb +34 -34
- data/lib/chef/provider/package/yum/yum_cache.rb +12 -12
- data/lib/chef/provider/package/zypper.rb +11 -11
- data/lib/chef/provider/powershell_script.rb +15 -7
- data/lib/chef/provider/reboot.rb +10 -10
- data/lib/chef/provider/registry_key.rb +39 -39
- data/lib/chef/provider/remote_directory.rb +3 -3
- data/lib/chef/provider/remote_file.rb +3 -3
- data/lib/chef/provider/route.rb +1 -1
- data/lib/chef/provider/ruby_block.rb +3 -3
- data/lib/chef/provider/script.rb +42 -6
- data/lib/chef/provider/service.rb +49 -49
- data/lib/chef/provider/service/solaris.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +1 -1
- data/lib/chef/provider/subversion.rb +39 -39
- data/lib/chef/provider/systemd_unit.rb +2 -0
- data/lib/chef/provider/template.rb +3 -3
- data/lib/chef/provider/user.rb +42 -42
- data/lib/chef/provider/whyrun_safe_ruby_block.rb +4 -4
- data/lib/chef/resource.rb +27 -16
- data/lib/chef/resource/apt_repository.rb +0 -1
- data/lib/chef/resource/chef_gem.rb +1 -1
- data/lib/chef/resource/dnf_package.rb +6 -3
- data/lib/chef/resource/dsc_resource.rb +9 -1
- data/lib/chef/resource/execute.rb +70 -6
- data/lib/chef/resource/file/verification/systemd_unit.rb +67 -0
- data/lib/chef/resource/freebsd_package.rb +1 -1
- data/lib/chef/resource/gem_package.rb +1 -1
- data/lib/chef/resource/launchd.rb +13 -1
- data/lib/chef/resource/package.rb +2 -2
- data/lib/chef/resource/registry_key.rb +1 -1
- data/lib/chef/resource/yum_package.rb +12 -3
- data/lib/chef/resource/yum_repository.rb +0 -1
- data/lib/chef/resource_collection/resource_collection_serialization.rb +3 -3
- data/lib/chef/resource_collection/resource_set.rb +2 -2
- data/lib/chef/resource_reporter.rb +1 -1
- data/lib/chef/run_context.rb +3 -3
- data/lib/chef/run_list/run_list_item.rb +1 -1
- data/lib/chef/run_list/versioned_recipe_list.rb +6 -6
- data/lib/chef/server_api.rb +2 -0
- data/lib/chef/server_api_versions.rb +40 -0
- data/lib/chef/shell.rb +1 -1
- data/lib/chef/shell/ext.rb +3 -3
- data/lib/chef/shell/shell_session.rb +1 -1
- data/lib/chef/user.rb +9 -11
- data/lib/chef/user_v1.rb +9 -11
- data/lib/chef/util/diff.rb +1 -1
- data/lib/chef/util/dsc/lcm_output_parser.rb +1 -1
- data/lib/chef/util/selinux.rb +1 -1
- data/lib/chef/util/windows/net_group.rb +18 -30
- data/lib/chef/util/windows/net_use.rb +7 -11
- data/lib/chef/util/windows/net_user.rb +11 -17
- data/lib/chef/util/windows/volume.rb +9 -15
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version_class.rb +1 -1
- data/lib/chef/win32/api.rb +4 -6
- data/lib/chef/win32/api/file.rb +25 -31
- data/lib/chef/win32/api/installer.rb +2 -2
- data/lib/chef/win32/file.rb +4 -6
- data/lib/chef/win32/registry.rb +9 -9
- data/lib/chef/win32/security.rb +2 -2
- data/lib/chef/win32/security/acl.rb +2 -2
- data/lib/chef/win32/unicode.rb +2 -2
- data/lib/chef/win32/version.rb +1 -1
- data/spec/data/prefer_metadata_json/metadata.json +51 -0
- data/spec/data/prefer_metadata_json/metadata.rb +6 -0
- data/spec/data/prefer_metadata_json/recipes/default.rb +0 -0
- data/spec/functional/knife/ssh_spec.rb +5 -5
- data/spec/functional/resource/batch_spec.rb +5 -1
- data/spec/functional/resource/dsc_script_spec.rb +2 -4
- data/spec/functional/resource/execute_spec.rb +17 -0
- data/spec/functional/resource/user/dscl_spec.rb +2 -4
- data/spec/integration/client/client_spec.rb +33 -0
- data/spec/integration/recipes/recipe_dsl_spec.rb +58 -58
- data/spec/spec_helper.rb +4 -0
- data/spec/support/chef_helpers.rb +5 -7
- data/spec/support/platform_helpers.rb +6 -0
- data/spec/support/platforms/prof/gc.rb +4 -6
- data/spec/support/shared/context/client.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +150 -0
- data/spec/support/shared/functional/windows_script.rb +74 -4
- data/spec/support/shared/unit/execute_resource.rb +37 -0
- data/spec/support/shared/unit/provider/file.rb +10 -0
- data/spec/unit/cookbook/cookbook_version_loader_spec.rb +9 -0
- data/spec/unit/cookbook/syntax_check_spec.rb +8 -2
- data/spec/unit/http/api_versions_spec.rb +69 -0
- data/spec/unit/knife/ssh_spec.rb +34 -36
- data/spec/unit/mixin/versioned_api_spec.rb +107 -0
- data/spec/unit/mixin/which.rb +160 -0
- data/spec/unit/platform_spec.rb +28 -1
- data/spec/unit/provider/deploy_spec.rb +1 -1
- data/spec/unit/provider/directory_spec.rb +10 -0
- data/spec/unit/provider/dsc_resource_spec.rb +175 -0
- data/spec/unit/provider/execute_spec.rb +0 -1
- data/spec/unit/provider/launchd_spec.rb +2 -2
- data/spec/unit/provider/package/aix_spec.rb +22 -22
- data/spec/unit/provider/package/apt_spec.rb +27 -27
- data/spec/unit/provider/package/cab_spec.rb +59 -5
- data/spec/unit/provider/package/dnf/python_helper_spec.rb +29 -0
- data/spec/unit/provider/package/dpkg_spec.rb +16 -16
- data/spec/unit/provider/package/easy_install_spec.rb +18 -18
- data/spec/unit/provider/package/freebsd/pkg_spec.rb +15 -15
- data/spec/unit/provider/package/freebsd/pkgng_spec.rb +9 -9
- data/spec/unit/provider/package/freebsd/port_spec.rb +9 -9
- data/spec/unit/provider/package/homebrew_spec.rb +9 -9
- data/spec/unit/provider/package/ips_spec.rb +37 -31
- data/spec/unit/provider/package/macports_spec.rb +10 -10
- data/spec/unit/provider/package/openbsd_spec.rb +10 -10
- data/spec/unit/provider/package/pacman_spec.rb +6 -6
- data/spec/unit/provider/package/paludis_spec.rb +7 -7
- data/spec/unit/provider/package/portage_spec.rb +6 -7
- data/spec/unit/provider/package/rpm_spec.rb +23 -23
- data/spec/unit/provider/package/rubygems_spec.rb +38 -38
- data/spec/unit/provider/package/solaris_spec.rb +15 -15
- data/spec/unit/provider/package/windows_spec.rb +2 -1
- data/spec/unit/provider/package/yum_spec.rb +51 -43
- data/spec/unit/provider/package/zypper_spec.rb +34 -34
- data/spec/unit/provider/package_spec.rb +8 -0
- data/spec/unit/provider/remote_file/sftp_spec.rb +3 -3
- data/spec/unit/provider/route_spec.rb +7 -1
- data/spec/unit/provider/script_spec.rb +49 -6
- data/spec/unit/resource/dsc_resource_spec.rb +6 -0
- data/spec/unit/resource/execute_spec.rb +214 -0
- data/spec/unit/resource/file/verification/systemd_unit_spec.rb +103 -0
- data/spec/unit/resource/freebsd_package_spec.rb +2 -2
- data/spec/unit/resource/package_spec.rb +5 -0
- data/spec/unit/resource/yum_package_spec.rb +42 -1
- data/spec/unit/resource_reporter_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +18 -0
- data/spec/unit/server_api_versions_spec.rb +44 -0
- data/spec/unit/util/selinux_spec.rb +3 -14
- data/spec/unit/win32/error_spec.rb +67 -0
- data/spec/unit/win32/security_spec.rb +66 -0
- data/tasks/changelog.rb +1 -1
- data/tasks/dependencies.rb +20 -4
- metadata +39 -18
- data/lib/chef/monkey_patches/net-ssh-multi.rb +0 -141
@@ -30,27 +30,21 @@ class Chef::Util::Windows::Volume < Chef::Util::Windows
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def device
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
raise ArgumentError, e
|
37
|
-
end
|
33
|
+
Chef::ReservedNames::Win32::File.get_volume_name_for_volume_mount_point(mount_point)
|
34
|
+
rescue Chef::Exceptions::Win32APIError => e
|
35
|
+
raise ArgumentError, e
|
38
36
|
end
|
39
37
|
|
40
38
|
def delete
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
raise ArgumentError, e
|
45
|
-
end
|
39
|
+
Chef::ReservedNames::Win32::File.delete_volume_mount_point(mount_point)
|
40
|
+
rescue Chef::Exceptions::Win32APIError => e
|
41
|
+
raise ArgumentError, e
|
46
42
|
end
|
47
43
|
|
48
44
|
def add(args)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
raise ArgumentError, e
|
53
|
-
end
|
45
|
+
Chef::ReservedNames::Win32::File.set_volume_mount_point(mount_point, args[:remote])
|
46
|
+
rescue Chef::Exceptions::Win32APIError => e
|
47
|
+
raise ArgumentError, e
|
54
48
|
end
|
55
49
|
|
56
50
|
def mount_point
|
data/lib/chef/version.rb
CHANGED
data/lib/chef/version_class.rb
CHANGED
@@ -34,7 +34,7 @@ class Chef
|
|
34
34
|
|
35
35
|
def <=>(other)
|
36
36
|
[:major, :minor, :patch].each do |method|
|
37
|
-
version =
|
37
|
+
version = send(method)
|
38
38
|
begin
|
39
39
|
ans = (version <=> other.send(method))
|
40
40
|
rescue NoMethodError # if the other thing isn't a version object, return nil
|
data/lib/chef/win32/api.rb
CHANGED
@@ -29,12 +29,10 @@ class Chef
|
|
29
29
|
# function into the calling module. If this fails a dummy method is
|
30
30
|
# defined which when called, raises a helpful exception to the end-user.
|
31
31
|
def safe_attach_function(win32_func, *args)
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
raise Chef::Exceptions::Win32APIFunctionNotImplemented, "This version of Windows does not implement the Win32 function [#{win32_func}]."
|
37
|
-
end
|
32
|
+
attach_function(win32_func.to_sym, *args)
|
33
|
+
rescue FFI::NotFoundError
|
34
|
+
define_method(win32_func.to_sym) do |*margs|
|
35
|
+
raise Chef::Exceptions::Win32APIFunctionNotImplemented, "This version of Windows does not implement the Win32 function [#{win32_func}]."
|
38
36
|
end
|
39
37
|
end
|
40
38
|
|
data/lib/chef/win32/api/file.rb
CHANGED
@@ -537,24 +537,22 @@ BOOL WINAPI VerQueryValue(
|
|
537
537
|
# ensures the handle is closed on exit of the block
|
538
538
|
# FIXME: yard with @yield
|
539
539
|
def file_search_handle(path)
|
540
|
-
begin
|
541
540
|
# Workaround for CHEF-4419:
|
542
541
|
# Make sure paths starting with "/" has a drive letter
|
543
542
|
# assigned from the current working diretory.
|
544
543
|
# Note: With CHEF-4427 this issue will be fixed with a
|
545
544
|
# broader fix to map all the paths starting with "/" to
|
546
545
|
# SYSTEM_DRIVE on windows.
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
end
|
554
|
-
yield(handle, find_data)
|
555
|
-
ensure
|
556
|
-
FindClose(handle) if handle && handle != INVALID_HANDLE_VALUE
|
546
|
+
path = ::File.expand_path(path) if path.start_with? "/"
|
547
|
+
path = canonical_encode_path(path)
|
548
|
+
find_data = WIN32_FIND_DATA.new
|
549
|
+
handle = FindFirstFileW(path, find_data)
|
550
|
+
if handle == INVALID_HANDLE_VALUE
|
551
|
+
Chef::ReservedNames::Win32::Error.raise!
|
557
552
|
end
|
553
|
+
yield(handle, find_data)
|
554
|
+
ensure
|
555
|
+
FindClose(handle) if handle && handle != INVALID_HANDLE_VALUE
|
558
556
|
end
|
559
557
|
|
560
558
|
# retrieves a file handle and passes it
|
@@ -562,34 +560,30 @@ BOOL WINAPI VerQueryValue(
|
|
562
560
|
# ensures the handle is closed on exit of the block
|
563
561
|
# FIXME: yard with @yield
|
564
562
|
def file_handle(path)
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, nil)
|
563
|
+
path = canonical_encode_path(path)
|
564
|
+
handle = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ,
|
565
|
+
nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, nil)
|
569
566
|
|
570
|
-
|
571
|
-
|
572
|
-
end
|
573
|
-
yield(handle)
|
574
|
-
ensure
|
575
|
-
CloseHandle(handle) if handle && handle != INVALID_HANDLE_VALUE
|
567
|
+
if handle == INVALID_HANDLE_VALUE
|
568
|
+
Chef::ReservedNames::Win32::Error.raise!
|
576
569
|
end
|
570
|
+
yield(handle)
|
571
|
+
ensure
|
572
|
+
CloseHandle(handle) if handle && handle != INVALID_HANDLE_VALUE
|
577
573
|
end
|
578
574
|
|
579
575
|
# FIXME: yard with @yield
|
580
576
|
def symlink_file_handle(path)
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
nil, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, nil)
|
577
|
+
path = encode_path(path)
|
578
|
+
handle = CreateFileW(path, FILE_READ_EA, FILE_SHARE_READ,
|
579
|
+
nil, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, nil)
|
585
580
|
|
586
|
-
|
587
|
-
|
588
|
-
end
|
589
|
-
yield(handle)
|
590
|
-
ensure
|
591
|
-
CloseHandle(handle) if handle && handle != INVALID_HANDLE_VALUE
|
581
|
+
if handle == INVALID_HANDLE_VALUE
|
582
|
+
Chef::ReservedNames::Win32::Error.raise!
|
592
583
|
end
|
584
|
+
yield(handle)
|
585
|
+
ensure
|
586
|
+
CloseHandle(handle) if handle && handle != INVALID_HANDLE_VALUE
|
593
587
|
end
|
594
588
|
|
595
589
|
def retrieve_file_info(file_name)
|
@@ -107,7 +107,7 @@ UINT MsiCloseHandle(
|
|
107
107
|
end
|
108
108
|
|
109
109
|
msi_close_handle(pkg_ptr.read_pointer)
|
110
|
-
|
110
|
+
buffer.chomp(0.chr)
|
111
111
|
end
|
112
112
|
|
113
113
|
# Opens a Microsoft Installer (MSI) file from an absolute path and returns a pointer to a handle
|
@@ -124,7 +124,7 @@ UINT MsiCloseHandle(
|
|
124
124
|
else
|
125
125
|
raise Chef::Exceptions::Package, "msi_open_package: unexpected status #{status}: #{Chef::ReservedNames::Win32::Error.format_message(status)}"
|
126
126
|
end
|
127
|
-
|
127
|
+
pkg_ptr
|
128
128
|
end
|
129
129
|
|
130
130
|
# All installed product_codes should have a VersionString
|
data/lib/chef/win32/file.rb
CHANGED
@@ -155,13 +155,11 @@ class Chef
|
|
155
155
|
end
|
156
156
|
|
157
157
|
def self.verify_links_supported!
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
rescue Exception
|
158
|
+
CreateSymbolicLinkW(nil)
|
159
|
+
rescue Chef::Exceptions::Win32APIFunctionNotImplemented => e
|
160
|
+
raise e
|
161
|
+
rescue Exception
|
163
162
|
# things are ok.
|
164
|
-
end
|
165
163
|
end
|
166
164
|
|
167
165
|
def self.file_access_check(path, desired_access)
|
data/lib/chef/win32/registry.rb
CHANGED
@@ -170,7 +170,7 @@ class Chef
|
|
170
170
|
rescue Chef::Exceptions::Win32RegHiveMissing => e
|
171
171
|
return false
|
172
172
|
end
|
173
|
-
|
173
|
+
true
|
174
174
|
end
|
175
175
|
|
176
176
|
def has_subkeys?(key_path)
|
@@ -179,7 +179,7 @@ class Chef
|
|
179
179
|
hive.open(key, ::Win32::Registry::KEY_READ | registry_system_architecture) do |reg|
|
180
180
|
reg.each_key { |key| return true }
|
181
181
|
end
|
182
|
-
|
182
|
+
false
|
183
183
|
end
|
184
184
|
|
185
185
|
def get_subkeys(key_path)
|
@@ -189,7 +189,7 @@ class Chef
|
|
189
189
|
hive.open(key, ::Win32::Registry::KEY_READ | registry_system_architecture) do |reg|
|
190
190
|
reg.each_key { |current_key| subkeys << current_key }
|
191
191
|
end
|
192
|
-
|
192
|
+
subkeys
|
193
193
|
end
|
194
194
|
|
195
195
|
# 32-bit chef clients running on 64-bit machines will default to reading the 64-bit registry
|
@@ -204,7 +204,7 @@ class Chef
|
|
204
204
|
hive.open(key, ::Win32::Registry::KEY_READ | registry_system_architecture) do |reg|
|
205
205
|
return true if reg.any? { |val| safely_downcase(val) == safely_downcase(value[:name]) }
|
206
206
|
end
|
207
|
-
|
207
|
+
false
|
208
208
|
end
|
209
209
|
|
210
210
|
def data_exists?(key_path, value)
|
@@ -219,7 +219,7 @@ class Chef
|
|
219
219
|
end
|
220
220
|
end
|
221
221
|
end
|
222
|
-
|
222
|
+
false
|
223
223
|
end
|
224
224
|
|
225
225
|
def value_exists!(key_path, value)
|
@@ -249,7 +249,7 @@ class Chef
|
|
249
249
|
end
|
250
250
|
end
|
251
251
|
end
|
252
|
-
|
252
|
+
false
|
253
253
|
end
|
254
254
|
|
255
255
|
def type_matches!(key_path, value)
|
@@ -279,7 +279,7 @@ class Chef
|
|
279
279
|
if val.is_a? String
|
280
280
|
return val.downcase
|
281
281
|
end
|
282
|
-
|
282
|
+
val
|
283
283
|
end
|
284
284
|
|
285
285
|
def node
|
@@ -316,7 +316,7 @@ class Chef
|
|
316
316
|
|
317
317
|
raise Chef::Exceptions::Win32RegHiveMissing, "Registry Hive #{hive_name} does not exist" unless hive
|
318
318
|
|
319
|
-
|
319
|
+
[hive, key]
|
320
320
|
end
|
321
321
|
|
322
322
|
def _type_name_map
|
@@ -345,7 +345,7 @@ class Chef
|
|
345
345
|
5 => ::Win32::Registry::REG_DWORD_BIG_ENDIAN,
|
346
346
|
11 => ::Win32::Registry::REG_QWORD,
|
347
347
|
}[val_type]
|
348
|
-
|
348
|
+
value
|
349
349
|
end
|
350
350
|
|
351
351
|
def create_missing(key_path)
|
data/lib/chef/win32/security.rb
CHANGED
@@ -239,7 +239,7 @@ class Chef
|
|
239
239
|
security_descriptor = FFI::MemoryPointer.new :pointer
|
240
240
|
hr = GetNamedSecurityInfoW(path.to_wstring, type, info, nil, nil, nil, nil, security_descriptor)
|
241
241
|
if hr != ERROR_SUCCESS
|
242
|
-
Chef::ReservedNames::Win32::Error.raise!("get_named_security_info(#{path}, #{type}, #{info})")
|
242
|
+
Chef::ReservedNames::Win32::Error.raise!("get_named_security_info(#{path}, #{type}, #{info})", hr)
|
243
243
|
end
|
244
244
|
|
245
245
|
result_pointer = security_descriptor.read_pointer
|
@@ -538,7 +538,7 @@ class Chef
|
|
538
538
|
|
539
539
|
hr = SetNamedSecurityInfoW(path.to_wstring, type, security_information, owner, group, dacl, sacl)
|
540
540
|
if hr != ERROR_SUCCESS
|
541
|
-
Chef::ReservedNames::Win32::Error.raise!
|
541
|
+
Chef::ReservedNames::Win32::Error.raise! nil, hr
|
542
542
|
end
|
543
543
|
end
|
544
544
|
|
@@ -48,7 +48,7 @@ class Chef
|
|
48
48
|
0.upto(length - 1) do |i|
|
49
49
|
return false if self[i] != other[i]
|
50
50
|
end
|
51
|
-
|
51
|
+
true
|
52
52
|
end
|
53
53
|
|
54
54
|
def pointer
|
@@ -88,7 +88,7 @@ class Chef
|
|
88
88
|
end
|
89
89
|
|
90
90
|
def to_s
|
91
|
-
"[#{
|
91
|
+
"[#{collect { |ace| ace.to_s }.join(", ")}]"
|
92
92
|
end
|
93
93
|
|
94
94
|
def self.align_dword(size)
|
data/lib/chef/win32/unicode.rb
CHANGED
@@ -40,13 +40,13 @@ module FFI
|
|
40
40
|
last_char = nil
|
41
41
|
while last_char != "\000\000"
|
42
42
|
length += 1
|
43
|
-
last_char =
|
43
|
+
last_char = get_bytes(0, length * 2)[-2..-1]
|
44
44
|
end
|
45
45
|
|
46
46
|
num_wchars = length
|
47
47
|
end
|
48
48
|
|
49
|
-
wide_to_utf8(
|
49
|
+
wide_to_utf8(get_bytes(0, num_wchars * 2))
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
data/lib/chef/win32/version.rb
CHANGED
@@ -0,0 +1,51 @@
|
|
1
|
+
{
|
2
|
+
"name": "prefer_metadata_json",
|
3
|
+
"description": "",
|
4
|
+
"long_description": "",
|
5
|
+
"maintainer": null,
|
6
|
+
"maintainer_email": null,
|
7
|
+
"license": "All rights reserved",
|
8
|
+
"platforms": {
|
9
|
+
|
10
|
+
},
|
11
|
+
"dependencies": {
|
12
|
+
|
13
|
+
},
|
14
|
+
"recommendations": {
|
15
|
+
|
16
|
+
},
|
17
|
+
"suggestions": {
|
18
|
+
|
19
|
+
},
|
20
|
+
"conflicting": {
|
21
|
+
|
22
|
+
},
|
23
|
+
"providing": {
|
24
|
+
|
25
|
+
},
|
26
|
+
"replacing": {
|
27
|
+
|
28
|
+
},
|
29
|
+
"attributes": {
|
30
|
+
|
31
|
+
},
|
32
|
+
"groupings": {
|
33
|
+
|
34
|
+
},
|
35
|
+
"recipes": {
|
36
|
+
|
37
|
+
},
|
38
|
+
"version": "1.2.3",
|
39
|
+
"source_url": "",
|
40
|
+
"issues_url": "",
|
41
|
+
"privacy": false,
|
42
|
+
"chef_versions": [
|
43
|
+
|
44
|
+
],
|
45
|
+
"ohai_versions": [
|
46
|
+
|
47
|
+
],
|
48
|
+
"gems": [
|
49
|
+
|
50
|
+
]
|
51
|
+
}
|
File without changes
|
@@ -181,7 +181,7 @@ describe Chef::Knife::Ssh do
|
|
181
181
|
|
182
182
|
it "uses the ssh_attribute" do
|
183
183
|
@knife.run
|
184
|
-
expect(@knife.get_ssh_attribute(
|
184
|
+
expect(@knife.get_ssh_attribute({ "knife_config" => "ec2.public_hostname" })).to eq("ec2.public_hostname")
|
185
185
|
end
|
186
186
|
end
|
187
187
|
|
@@ -193,11 +193,11 @@ describe Chef::Knife::Ssh do
|
|
193
193
|
|
194
194
|
it "uses the default" do
|
195
195
|
@knife.run
|
196
|
-
expect(@knife.get_ssh_attribute(
|
196
|
+
expect(@knife.get_ssh_attribute({ "fqdn" => "fqdn" })).to eq("fqdn")
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
|
-
context "when -a ec2.
|
200
|
+
context "when -a ec2.public_public_hostname is provided" do
|
201
201
|
before do
|
202
202
|
setup_knife(["-a ec2.public_hostname", "*:*", "uptime"])
|
203
203
|
Chef::Config[:knife][:ssh_attribute] = nil
|
@@ -276,8 +276,8 @@ describe Chef::Knife::Ssh do
|
|
276
276
|
Chef::Config[:client_key] = nil
|
277
277
|
Chef::Config[:chef_server_url] = "http://localhost:9000"
|
278
278
|
|
279
|
-
@api.
|
280
|
-
%({"total":1, "start":0, "rows":[{"
|
279
|
+
@api.post("/search/node?q=*:*&sort=X_CHEF_id_CHEF_X%20asc&start=0", 200) do
|
280
|
+
%({"total":1, "start":0, "rows":[{"data": {"fqdn":"the.fqdn", "config": "the_public_hostname", "knife_config": "the_public_hostname" }}]})
|
281
281
|
end
|
282
282
|
end
|
283
283
|
|
@@ -23,7 +23,11 @@ describe Chef::Resource::WindowsScript::Batch, :windows_only do
|
|
23
23
|
|
24
24
|
let(:output_command) { " > " }
|
25
25
|
|
26
|
-
let
|
26
|
+
let(:architecture_command) { "@echo %PROCESSOR_ARCHITECTURE%" }
|
27
|
+
|
28
|
+
let(:resource) do
|
29
|
+
Chef::Resource::WindowsScript::Batch.new("Batch resource functional test", @run_context)
|
30
|
+
end
|
27
31
|
|
28
32
|
it_behaves_like "a Windows script running on Windows"
|
29
33
|
|
@@ -65,10 +65,8 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only do
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def delete_user(target_user)
|
68
|
-
|
69
|
-
|
70
|
-
rescue Mixlib::ShellOut::ShellCommandFailed
|
71
|
-
end
|
68
|
+
shell_out!("net user #{target_user} /delete")
|
69
|
+
rescue Mixlib::ShellOut::ShellCommandFailed
|
72
70
|
end
|
73
71
|
|
74
72
|
let(:dsc_env_variable) { "chefenvtest" }
|