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
@@ -68,8 +68,8 @@ module ResourceInspector
|
|
68
68
|
dir, name = File.split(path)
|
69
69
|
Chef::Cookbook::FileVendor.fetch_from_disk(path)
|
70
70
|
loader = Chef::CookbookLoader.new(dir)
|
71
|
-
|
72
|
-
resources =
|
71
|
+
cookbook = loader.load_cookbook(name)
|
72
|
+
resources = cookbook.files_for(:resources)
|
73
73
|
|
74
74
|
resources.each_with_object({}) do |r, res|
|
75
75
|
pth = r["full_path"]
|
@@ -82,13 +82,14 @@ module ResourceInspector
|
|
82
82
|
# otherwise, if we have a path then extract all the resources from the cookbook
|
83
83
|
# or else do a list of built in resources
|
84
84
|
#
|
85
|
+
# @param arguments [Array, String] One of more paths to a cookbook or a resource file to inspect
|
85
86
|
# @param complete [TrueClass, FalseClass] Whether to show properties defined in the base Resource class
|
86
87
|
# @return [String] JSON formatting of all resources
|
87
88
|
def self.inspect(arguments = [], complete: false)
|
88
89
|
output = if arguments.empty?
|
89
90
|
ObjectSpace.each_object(Class).select { |k| k < Chef::Resource }.each_with_object({}) { |klass, acc| acc[klass.resource_name] = extract_resource(klass) }
|
90
91
|
else
|
91
|
-
arguments.each_with_object({}) do |arg, acc|
|
92
|
+
Array(arguments).each_with_object({}) do |arg, acc|
|
92
93
|
if File.directory?(arg)
|
93
94
|
extract_cookbook(arg, complete).each { |k, v| acc[k] = v }
|
94
95
|
else
|
data/lib/chef/role.rb
CHANGED
@@ -257,11 +257,11 @@ class Chef
|
|
257
257
|
|
258
258
|
js_path, rb_path = js_files.first, rb_files.first
|
259
259
|
|
260
|
-
if js_path && File.
|
260
|
+
if js_path && File.exist?(js_path)
|
261
261
|
# from_json returns object.class => json_class in the JSON.
|
262
262
|
hsh = Chef::JSONCompat.parse(IO.read(js_path))
|
263
263
|
return from_hash(hsh)
|
264
|
-
elsif rb_path && File.
|
264
|
+
elsif rb_path && File.exist?(rb_path)
|
265
265
|
role = Chef::Role.new
|
266
266
|
role.name(name)
|
267
267
|
role.from_file(rb_path)
|
data/lib/chef/shell.rb
CHANGED
@@ -317,7 +317,7 @@ module Shell
|
|
317
317
|
config[:config_file] = config_file_for_shell_mode(environment)
|
318
318
|
config_msg = config[:config_file] || "none (standalone session)"
|
319
319
|
puts "loading configuration: #{config_msg}"
|
320
|
-
Chef::Config.from_file(config[:config_file]) if !config[:config_file].nil? && File.
|
320
|
+
Chef::Config.from_file(config[:config_file]) if !config[:config_file].nil? && File.exist?(config[:config_file]) && File.readable?(config[:config_file])
|
321
321
|
Chef::Config.merge!(config)
|
322
322
|
end
|
323
323
|
|
@@ -41,6 +41,7 @@ module Shell
|
|
41
41
|
|
42
42
|
attr_accessor :node, :compile, :recipe, :json_configuration
|
43
43
|
attr_reader :node_attributes, :client
|
44
|
+
|
44
45
|
def initialize
|
45
46
|
@node_built = false
|
46
47
|
formatter = Chef::Formatters.new(Chef::Config.formatter, STDOUT, STDERR)
|
@@ -75,6 +76,7 @@ module Shell
|
|
75
76
|
end
|
76
77
|
|
77
78
|
attr_writer :run_context
|
79
|
+
|
78
80
|
def run_context
|
79
81
|
@run_context ||= rebuild_context
|
80
82
|
end
|
data/lib/chef/util/diff.rb
CHANGED
@@ -64,7 +64,7 @@ class Chef
|
|
64
64
|
|
65
65
|
def use_tempfile_if_missing(file)
|
66
66
|
tempfile = nil
|
67
|
-
unless File.
|
67
|
+
unless File.exist?(file)
|
68
68
|
Chef::Log.trace("File #{file} does not exist to diff against, using empty tempfile")
|
69
69
|
tempfile = Tempfile.new("chef-diff")
|
70
70
|
file = tempfile.path
|
@@ -160,9 +160,9 @@ class Chef
|
|
160
160
|
|
161
161
|
def self.parse_line(line)
|
162
162
|
if match = line.match(/^.*?:.*?:\s*LCM:\s*\[(.*?)\](.*)/)
|
163
|
-
|
164
|
-
|
165
|
-
|
163
|
+
# If the line looks like
|
164
|
+
# What If: [machinename]: LCM: [op_action op_type] message
|
165
|
+
# extract op_action, op_type, and message
|
166
166
|
operation, info = match.captures
|
167
167
|
op_action, op_type = operation.strip.split(" ").map { |m| m.downcase.to_sym }
|
168
168
|
else
|
data/lib/chef/version.rb
CHANGED
@@ -22,8 +22,8 @@
|
|
22
22
|
require_relative "version_string"
|
23
23
|
|
24
24
|
class Chef
|
25
|
-
CHEF_ROOT = File.expand_path("
|
26
|
-
VERSION = Chef::VersionString.new("15.
|
25
|
+
CHEF_ROOT = File.expand_path("..", __dir__)
|
26
|
+
VERSION = Chef::VersionString.new("15.14.0")
|
27
27
|
end
|
28
28
|
|
29
29
|
#
|
@@ -0,0 +1,89 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Kapil Chouhan <kapil.chouhan@msystechnologies.com>
|
3
|
+
# Copyright:: Copyright 2013-2020, Chef Software, Inc.
|
4
|
+
# License:: Apache License, Version 2.0
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
19
|
+
require_relative "../api"
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
module ReservedNames::Win32
|
23
|
+
module API
|
24
|
+
module CommandLineHelper
|
25
|
+
# extend Chef::ReservedNames::Win32
|
26
|
+
extend Chef::ReservedNames::Win32::API
|
27
|
+
|
28
|
+
###############################################
|
29
|
+
# Win32 API Bindings
|
30
|
+
###############################################
|
31
|
+
|
32
|
+
ffi_lib "Shell32"
|
33
|
+
|
34
|
+
=begin
|
35
|
+
LPWSTR * CommandLineToArgvW(
|
36
|
+
LPCWSTR lpCmdLine,
|
37
|
+
int *pNumArgs
|
38
|
+
);
|
39
|
+
=end
|
40
|
+
|
41
|
+
safe_attach_function :command_line_to_argv_w, :CommandLineToArgvW, %i{pointer pointer}, :pointer
|
42
|
+
|
43
|
+
ffi_lib "Kernel32"
|
44
|
+
|
45
|
+
=begin
|
46
|
+
LPSTR GetCommandLineA();
|
47
|
+
=end
|
48
|
+
|
49
|
+
safe_attach_function :get_command_line, :GetCommandLineA, [], :pointer
|
50
|
+
|
51
|
+
=begin
|
52
|
+
HLOCAL LocalFree(
|
53
|
+
_Frees_ptr_opt_ HLOCAL hMem
|
54
|
+
);
|
55
|
+
=end
|
56
|
+
|
57
|
+
safe_attach_function :local_free, :LocalFree, [:pointer], :pointer
|
58
|
+
|
59
|
+
###############################################
|
60
|
+
# Helpers
|
61
|
+
###############################################
|
62
|
+
|
63
|
+
# It takes the supplied string and splits it into an array.
|
64
|
+
def command_line_to_argv_w_helper(args)
|
65
|
+
arguments_list = []
|
66
|
+
argv = args.to_wstring
|
67
|
+
result = get_command_line
|
68
|
+
argc = FFI::MemoryPointer.new(:int)
|
69
|
+
|
70
|
+
# Parses a Unicode command line string
|
71
|
+
# It is return an array of pointers to the command line arguments.
|
72
|
+
# Along with a count of such arguments
|
73
|
+
result = command_line_to_argv_w(argv, argc)
|
74
|
+
str_ptr = result.read_pointer
|
75
|
+
offset = 0
|
76
|
+
number_of_agrs = argc.read_int
|
77
|
+
number_of_agrs.times do
|
78
|
+
new_str_pointer = str_ptr.+(offset)
|
79
|
+
argument = new_str_pointer.read_wstring
|
80
|
+
arguments_list << argument
|
81
|
+
offset = offset + argument.length * 2 + 2
|
82
|
+
end
|
83
|
+
local_free(result)
|
84
|
+
arguments_list
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
data/lib/chef/win32/api/file.rb
CHANGED
@@ -461,22 +461,22 @@ BOOL WINAPI DeviceIoControl(
|
|
461
461
|
=end
|
462
462
|
safe_attach_function :DeviceIoControl, %i{HANDLE DWORD LPVOID DWORD LPVOID DWORD LPDWORD pointer}, :BOOL
|
463
463
|
|
464
|
-
# BOOL WINAPI DeleteVolumeMountPoint(
|
465
|
-
|
466
|
-
# );
|
464
|
+
# BOOL WINAPI DeleteVolumeMountPoint(
|
465
|
+
# _In_ LPCTSTR lpszVolumeMountPoint
|
466
|
+
# );
|
467
467
|
safe_attach_function :DeleteVolumeMountPointW, [:LPCTSTR], :BOOL
|
468
468
|
|
469
|
-
# BOOL WINAPI SetVolumeMountPoint(
|
470
|
-
|
471
|
-
|
472
|
-
# );
|
469
|
+
# BOOL WINAPI SetVolumeMountPoint(
|
470
|
+
# _In_ LPCTSTR lpszVolumeMountPoint,
|
471
|
+
# _In_ LPCTSTR lpszVolumeName
|
472
|
+
# );
|
473
473
|
safe_attach_function :SetVolumeMountPointW, %i{LPCTSTR LPCTSTR}, :BOOL
|
474
474
|
|
475
|
-
# BOOL WINAPI GetVolumeNameForVolumeMountPoint(
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
# );
|
475
|
+
# BOOL WINAPI GetVolumeNameForVolumeMountPoint(
|
476
|
+
# _In_ LPCTSTR lpszVolumeMountPoint,
|
477
|
+
# _Out_ LPTSTR lpszVolumeName,
|
478
|
+
# _In_ DWORD cchBufferLength
|
479
|
+
# );
|
480
480
|
safe_attach_function :GetVolumeNameForVolumeMountPointW, %i{LPCTSTR LPTSTR DWORD}, :BOOL
|
481
481
|
|
482
482
|
=begin
|
@@ -538,12 +538,12 @@ BOOL WINAPI VerQueryValue(
|
|
538
538
|
# ensures the handle is closed on exit of the block
|
539
539
|
# FIXME: yard with @yield
|
540
540
|
def file_search_handle(path)
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
541
|
+
# Workaround for CHEF-4419:
|
542
|
+
# Make sure paths starting with "/" has a drive letter
|
543
|
+
# assigned from the current working diretory.
|
544
|
+
# Note: With CHEF-4427 this issue will be fixed with a
|
545
|
+
# broader fix to map all the paths starting with "/" to
|
546
|
+
# SYSTEM_DRIVE on windows.
|
547
547
|
path = ::File.expand_path(path) if path.start_with? "/"
|
548
548
|
path = canonical_encode_path(path)
|
549
549
|
find_data = WIN32_FIND_DATA.new
|
data/lib/chef/win32/file.rb
CHANGED
@@ -78,7 +78,7 @@ class Chef
|
|
78
78
|
def self.symlink?(file_name)
|
79
79
|
is_symlink = false
|
80
80
|
path = encode_path(file_name)
|
81
|
-
if ::File.
|
81
|
+
if ::File.exist?(file_name) || ::File.symlink?(file_name)
|
82
82
|
if (GetFileAttributesW(path) & FILE_ATTRIBUTE_REPARSE_POINT) > 0
|
83
83
|
file_search_handle(file_name) do |handle, find_data|
|
84
84
|
if find_data[:dw_reserved_0] == IO_REPARSE_TAG_SYMLINK
|
@@ -104,7 +104,7 @@ class Chef
|
|
104
104
|
# will raise a NotImplementedError, as per MRI.
|
105
105
|
#
|
106
106
|
def self.readlink(link_name)
|
107
|
-
raise Errno::ENOENT, link_name unless ::File.
|
107
|
+
raise Errno::ENOENT, link_name unless ::File.exist?(link_name) || ::File.symlink?(link_name)
|
108
108
|
|
109
109
|
symlink_file_handle(link_name) do |handle|
|
110
110
|
# Go to DeviceIoControl to get the symlink information
|
@@ -171,7 +171,7 @@ class Chef
|
|
171
171
|
rescue Chef::Exceptions::Win32APIFunctionNotImplemented => e
|
172
172
|
raise e
|
173
173
|
rescue Exception
|
174
|
-
|
174
|
+
# things are ok.
|
175
175
|
end
|
176
176
|
|
177
177
|
def self.file_access_check(path, desired_access)
|
data/lib/chef/win32/process.rb
CHANGED
@@ -82,8 +82,8 @@ class Chef
|
|
82
82
|
(call_succeeded != 0) && (is_64_bit_process_result.get_int(0) != 0)
|
83
83
|
end
|
84
84
|
|
85
|
-
|
86
|
-
|
85
|
+
# Must have PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION rights,
|
86
|
+
# AND the PROCESS_VM_READ right
|
87
87
|
def self.get_process_memory_info(handle)
|
88
88
|
memory_info = PROCESS_MEMORY_COUNTERS.new
|
89
89
|
unless GetProcessMemoryInfo(handle.handle, memory_info, memory_info.size)
|
@@ -274,7 +274,7 @@ describe Chef::Knife::Ssh do
|
|
274
274
|
end
|
275
275
|
|
276
276
|
it "uses the ssh_gateway" do
|
277
|
-
expect(@knife.session).to receive(:via).with("ec2.public_hostname", "user", {})
|
277
|
+
expect(@knife.session).to receive(:via).with("ec2.public_hostname", "user", { append_all_supported_algorithms: true })
|
278
278
|
@knife.run
|
279
279
|
expect(@knife.config[:ssh_gateway]).to eq("user@ec2.public_hostname")
|
280
280
|
end
|
@@ -287,7 +287,7 @@ describe Chef::Knife::Ssh do
|
|
287
287
|
end
|
288
288
|
|
289
289
|
it "uses the ssh_gateway" do
|
290
|
-
expect(@knife.session).to receive(:via).with("ec2.public_hostname", "user", {})
|
290
|
+
expect(@knife.session).to receive(:via).with("ec2.public_hostname", "user", { append_all_supported_algorithms: true })
|
291
291
|
@knife.run
|
292
292
|
expect(@knife.config[:ssh_gateway]).to eq("user@ec2.public_hostname")
|
293
293
|
end
|
@@ -301,7 +301,7 @@ describe Chef::Knife::Ssh do
|
|
301
301
|
end
|
302
302
|
|
303
303
|
it "uses the ssh_gateway_identity file" do
|
304
|
-
expect(@knife.session).to receive(:via).with("ec2.public_hostname", "user", { keys: File.expand_path("#{ENV["HOME"]}/.ssh/aws-gateway.rsa").squeeze("/"), keys_only: true })
|
304
|
+
expect(@knife.session).to receive(:via).with("ec2.public_hostname", "user", { append_all_supported_algorithms: true, keys: File.expand_path("#{ENV["HOME"]}/.ssh/aws-gateway.rsa").squeeze("/"), keys_only: true })
|
305
305
|
@knife.run
|
306
306
|
expect(@knife.config[:ssh_gateway_identity]).to eq("~/.ssh/aws-gateway.rsa")
|
307
307
|
end
|
@@ -315,7 +315,7 @@ describe Chef::Knife::Ssh do
|
|
315
315
|
end
|
316
316
|
|
317
317
|
it "uses the ssh_gateway_identity file" do
|
318
|
-
expect(@knife.session).to receive(:via).with("ec2.public_hostname", "user", { keys: File.expand_path("#{ENV["HOME"]}/.ssh/aws-gateway.rsa").squeeze("/"), keys_only: true })
|
318
|
+
expect(@knife.session).to receive(:via).with("ec2.public_hostname", "user", { append_all_supported_algorithms: true, keys: File.expand_path("#{ENV["HOME"]}/.ssh/aws-gateway.rsa").squeeze("/"), keys_only: true })
|
319
319
|
@knife.run
|
320
320
|
expect(@knife.config[:ssh_gateway_identity]).to eq("~/.ssh/aws-gateway.rsa")
|
321
321
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
# encoding: UTF-8
|
2
1
|
#
|
3
2
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
4
3
|
# Copyright:: Copyright (c) Chef Software Inc.
|
@@ -29,11 +28,11 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
29
28
|
# Platform specific validation routines.
|
30
29
|
def service_should_be_started(file_name)
|
31
30
|
# The existence of this file indicates that the service was started.
|
32
|
-
expect(File.
|
31
|
+
expect(File.exist?("#{Dir.tmpdir}/#{file_name}")).to be_truthy
|
33
32
|
end
|
34
33
|
|
35
34
|
def service_should_be_stopped(file_name)
|
36
|
-
expect(File.
|
35
|
+
expect(File.exist?("#{Dir.tmpdir}/#{file_name}")).to be_falsey
|
37
36
|
end
|
38
37
|
|
39
38
|
def valide_symlinks(expected_output, run_level = nil, status = nil, priority = nil)
|
@@ -69,12 +68,12 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
69
68
|
end
|
70
69
|
|
71
70
|
before(:all) do
|
72
|
-
File.delete("/etc/rc.d/init.d/chefinittest") if File.
|
71
|
+
File.delete("/etc/rc.d/init.d/chefinittest") if File.exist?("/etc/rc.d/init.d/chefinittest")
|
73
72
|
FileUtils.cp((File.join(File.dirname(__FILE__), "/../assets/chefinittest")).to_s, "/etc/rc.d/init.d/chefinittest")
|
74
73
|
end
|
75
74
|
|
76
75
|
after(:all) do
|
77
|
-
File.delete("/etc/rc.d/init.d/chefinittest") if File.
|
76
|
+
File.delete("/etc/rc.d/init.d/chefinittest") if File.exist?("/etc/rc.d/init.d/chefinittest")
|
78
77
|
end
|
79
78
|
|
80
79
|
before(:each) do
|
@@ -166,7 +165,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
166
165
|
end
|
167
166
|
|
168
167
|
after do
|
169
|
-
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.
|
168
|
+
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.exist?("/etc/rc.d/rc2.d/chefinittest")
|
170
169
|
end
|
171
170
|
|
172
171
|
it "creates symlink with status K" do
|
@@ -182,7 +181,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
182
181
|
end
|
183
182
|
|
184
183
|
after do
|
185
|
-
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.
|
184
|
+
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.exist?("/etc/rc.d/rc2.d/chefinittest")
|
186
185
|
end
|
187
186
|
|
188
187
|
it "creates a symlink with status K and a priority" do
|
@@ -199,7 +198,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
199
198
|
end
|
200
199
|
|
201
200
|
after do
|
202
|
-
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.
|
201
|
+
File.delete("/etc/rc.d/rc2.d/Schefinittest") if File.exist?("/etc/rc.d/rc2.d/chefinittest")
|
203
202
|
end
|
204
203
|
|
205
204
|
it "create symlink with status stop (K) and a priority " do
|
@@ -31,12 +31,12 @@ describe Chef::Resource::BffPackage, :requires_root, external: ohai[:platform] !
|
|
31
31
|
|
32
32
|
def bff_pkg_should_be_installed(resource)
|
33
33
|
expect(shell_out("lslpp -L #{resource.name}").exitstatus).to eq(0)
|
34
|
-
::File.
|
34
|
+
::File.exist?("/usr/PkgA/bin/acommand")
|
35
35
|
end
|
36
36
|
|
37
37
|
def bff_pkg_should_be_removed(resource)
|
38
38
|
expect(shell_out("lslpp -L #{resource.name}").exitstatus).to eq(1)
|
39
|
-
!::File.
|
39
|
+
!::File.exist?("/usr/PkgA/bin/acommand")
|
40
40
|
end
|
41
41
|
|
42
42
|
before(:all) do
|
@@ -32,6 +32,11 @@ describe Chef::Resource::ChocolateyPackage, :windows_only, :choco_installed do
|
|
32
32
|
new_resource
|
33
33
|
end
|
34
34
|
|
35
|
+
let(:provider) do
|
36
|
+
provider = subject.provider_for_action(subject.action)
|
37
|
+
provider
|
38
|
+
end
|
39
|
+
|
35
40
|
context "installing a package" do
|
36
41
|
after { remove_package }
|
37
42
|
|
@@ -88,6 +93,30 @@ describe Chef::Resource::ChocolateyPackage, :windows_only, :choco_installed do
|
|
88
93
|
expect(package_list.call).to eq("#{package_name}|2.0")
|
89
94
|
end
|
90
95
|
|
96
|
+
context "when multiple options passed as string" do
|
97
|
+
before do
|
98
|
+
subject.options "--force --confirm"
|
99
|
+
subject.source nil
|
100
|
+
end
|
101
|
+
|
102
|
+
it "splits a string into an array of options" do
|
103
|
+
expect(provider.send(:cmd_args)).to eq(["--force", "--confirm"])
|
104
|
+
end
|
105
|
+
|
106
|
+
it "calls command_line_to_argv_w_helper method" do
|
107
|
+
expect(provider).to receive(:command_line_to_argv_w_helper).with(subject.options).and_return(["--force", "--confirm"])
|
108
|
+
provider.send(:cmd_args)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
context "when multiple options passed as array" do
|
113
|
+
it "Does not call command_line_to_argv_w_helper method" do
|
114
|
+
subject.options [ "--force", "--confirm" ]
|
115
|
+
expect(provider).not_to receive(:command_line_to_argv_w_helper)
|
116
|
+
provider.send(:cmd_args)
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
91
120
|
it "installs with multiple options as an array" do
|
92
121
|
subject.options [ "--force", "--confirm" ]
|
93
122
|
subject.run_action(:install)
|