chef 15.13.8-universal-mingw32 → 15.16.7-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 +6 -6
- data/README.md +3 -3
- data/Rakefile +11 -17
- data/chef-universal-mingw32.gemspec +2 -2
- data/chef.gemspec +22 -4
- data/lib/chef/api_client/registration.rb +2 -2
- 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/environment.rb +2 -2
- data/lib/chef/http.rb +2 -1
- data/lib/chef/knife/bootstrap.rb +2 -2
- data/lib/chef/knife/cookbook_download.rb +1 -1
- data/lib/chef/knife/cookbook_metadata.rb +1 -1
- data/lib/chef/knife/core/hashed_command_loader.rb +2 -2
- data/lib/chef/knife/exec.rb +2 -2
- data/lib/chef/knife/ssh.rb +16 -1
- data/lib/chef/provider/package/dnf/dnf_helper.py +5 -0
- data/lib/chef/provider/package/freebsd/pkgng.rb +3 -1
- data/lib/chef/provider/package/yum/yum_helper.py +4 -0
- data/lib/chef/provider/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/resource/cron_d.rb +1 -0
- data/lib/chef/resource/homebrew_cask.rb +3 -3
- data/lib/chef/resource/hostname.rb +18 -18
- data/lib/chef/resource/locale.rb +1 -1
- data/lib/chef/resource/sudo.rb +1 -1
- data/lib/chef/resource/windows_feature_powershell.rb +6 -2
- data/lib/chef/resource/windows_font.rb +2 -1
- data/lib/chef/role.rb +2 -2
- data/lib/chef/shell.rb +32 -1
- data/lib/chef/util/diff.rb +1 -1
- data/lib/chef/util/dsc/configuration_generator.rb +1 -1
- data/lib/chef/util/powershell/cmdlet.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version_string.rb +1 -1
- data/lib/chef/win32/file.rb +2 -2
- data/spec/functional/resource/aixinit_service_spec.rb +7 -7
- data/spec/functional/resource/bff_spec.rb +2 -2
- data/spec/functional/resource/cookbook_file_spec.rb +1 -1
- data/spec/functional/resource/dsc_resource_spec.rb +1 -1
- data/spec/functional/resource/insserv_spec.rb +4 -4
- data/spec/functional/resource/link_spec.rb +17 -17
- data/spec/functional/resource/rpm_spec.rb +2 -2
- data/spec/functional/resource/user/dscl_spec.rb +1 -1
- data/spec/functional/resource/user/mac_user_spec.rb +1 -1
- data/spec/functional/resource/windows_certificate_spec.rb +3 -3
- data/spec/functional/resource/windows_font_spec.rb +49 -0
- data/spec/functional/shell_spec.rb +5 -5
- data/spec/functional/win32/service_manager_spec.rb +1 -1
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -4
- 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/unit/environment_spec.rb +7 -7
- data/spec/unit/knife/bootstrap_spec.rb +14 -14
- data/spec/unit/knife/cookbook_download_spec.rb +4 -4
- data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +1 -1
- data/spec/unit/knife/core/hashed_command_loader_spec.rb +3 -3
- data/spec/unit/knife/ssh_spec.rb +2 -2
- data/spec/unit/knife/supermarket_share_spec.rb +5 -3
- data/spec/unit/provider/package/freebsd/pkgng_spec.rb +1 -1
- 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/resource/windows_feature_powershell_spec.rb +30 -4
- data/spec/unit/role_spec.rb +11 -11
- metadata +40 -27
@@ -42,7 +42,9 @@ class Chef
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def current_installed_version
|
45
|
-
|
45
|
+
# pkgng up to version 1.15.99.7 returns 70 for pkg not found,
|
46
|
+
# later versions return 1
|
47
|
+
pkg_info = shell_out!("pkg", "info", new_resource.package_name, env: nil, returns: [0, 1, 70])
|
46
48
|
pkg_info.stdout[/^Version +: (.+)$/, 1]
|
47
49
|
end
|
48
50
|
|
@@ -32,8 +32,8 @@ class Chef::Provider::Service::Arch < Chef::Provider::Service::Init
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def load_current_resource
|
35
|
-
raise Chef::Exceptions::Service, "Could not find /etc/rc.conf" unless ::File.
|
36
|
-
raise Chef::Exceptions::Service, "No DAEMONS found in /etc/rc.conf" unless ::File.read("/etc/rc.conf")
|
35
|
+
raise Chef::Exceptions::Service, "Could not find /etc/rc.conf" unless ::File.exist?("/etc/rc.conf")
|
36
|
+
raise Chef::Exceptions::Service, "No DAEMONS found in /etc/rc.conf" unless /DAEMONS=\((.*)\)/m.match?(::File.read("/etc/rc.conf"))
|
37
37
|
|
38
38
|
super
|
39
39
|
|
@@ -45,7 +45,7 @@ class Chef
|
|
45
45
|
shared_resource_requirements
|
46
46
|
requirements.assert(:all_actions) do |a|
|
47
47
|
update_rcd = "/usr/sbin/update-rc.d"
|
48
|
-
a.assertion { ::File.
|
48
|
+
a.assertion { ::File.exist? update_rcd }
|
49
49
|
a.failure_message Chef::Exceptions::Service, "#{update_rcd} does not exist!"
|
50
50
|
# no whyrun recovery - this is a base system component of debian
|
51
51
|
# distros and must be present
|
@@ -34,7 +34,7 @@ class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init
|
|
34
34
|
@current_resource.enabled(
|
35
35
|
Dir.glob("/etc/runlevels/**/#{Chef::Util::PathHelper.escape_glob_dir(@current_resource.service_name)}").any? do |file|
|
36
36
|
@found_script = true
|
37
|
-
exists = ::File.
|
37
|
+
exists = ::File.exist? file
|
38
38
|
readable = ::File.readable? file
|
39
39
|
logger.trace "#{@new_resource} exists: #{exists}, readable: #{readable}"
|
40
40
|
exists && readable
|
@@ -47,7 +47,7 @@ class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init
|
|
47
47
|
|
48
48
|
def define_resource_requirements
|
49
49
|
requirements.assert(:all_actions) do |a|
|
50
|
-
a.assertion { ::File.
|
50
|
+
a.assertion { ::File.exist?("/sbin/rc-update") }
|
51
51
|
a.failure_message Chef::Exceptions::Service, "/sbin/rc-update does not exist"
|
52
52
|
# no whyrun recovery -t his is a core component whose presence is
|
53
53
|
# unlikely to be affected by what we do in the course of a chef run
|
@@ -84,7 +84,7 @@ class Chef
|
|
84
84
|
end
|
85
85
|
|
86
86
|
requirements.assert(:all_actions) do |a|
|
87
|
-
a.assertion { ::File.
|
87
|
+
a.assertion { ::File.exist?(@plist.to_s) }
|
88
88
|
a.failure_message Chef::Exceptions::Service,
|
89
89
|
"Could not find plist for #{@new_resource}"
|
90
90
|
end
|
@@ -215,7 +215,7 @@ class Chef
|
|
215
215
|
return nil if @plist.nil?
|
216
216
|
|
217
217
|
# Plist must exist by this point
|
218
|
-
raise Chef::Exceptions::FileNotFound, "Cannot find #{@plist}!" unless ::File.
|
218
|
+
raise Chef::Exceptions::FileNotFound, "Cannot find #{@plist}!" unless ::File.exist?(@plist)
|
219
219
|
|
220
220
|
# Most services have the same internal label as the name of the
|
221
221
|
# plist file. However, there is no rule saying that *has* to be
|
@@ -132,7 +132,7 @@ class Chef
|
|
132
132
|
end
|
133
133
|
|
134
134
|
def update_rcl(value)
|
135
|
-
FileUtils.touch RC_CONF_LOCAL_PATH unless ::File.
|
135
|
+
FileUtils.touch RC_CONF_LOCAL_PATH unless ::File.exist? RC_CONF_LOCAL_PATH
|
136
136
|
::File.write(RC_CONF_LOCAL_PATH, value)
|
137
137
|
@rc_conf_local = value
|
138
138
|
end
|
@@ -56,7 +56,7 @@ class Chef
|
|
56
56
|
|
57
57
|
requirements.assert(:all_actions) do |a|
|
58
58
|
chkconfig_file = "/sbin/chkconfig"
|
59
|
-
a.assertion { ::File.
|
59
|
+
a.assertion { ::File.exist? chkconfig_file }
|
60
60
|
a.failure_message Chef::Exceptions::Service, "#{chkconfig_file} does not exist!"
|
61
61
|
end
|
62
62
|
|
@@ -80,7 +80,7 @@ class Chef
|
|
80
80
|
|
81
81
|
super
|
82
82
|
|
83
|
-
if ::File.
|
83
|
+
if ::File.exist?("/sbin/chkconfig")
|
84
84
|
chkconfig = shell_out!("/sbin/chkconfig --list #{current_resource.service_name}", returns: [0, 1])
|
85
85
|
unless run_levels.nil? || run_levels.empty?
|
86
86
|
all_levels_match = true
|
@@ -135,7 +135,7 @@ class Chef
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
# Get enabled/disabled state by reading job configuration file
|
138
|
-
if ::File.
|
138
|
+
if ::File.exist?("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
|
139
139
|
logger.trace("#{@new_resource} found #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}")
|
140
140
|
::File.open("#{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}", "r") do |file|
|
141
141
|
while line = file.gets
|
data/lib/chef/resource/cron_d.rb
CHANGED
@@ -59,7 +59,7 @@ class Chef
|
|
59
59
|
|
60
60
|
unless casked?
|
61
61
|
converge_by("install cask #{new_resource.cask_name} #{new_resource.options}") do
|
62
|
-
shell_out!("#{new_resource.homebrew_path} cask
|
62
|
+
shell_out!("#{new_resource.homebrew_path} install --cask #{new_resource.cask_name} #{new_resource.options}",
|
63
63
|
user: new_resource.owner,
|
64
64
|
env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner },
|
65
65
|
cwd: ::Dir.home(new_resource.owner))
|
@@ -74,7 +74,7 @@ class Chef
|
|
74
74
|
|
75
75
|
if casked?
|
76
76
|
converge_by("uninstall cask #{new_resource.cask_name}") do
|
77
|
-
shell_out!("#{new_resource.homebrew_path} cask
|
77
|
+
shell_out!("#{new_resource.homebrew_path} uninstall --cask #{new_resource.cask_name}",
|
78
78
|
user: new_resource.owner,
|
79
79
|
env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner },
|
80
80
|
cwd: ::Dir.home(new_resource.owner))
|
@@ -92,7 +92,7 @@ class Chef
|
|
92
92
|
# @return [Boolean]
|
93
93
|
def casked?
|
94
94
|
unscoped_name = new_resource.cask_name.split("/").last
|
95
|
-
shell_out!("#{new_resource.homebrew_path} cask
|
95
|
+
shell_out!("#{new_resource.homebrew_path} list --cask 2>/dev/null",
|
96
96
|
user: new_resource.owner,
|
97
97
|
env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner },
|
98
98
|
cwd: ::Dir.home(new_resource.owner)).stdout.split.include?(unscoped_name)
|
@@ -67,8 +67,7 @@ class Chef
|
|
67
67
|
def updated_ec2_config_xml
|
68
68
|
begin
|
69
69
|
require "rexml/document" unless defined?(REXML::Document)
|
70
|
-
|
71
|
-
config = REXML::Document.new(::File.read(config_file))
|
70
|
+
config = REXML::Document.new(::File.read(WINDOWS_EC2_CONFIG))
|
72
71
|
# find an element named State with a sibling element whose value is Ec2SetComputerName
|
73
72
|
REXML::XPath.each(config, "//Plugin/State[../Name/text() = 'Ec2SetComputerName']") do |element|
|
74
73
|
element.text = "Disabled"
|
@@ -220,35 +219,36 @@ class Chef
|
|
220
219
|
end
|
221
220
|
|
222
221
|
else # windows
|
222
|
+
WINDOWS_EC2_CONFIG = 'C:\Program Files\Amazon\Ec2ConfigService\Settings\config.xml'.freeze
|
223
|
+
|
223
224
|
raise "Windows hostnames cannot contain a period." if new_resource.hostname.match?(/\./)
|
224
225
|
|
225
226
|
# suppress EC2 config service from setting our hostname
|
226
|
-
if ::File.exist?(
|
227
|
+
if ::File.exist?(WINDOWS_EC2_CONFIG)
|
227
228
|
xml_contents = updated_ec2_config_xml
|
228
229
|
if xml_contents.empty?
|
229
230
|
Chef::Log.warn('Unable to properly parse and update C:\Program Files\Amazon\Ec2ConfigService\Settings\config.xml contents. Skipping file update.')
|
230
231
|
else
|
231
|
-
|
232
|
+
file WINDOWS_EC2_CONFIG do
|
232
233
|
content xml_contents
|
233
234
|
end
|
234
235
|
end
|
235
236
|
end
|
236
237
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
not_if { Socket.gethostbyname(Socket.gethostname).first == new_resource.hostname }
|
245
|
-
end
|
238
|
+
unless Socket.gethostbyname(Socket.gethostname).first == new_resource.hostname
|
239
|
+
converge_by "set hostname to #{new_resource.hostname}" do
|
240
|
+
powershell_out! <<~EOH
|
241
|
+
$sysInfo = Get-WmiObject -Class Win32_ComputerSystem
|
242
|
+
$sysInfo.Rename("#{new_resource.hostname}")
|
243
|
+
EOH
|
244
|
+
end
|
246
245
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
246
|
+
# reboot because $windows
|
247
|
+
reboot "setting hostname" do
|
248
|
+
reason "#{Chef::Dist::PRODUCT} updated system hostname"
|
249
|
+
only_if { new_resource.windows_reboot }
|
250
|
+
action :request_reboot
|
251
|
+
end
|
252
252
|
end
|
253
253
|
end
|
254
254
|
end
|
data/lib/chef/resource/locale.rb
CHANGED
@@ -97,7 +97,7 @@ class Chef
|
|
97
97
|
# @raise [Mixlib::ShellOut::ShellCommandFailed] not a supported language or locale
|
98
98
|
#
|
99
99
|
def generate_locales
|
100
|
-
shell_out!("locale-gen #{unavailable_locales.join(" ")}")
|
100
|
+
shell_out!("locale-gen #{unavailable_locales.join(" ")}", timeout: 1800)
|
101
101
|
end
|
102
102
|
|
103
103
|
# Updates system locale by appropriately writing them in /etc/locale.conf
|
data/lib/chef/resource/sudo.rb
CHANGED
@@ -228,7 +228,7 @@ class Chef
|
|
228
228
|
end
|
229
229
|
|
230
230
|
def visudo_content(path)
|
231
|
-
if ::File.
|
231
|
+
if ::File.exist?(path)
|
232
232
|
"cat #{new_resource.config_prefix}/sudoers | #{new_resource.visudo_binary} -cf - && #{new_resource.visudo_binary} -cf %{path}"
|
233
233
|
else
|
234
234
|
"cat #{new_resource.config_prefix}/sudoers %{path} | #{new_resource.visudo_binary} -cf -"
|
@@ -163,8 +163,12 @@ class Chef
|
|
163
163
|
|
164
164
|
# @return [Array] features the user has requested to install which need installation
|
165
165
|
def features_to_install
|
166
|
-
# the intersection of the features to install & disabled features are what needs installing
|
167
|
-
@
|
166
|
+
# the intersection of the features to install & disabled/removed features are what needs installing
|
167
|
+
@features_to_install ||= begin
|
168
|
+
features = node["powershell_features_cache"]["disabled"]
|
169
|
+
features |= node["powershell_features_cache"]["removed"] if new_resource.source
|
170
|
+
new_resource.feature_name & features
|
171
|
+
end
|
168
172
|
end
|
169
173
|
|
170
174
|
# @return [Array] features the user has requested to remove which need removing
|
@@ -90,8 +90,9 @@ class Chef
|
|
90
90
|
def font_exists?
|
91
91
|
require "win32ole" if RUBY_PLATFORM =~ /mswin|mingw32|windows/
|
92
92
|
fonts_dir = WIN32OLE.new("WScript.Shell").SpecialFolders("Fonts")
|
93
|
+
fonts_dir_local = Chef::Util::PathHelper.join(ENV["home"], "AppData/Local/Microsoft/Windows/fonts")
|
93
94
|
logger.trace("Seeing if the font at #{Chef::Util::PathHelper.join(fonts_dir, new_resource.font_name)} exists")
|
94
|
-
::File.exist?(Chef::Util::PathHelper.join(fonts_dir, new_resource.font_name))
|
95
|
+
::File.exist?(Chef::Util::PathHelper.join(fonts_dir, new_resource.font_name)) || ::File.exist?(Chef::Util::PathHelper.join(fonts_dir_local, new_resource.font_name))
|
95
96
|
end
|
96
97
|
|
97
98
|
# Parse out the schema provided to us to see if it's one we support via remote_file.
|
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
@@ -19,6 +19,7 @@ require "singleton" unless defined?(Singleton)
|
|
19
19
|
require "pp" unless defined?(PP)
|
20
20
|
require "etc" unless defined?(Etc)
|
21
21
|
require "mixlib/cli" unless defined?(Mixlib::CLI)
|
22
|
+
require "chef-config/mixin/dot_d"
|
22
23
|
|
23
24
|
require_relative "../chef"
|
24
25
|
require_relative "version"
|
@@ -199,6 +200,7 @@ module Shell
|
|
199
200
|
|
200
201
|
class Options
|
201
202
|
include Mixlib::CLI
|
203
|
+
include ChefConfig::Mixin::DotD
|
202
204
|
|
203
205
|
def self.footer(text = nil)
|
204
206
|
@footer = text if text
|
@@ -314,15 +316,44 @@ module Shell
|
|
314
316
|
# We have to nuke ARGV to make sure irb's option parser never sees it.
|
315
317
|
# otherwise, IRB complains about command line switches it doesn't recognize.
|
316
318
|
ARGV.clear
|
319
|
+
|
320
|
+
# This code should not exist.
|
321
|
+
# We should be using Application::Client and then calling load_config_file
|
322
|
+
# which does all this properly. However this will do for now.
|
317
323
|
config[:config_file] = config_file_for_shell_mode(environment)
|
318
324
|
config_msg = config[:config_file] || "none (standalone session)"
|
319
325
|
puts "loading configuration: #{config_msg}"
|
320
|
-
|
326
|
+
|
327
|
+
# load the config (if we have one)
|
328
|
+
unless config[:config_file].nil?
|
329
|
+
if File.exist?(config[:config_file]) && File.readable?(config[:config_file])
|
330
|
+
Chef::Config.from_file(config[:config_file])
|
331
|
+
end
|
332
|
+
|
333
|
+
# even if we couldn't load that, we need to tell Chef::Config what
|
334
|
+
# the file was so it sets confdir and d_dir and such properly
|
335
|
+
Chef::Config[:config_file] = config[:config_file]
|
336
|
+
|
337
|
+
# now attempt to load any relevant dot-dirs
|
338
|
+
load_dot_d(Chef::Config[:client_d_dir]) if Chef::Config[:client_d_dir]
|
339
|
+
end
|
340
|
+
|
341
|
+
# finally merge command-line options in
|
321
342
|
Chef::Config.merge!(config)
|
322
343
|
end
|
323
344
|
|
324
345
|
private
|
325
346
|
|
347
|
+
# shamelessly lifted from application.rb
|
348
|
+
def apply_config(config_content, config_file_path)
|
349
|
+
Chef::Config.from_string(config_content, config_file_path)
|
350
|
+
rescue Exception => error
|
351
|
+
logger.fatal("Configuration error #{error.class}: #{error.message}")
|
352
|
+
filtered_trace = error.backtrace.grep(/#{Regexp.escape(config_file_path)}/)
|
353
|
+
filtered_trace.each { |line| logger.fatal(" " + line ) }
|
354
|
+
raise Chef::Exceptions::ConfigurationError.new("Aborting due to error in '#{config_file_path}': #{error}")
|
355
|
+
end
|
356
|
+
|
326
357
|
def config_file_for_shell_mode(environment)
|
327
358
|
dot_chef_dir = Chef::Util::PathHelper.home(".chef")
|
328
359
|
if config[:config_file]
|
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
|
@@ -64,7 +64,7 @@ class Chef::Util::DSC
|
|
64
64
|
# The name may not be null or empty, and should start with a letter.
|
65
65
|
def validate_configuration_name!(configuration_name)
|
66
66
|
if !!(configuration_name =~ /\A[A-Za-z]+[_a-zA-Z0-9]*\Z/) == false
|
67
|
-
raise ArgumentError,
|
67
|
+
raise ArgumentError, "Configuration `#{configuration_name}` is not a valid PowerShell cmdlet name"
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
data/lib/chef/version.rb
CHANGED
data/lib/chef/version_string.rb
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
|
16
|
-
require "chef-utils/version_string"
|
16
|
+
require "chef-utils/version_string" unless defined?(ChefUtils::VersionString)
|
17
17
|
|
18
18
|
class Chef
|
19
19
|
VersionString = ChefUtils::VersionString
|
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
|
@@ -28,11 +28,11 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
28
28
|
# Platform specific validation routines.
|
29
29
|
def service_should_be_started(file_name)
|
30
30
|
# The existence of this file indicates that the service was started.
|
31
|
-
expect(File.
|
31
|
+
expect(File.exist?("#{Dir.tmpdir}/#{file_name}")).to be_truthy
|
32
32
|
end
|
33
33
|
|
34
34
|
def service_should_be_stopped(file_name)
|
35
|
-
expect(File.
|
35
|
+
expect(File.exist?("#{Dir.tmpdir}/#{file_name}")).to be_falsey
|
36
36
|
end
|
37
37
|
|
38
38
|
def valide_symlinks(expected_output, run_level = nil, status = nil, priority = nil)
|
@@ -68,12 +68,12 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
before(:all) do
|
71
|
-
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")
|
72
72
|
FileUtils.cp((File.join(File.dirname(__FILE__), "/../assets/chefinittest")).to_s, "/etc/rc.d/init.d/chefinittest")
|
73
73
|
end
|
74
74
|
|
75
75
|
after(:all) do
|
76
|
-
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")
|
77
77
|
end
|
78
78
|
|
79
79
|
before(:each) do
|
@@ -165,7 +165,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
165
165
|
end
|
166
166
|
|
167
167
|
after do
|
168
|
-
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")
|
169
169
|
end
|
170
170
|
|
171
171
|
it "creates symlink with status K" do
|
@@ -181,7 +181,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
181
181
|
end
|
182
182
|
|
183
183
|
after do
|
184
|
-
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")
|
185
185
|
end
|
186
186
|
|
187
187
|
it "creates a symlink with status K and a priority" do
|
@@ -198,7 +198,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
|
|
198
198
|
end
|
199
199
|
|
200
200
|
after do
|
201
|
-
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")
|
202
202
|
end
|
203
203
|
|
204
204
|
it "create symlink with status stop (K) and a priority " do
|