summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-07-02 10:32:45 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2018-07-02 10:32:45 -0700
commit0bdd618fc5146dad3fa5a90d10a4b5e608e4663d (patch)
tree54e82256ba2c4d10f6a67164222ae46010e324f4
parentcdad2f684debda15e8cf773185e78f93892eda35 (diff)
downloadchef-0bdd618fc5146dad3fa5a90d10a4b5e608e4663d.tar.gz
fix Style/UnneededInterpolation
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/application/client.rb2
-rw-r--r--lib/chef/application/solo.rb2
-rw-r--r--lib/chef/application/windows_service.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb2
-rw-r--r--lib/chef/formatters/doc.rb2
-rw-r--r--lib/chef/formatters/error_inspectors/resource_failure_inspector.rb2
-rw-r--r--lib/chef/http/auth_credentials.rb2
-rw-r--r--lib/chef/http/http_request.rb2
-rw-r--r--lib/chef/knife/cookbook_site_share.rb2
-rw-r--r--lib/chef/knife/core/status_presenter.rb2
-rw-r--r--lib/chef/knife/data_bag_from_file.rb2
-rw-r--r--lib/chef/provider/http_request.rb12
-rw-r--r--lib/chef/provider/mount/mount.rb2
-rw-r--r--lib/chef/provider/service/openbsd.rb2
-rw-r--r--lib/chef/provider/user/dscl.rb2
-rw-r--r--lib/chef/resource_definition.rb2
-rwxr-xr-xspec/functional/resource/aixinit_service_spec.rb2
-rw-r--r--spec/functional/resource/dsc_script_spec.rb2
-rw-r--r--spec/functional/resource/template_spec.rb2
-rw-r--r--spec/functional/resource/windows_env_spec.rb2
-rw-r--r--spec/functional/resource/yum_package_spec.rb2
-rw-r--r--spec/unit/chef_fs/data_handler/data_bag_item_data_handler.rb2
-rw-r--r--spec/unit/mixin/powershell_type_coercions_spec.rb2
-rw-r--r--spec/unit/mixin/xml_escape_spec.rb2
-rw-r--r--spec/unit/property_spec.rb2
-rw-r--r--spec/unit/provider/mount/mount_spec.rb16
-rw-r--r--spec/unit/provider/package/cab_spec.rb16
-rw-r--r--spec/unit/provider/service/macosx_spec.rb6
-rw-r--r--spec/unit/provider/service/openbsd_service_spec.rb2
-rw-r--r--spec/unit/provider/service/simple_service_spec.rb4
-rw-r--r--spec/unit/provider/service/systemd_service_spec.rb10
-rw-r--r--spec/unit/provider/service/windows_spec.rb6
-rw-r--r--spec/unit/provider/systemd_unit_spec.rb8
-rw-r--r--tasks/dependencies.rb4
34 files changed, 67 insertions, 67 deletions
diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb
index 7e376fdd9f..6e574e682f 100644
--- a/lib/chef/application/client.rb
+++ b/lib/chef/application/client.rb
@@ -517,7 +517,7 @@ class Chef::Application::Client < Chef::Application
def unforked_interval_error_message
"Unforked chef-client interval runs are disabled in Chef 12." +
"\nConfiguration settings:" +
- "#{"\n interval = #{Chef::Config[:interval]} seconds" if Chef::Config[:interval]}" +
+ ("\n interval = #{Chef::Config[:interval]} seconds" if Chef::Config[:interval]).to_s +
"\nEnable chef-client interval runs by setting `:client_fork = true` in your config file or adding `--fork` to your command line options."
end
diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb
index 3ea8774169..cd364dc6ae 100644
--- a/lib/chef/application/solo.rb
+++ b/lib/chef/application/solo.rb
@@ -370,7 +370,7 @@ EOH
def unforked_interval_error_message
"Unforked chef-client interval runs are disabled in Chef 12." +
"\nConfiguration settings:" +
- "#{"\n interval = #{Chef::Config[:interval]} seconds" if Chef::Config[:interval]}" +
+ ("\n interval = #{Chef::Config[:interval]} seconds" if Chef::Config[:interval]).to_s +
"\nEnable chef-client interval runs by setting `:client_fork = true` in your config file or adding `--fork` to your command line options."
end
end
diff --git a/lib/chef/application/windows_service.rb b/lib/chef/application/windows_service.rb
index 7ebfa762df..5fe4dbb9b7 100644
--- a/lib/chef/application/windows_service.rb
+++ b/lib/chef/application/windows_service.rb
@@ -200,8 +200,8 @@ class Chef
timeout: Chef::Config[:windows_service][:watchdog_timeout],
logger: Chef::Log
)
- Chef::Log.trace "#{result.stdout}"
- Chef::Log.trace "#{result.stderr}"
+ Chef::Log.trace (result.stdout).to_s
+ Chef::Log.trace (result.stderr).to_s
rescue Mixlib::ShellOut::CommandTimeout => e
Chef::Log.error "chef-client timed out\n(#{e})"
Chef::Log.error(<<-EOF)
diff --git a/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb b/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb
index c16c5ad4d7..876ad7282b 100644
--- a/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb
@@ -177,7 +177,7 @@ class Chef
if data_handler
object = data_handler.normalize_for_put(object, self)
data_handler.verify_integrity(object, self) do |error|
- raise Chef::ChefFS::FileSystem::OperationFailedError.new(:write, self, nil, "#{error}")
+ raise Chef::ChefFS::FileSystem::OperationFailedError.new(:write, self, nil, error.to_s)
end
end
diff --git a/lib/chef/formatters/doc.rb b/lib/chef/formatters/doc.rb
index d498ef7c72..19a6fafae6 100644
--- a/lib/chef/formatters/doc.rb
+++ b/lib/chef/formatters/doc.rb
@@ -254,7 +254,7 @@ class Chef
puts_line ""
puts_line "Audit phase exception:"
indent
- puts_line "#{error.message}"
+ puts_line (error.message).to_s
if error.backtrace
error.backtrace.each do |l|
puts_line l
diff --git a/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb b/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb
index 94ecce88de..1cc147db7a 100644
--- a/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb
+++ b/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb
@@ -43,7 +43,7 @@ class Chef
error_description.section("Resource Declaration:", resource.sensitive ? "suppressed sensitive resource output" : recipe_snippet)
end
- error_description.section("Compiled Resource:", "#{resource.to_text}")
+ error_description.section("Compiled Resource:", (resource.to_text).to_s)
# Template errors get wrapped in an exception class that can show the relevant template code,
# so add them to the error output.
diff --git a/lib/chef/http/auth_credentials.rb b/lib/chef/http/auth_credentials.rb
index e84f6a0c5b..547b5c8a83 100644
--- a/lib/chef/http/auth_credentials.rb
+++ b/lib/chef/http/auth_credentials.rb
@@ -51,7 +51,7 @@ class Chef
sign_obj = Mixlib::Authentication::SignedHeaderAuth.signing_object(request_params)
signed = sign_obj.sign(key, use_ssh_agent: @use_ssh_agent).merge({ host: host })
- signed.inject({}) { |memo, kv| memo["#{kv[0].to_s.upcase}"] = kv[1]; memo }
+ signed.inject({}) { |memo, kv| memo[(kv[0].to_s.upcase).to_s] = kv[1]; memo }
end
end
diff --git a/lib/chef/http/http_request.rb b/lib/chef/http/http_request.rb
index 475043bdb4..774419a58c 100644
--- a/lib/chef/http/http_request.rb
+++ b/lib/chef/http/http_request.rb
@@ -152,7 +152,7 @@ class Chef
end
def configure_http_request(request_body = nil)
- req_path = "#{path}"
+ req_path = (path).to_s
req_path << "?#{query}" if query
@http_request = case method.to_s.downcase
diff --git a/lib/chef/knife/cookbook_site_share.rb b/lib/chef/knife/cookbook_site_share.rb
index 144085c2a2..b97887ae69 100644
--- a/lib/chef/knife/cookbook_site_share.rb
+++ b/lib/chef/knife/cookbook_site_share.rb
@@ -140,7 +140,7 @@ class Chef
ui.error "The same version of this cookbook already exists on Supermarket."
exit(1)
else
- ui.error "#{res['error_messages'][0]}"
+ ui.error (res['error_messages'][0]).to_s
exit(1)
end
else
diff --git a/lib/chef/knife/core/status_presenter.rb b/lib/chef/knife/core/status_presenter.rb
index 4bb27d1277..711c6b8087 100644
--- a/lib/chef/knife/core/status_presenter.rb
+++ b/lib/chef/knife/core/status_presenter.rb
@@ -101,7 +101,7 @@ class Chef
fqdn = (node[:ec2] && node[:ec2][:public_hostname]) || node[:fqdn]
name = node["name"] || node.name
- run_list = "#{node['run_list']}" if config[:run_list]
+ run_list = (node['run_list']).to_s if config[:run_list]
line_parts = Array.new
if node["ohai_time"]
diff --git a/lib/chef/knife/data_bag_from_file.rb b/lib/chef/knife/data_bag_from_file.rb
index 3e8d3b6f59..91adcb3129 100644
--- a/lib/chef/knife/data_bag_from_file.rb
+++ b/lib/chef/knife/data_bag_from_file.rb
@@ -84,7 +84,7 @@ class Chef
items ||= find_all_data_bag_items(data_bag)
item_paths = normalize_item_paths(items)
item_paths.each do |item_path|
- item = loader.load_from("#{data_bags_path}", data_bag, item_path)
+ item = loader.load_from((data_bags_path).to_s, data_bag, item_path)
item = if encryption_secret_provided?
Chef::EncryptedDataBagItem.encrypt_data_bag_item(item, read_secret)
else
diff --git a/lib/chef/provider/http_request.rb b/lib/chef/provider/http_request.rb
index 885d473a7a..e8aad1e896 100644
--- a/lib/chef/provider/http_request.rb
+++ b/lib/chef/provider/http_request.rb
@@ -37,7 +37,7 @@ class Chef
# CHEF-4762: we expect a nil return value from Chef::HTTP for a "200 Success" response
# and false for a "304 Not Modified" response
modified = @http.head(
- "#{new_resource.url}",
+ (new_resource.url).to_s,
new_resource.headers
)
logger.info("#{new_resource} HEAD to #{new_resource.url} successful")
@@ -54,7 +54,7 @@ class Chef
message = check_message(new_resource.message)
body = @http.get(
- "#{new_resource.url}",
+ (new_resource.url).to_s,
new_resource.headers
)
logger.info("#{new_resource} GET to #{new_resource.url} successful")
@@ -67,7 +67,7 @@ class Chef
converge_by("#{new_resource} PATCH to #{new_resource.url}") do
message = check_message(new_resource.message)
body = @http.patch(
- "#{new_resource.url}",
+ (new_resource.url).to_s,
message,
new_resource.headers
)
@@ -81,7 +81,7 @@ class Chef
converge_by("#{new_resource} PUT to #{new_resource.url}") do
message = check_message(new_resource.message)
body = @http.put(
- "#{new_resource.url}",
+ (new_resource.url).to_s,
message,
new_resource.headers
)
@@ -95,7 +95,7 @@ class Chef
converge_by("#{new_resource} POST to #{new_resource.url}") do
message = check_message(new_resource.message)
body = @http.post(
- "#{new_resource.url}",
+ (new_resource.url).to_s,
message,
new_resource.headers
)
@@ -108,7 +108,7 @@ class Chef
def action_delete
converge_by("#{new_resource} DELETE to #{new_resource.url}") do
body = @http.delete(
- "#{new_resource.url}",
+ (new_resource.url).to_s,
new_resource.headers
)
new_resource.updated_by_last_action(true)
diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb
index d0da30a30a..52d55f5404 100644
--- a/lib/chef/provider/mount/mount.rb
+++ b/lib/chef/provider/mount/mount.rb
@@ -232,7 +232,7 @@ class Chef
def device_logstring
case @new_resource.device_type
when :device
- "#{device_real}"
+ (device_real).to_s
when :label
"#{device_real} with label #{@new_resource.device}"
when :uuid
diff --git a/lib/chef/provider/service/openbsd.rb b/lib/chef/provider/service/openbsd.rb
index 552173fbee..b0bddaddbc 100644
--- a/lib/chef/provider/service/openbsd.rb
+++ b/lib/chef/provider/service/openbsd.rb
@@ -116,7 +116,7 @@ class Chef
old_list = rc_conf_local.match(/^pkg_scripts="(.*)"/)
old_list = old_list ? old_list[1].split(" ") : []
new_list = old_list - [new_resource.service_name]
- update_rcl rc_conf_local.sub(/^pkg_scripts="(.*)"/, pkg_scripts = "#{new_list.join(' ')}")
+ update_rcl rc_conf_local.sub(/^pkg_scripts="(.*)"/, pkg_scripts = (new_list.join(' ')).to_s)
end
end
end
diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb
index c22329d0d6..9584e20656 100644
--- a/lib/chef/provider/user/dscl.rb
+++ b/lib/chef/provider/user/dscl.rb
@@ -326,7 +326,7 @@ user password using shadow hash.")
end
def ditto_home
- shell_out!("/usr/sbin/createhomedir", "-c", "-u", "#{new_resource.username}")
+ shell_out!("/usr/sbin/createhomedir", "-c", "-u", (new_resource.username).to_s)
end
def move_home
diff --git a/lib/chef/resource_definition.rb b/lib/chef/resource_definition.rb
index aa114af46c..af22a5389e 100644
--- a/lib/chef/resource_definition.rb
+++ b/lib/chef/resource_definition.rb
@@ -62,7 +62,7 @@ class Chef
end
def to_s
- "#{name}"
+ (name).to_s
end
end
end
diff --git a/spec/functional/resource/aixinit_service_spec.rb b/spec/functional/resource/aixinit_service_spec.rb
index 3241a1b3cb..68ea5ab8b2 100755
--- a/spec/functional/resource/aixinit_service_spec.rb
+++ b/spec/functional/resource/aixinit_service_spec.rb
@@ -70,7 +70,7 @@ describe Chef::Resource::Service, :requires_root, :aix_only do
before(:all) do
File.delete("/etc/rc.d/init.d/chefinittest") if File.exists?("/etc/rc.d/init.d/chefinittest")
- FileUtils.cp("#{File.join(File.dirname(__FILE__), "/../assets/chefinittest")}", "/etc/rc.d/init.d/chefinittest")
+ FileUtils.cp((File.join(File.dirname(__FILE__), "/../assets/chefinittest")).to_s, "/etc/rc.d/init.d/chefinittest")
end
after(:all) do
diff --git a/spec/functional/resource/dsc_script_spec.rb b/spec/functional/resource/dsc_script_spec.rb
index e9301d4231..1caa07d105 100644
--- a/spec/functional/resource/dsc_script_spec.rb
+++ b/spec/functional/resource/dsc_script_spec.rb
@@ -347,7 +347,7 @@ EOH
shared_examples_for "a dsc_script with configuration data that takes parameters" do
let(:dsc_user_code) { dsc_user_param_code }
let(:config_param_section) { config_params }
- let(:config_flags) { { :"#{dsc_user_prefix_param_name}" => "#{dsc_user_prefix}", :"#{dsc_user_suffix_param_name}" => "#{dsc_user_suffix}" } }
+ let(:config_flags) { { :"#{dsc_user_prefix_param_name}" => (dsc_user_prefix).to_s, :"#{dsc_user_suffix_param_name}" => (dsc_user_suffix).to_s } }
it "does not directly contain the user name" do
configuration_script_content = ::File.open(dsc_test_resource.command) do |file|
file.read
diff --git a/spec/functional/resource/template_spec.rb b/spec/functional/resource/template_spec.rb
index 243b66311b..679ffe661a 100644
--- a/spec/functional/resource/template_spec.rb
+++ b/spec/functional/resource/template_spec.rb
@@ -112,7 +112,7 @@ describe Chef::Resource::Template do
context "using single helper syntax referencing @node" do
before do
node.normal[:helper_test_attr] = "value from helper method"
- resource.helper(:helper_method) { "#{@node[:helper_test_attr]}" }
+ resource.helper(:helper_method) { (@node[:helper_test_attr]).to_s }
end
it_behaves_like "a template with helpers"
diff --git a/spec/functional/resource/windows_env_spec.rb b/spec/functional/resource/windows_env_spec.rb
index a6c6b39970..e5f2032795 100644
--- a/spec/functional/resource/windows_env_spec.rb
+++ b/spec/functional/resource/windows_env_spec.rb
@@ -188,7 +188,7 @@ describe Chef::Resource::WindowsEnv, :windows_only do
test_resource.value("#{path_before};#{env_val}")
test_resource.run_action(:create)
expect(ENV["PATH"]).not_to include(env_val)
- expect(ENV["PATH"]).to include("#{random_name}")
+ expect(ENV["PATH"]).to include((random_name).to_s)
end
after(:each) do
diff --git a/spec/functional/resource/yum_package_spec.rb b/spec/functional/resource/yum_package_spec.rb
index 8b49ec4080..5075c24ea0 100644
--- a/spec/functional/resource/yum_package_spec.rb
+++ b/spec/functional/resource/yum_package_spec.rb
@@ -289,7 +289,7 @@ describe Chef::Resource::YumPackage, :requires_root, external: exclude_test do
it "installs with 64-bit arch in the property" do
flush_cache
yum_package.package_name("chef_rpm")
- yum_package.arch("#{pkg_arch}")
+ yum_package.arch((pkg_arch).to_s)
yum_package.run_action(:install)
expect(yum_package.updated_by_last_action?).to be true
expect(shell_out("rpm -q --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n' chef_rpm").stdout.chomp).to match("^chef_rpm-1.10-1.#{pkg_arch}$")
diff --git a/spec/unit/chef_fs/data_handler/data_bag_item_data_handler.rb b/spec/unit/chef_fs/data_handler/data_bag_item_data_handler.rb
index 6d6e2fb0e6..60cd5c6cb7 100644
--- a/spec/unit/chef_fs/data_handler/data_bag_item_data_handler.rb
+++ b/spec/unit/chef_fs/data_handler/data_bag_item_data_handler.rb
@@ -68,7 +68,7 @@ describe Chef::ChefFS::DataHandler::DataBagItemDataHandler do
context "using a reserved word as part of the data bag name" do
%w{xnode rolex xenvironmentx xclientx}.each do |bag_name|
- let(:entry) { TestDataBagItem.new("#{bag_name}", "bag") }
+ let(:entry) { TestDataBagItem.new(bag_name.to_s, "bag") }
let(:object) do
{ "raw_data" => { "id" => "bag" } }
end
diff --git a/spec/unit/mixin/powershell_type_coercions_spec.rb b/spec/unit/mixin/powershell_type_coercions_spec.rb
index 159a0a8d1d..210267ba19 100644
--- a/spec/unit/mixin/powershell_type_coercions_spec.rb
+++ b/spec/unit/mixin/powershell_type_coercions_spec.rb
@@ -34,7 +34,7 @@ describe Chef::Mixin::PowershellTypeCoercions do
["'", '"', "#", "`"].each do |c|
it "base64 encodes a string that contains #{c}" do
- expect(test_class.translate_type("#{c}")).to match(Base64.strict_encode64(c))
+ expect(test_class.translate_type(c.to_s)).to match(Base64.strict_encode64(c))
end
end
diff --git a/spec/unit/mixin/xml_escape_spec.rb b/spec/unit/mixin/xml_escape_spec.rb
index 495ad0662c..761cab60c8 100644
--- a/spec/unit/mixin/xml_escape_spec.rb
+++ b/spec/unit/mixin/xml_escape_spec.rb
@@ -49,6 +49,6 @@ describe Chef::Mixin::XMLEscape do
end
it "converts win 1252 characters correctly" do
- expect(@escaper.xml_escape("#{0x80.chr}")).to eq("&#8364;")
+ expect(@escaper.xml_escape((0x80.chr).to_s)).to eq("&#8364;")
end
end
diff --git a/spec/unit/property_spec.rb b/spec/unit/property_spec.rb
index 463f9469c6..793bb3248f 100644
--- a/spec/unit/property_spec.rb
+++ b/spec/unit/property_spec.rb
@@ -64,7 +64,7 @@ describe "Chef::Resource.property" do
if properties.size == 1
description = "With property #{properties.first}"
else
- description = "With properties #{english_join(properties.map { |property| "#{property.inspect}" })}"
+ description = "With properties #{english_join(properties.map { |property| (property.inspect).to_s })}"
end
context description, *tags do
before do
diff --git a/spec/unit/provider/mount/mount_spec.rb b/spec/unit/provider/mount/mount_spec.rb
index 18523e3bc6..562dbcdc5d 100644
--- a/spec/unit/provider/mount/mount_spec.rb
+++ b/spec/unit/provider/mount/mount_spec.rb
@@ -136,8 +136,8 @@ describe Chef::Provider::Mount::Mount do
# expand the target path to correct specs on Windows
target = ::File.expand_path("/dev/mapper/target")
- allow(::File).to receive(:symlink?).with("#{@new_resource.device}").and_return(true)
- allow(::File).to receive(:readlink).with("#{@new_resource.device}").and_return(target)
+ allow(::File).to receive(:symlink?).with((@new_resource.device).to_s).and_return(true)
+ allow(::File).to receive(:readlink).with((@new_resource.device).to_s).and_return(target)
allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: "#{target} on /tmp/foo type ext3 (rw)\n"))
@provider.load_current_resource()
@@ -150,8 +150,8 @@ describe Chef::Provider::Mount::Mount do
# expand the target path to correct specs on Windows
absolute_target = ::File.expand_path("/dev/xsdz1")
- allow(::File).to receive(:symlink?).with("#{@new_resource.device}").and_return(true)
- allow(::File).to receive(:readlink).with("#{@new_resource.device}").and_return(target)
+ allow(::File).to receive(:symlink?).with((@new_resource.device).to_s).and_return(true)
+ allow(::File).to receive(:readlink).with((@new_resource.device).to_s).and_return(target)
allow(@provider).to receive(:shell_out!).and_return(OpenStruct.new(stdout: "#{absolute_target} on /tmp/foo type ext3 (rw)\n"))
@provider.load_current_resource()
@@ -205,8 +205,8 @@ describe Chef::Provider::Mount::Mount do
it "should set enabled to true if the symlink target is in fstab" do
target = "/dev/mapper/target"
- allow(::File).to receive(:symlink?).with("#{@new_resource.device}").and_return(true)
- allow(::File).to receive(:readlink).with("#{@new_resource.device}").and_return(target)
+ allow(::File).to receive(:symlink?).with((@new_resource.device).to_s).and_return(true)
+ allow(::File).to receive(:readlink).with((@new_resource.device).to_s).and_return(target)
fstab = "/dev/sdz1 /tmp/foo ext3 defaults 1 2\n"
@@ -219,8 +219,8 @@ describe Chef::Provider::Mount::Mount do
it "should set enabled to true if the symlink target is relative and is in fstab - CHEF-4957" do
target = "xsdz1"
- allow(::File).to receive(:symlink?).with("#{@new_resource.device}").and_return(true)
- allow(::File).to receive(:readlink).with("#{@new_resource.device}").and_return(target)
+ allow(::File).to receive(:symlink?).with((@new_resource.device).to_s).and_return(true)
+ allow(::File).to receive(:readlink).with((@new_resource.device).to_s).and_return(target)
fstab = "/dev/sdz1 /tmp/foo ext3 defaults 1 2\n"
diff --git a/spec/unit/provider/package/cab_spec.rb b/spec/unit/provider/package/cab_spec.rb
index 9c5865ec31..619240de23 100644
--- a/spec/unit/provider/package/cab_spec.rb
+++ b/spec/unit/provider/package/cab_spec.rb
@@ -49,7 +49,7 @@ describe Chef::Provider::Package::Cab do
end
before do
- new_resource.source = File.join("#{ENV['TEMP']}", "test6.1-kb2664825-v3-x64.cab")
+ new_resource.source = File.join((ENV['TEMP']).to_s, "test6.1-kb2664825-v3-x64.cab")
installed_package_list_obj = double(stdout: installed_package_list_stdout)
allow(provider).to receive(:dism_command).with("/Get-Packages").and_return(installed_package_list_obj)
package_version_obj = double(stdout: package_version_stdout)
@@ -151,9 +151,9 @@ describe Chef::Provider::Package::Cab do
allow(Chef::FileCache).to receive(:create_cache_path).and_return(ENV["TEMP"])
path = provider.default_download_cache_path
if windows?
- expect(path).to be == File.join("#{ENV['TEMP']}", "\\", "Test6.1-KB2664825-v3-x64.cab")
+ expect(path).to be == File.join((ENV['TEMP']).to_s, "\\", "Test6.1-KB2664825-v3-x64.cab")
else
- expect(path).to be == File.join("#{ENV['TEMP']}", "Test6.1-KB2664825-v3-x64.cab")
+ expect(path).to be == File.join((ENV['TEMP']).to_s, "Test6.1-KB2664825-v3-x64.cab")
end
end
end
@@ -161,12 +161,12 @@ describe Chef::Provider::Package::Cab do
describe "#cab_file_source" do
context "when local file path is set" do
it "returns local cab file source path" do
- new_resource.source = File.join("#{ENV['TEMP']}", "test6.1-kb2664825-v3-x64.cab")
+ new_resource.source = File.join((ENV['TEMP']).to_s, "test6.1-kb2664825-v3-x64.cab")
path = provider.cab_file_source
if windows?
- expect(path).to be == File.join("#{ENV['TEMP'].downcase}", "\\", "test6.1-kb2664825-v3-x64.cab")
+ expect(path).to be == File.join((ENV['TEMP'].downcase).to_s, "\\", "test6.1-kb2664825-v3-x64.cab")
else
- expect(path).to be == File.join("#{ENV['TEMP']}", "test6.1-kb2664825-v3-x64.cab")
+ expect(path).to be == File.join((ENV['TEMP']).to_s, "test6.1-kb2664825-v3-x64.cab")
end
end
end
@@ -174,9 +174,9 @@ describe Chef::Provider::Package::Cab do
it "calls download_source_file method" do
new_resource.source = "https://www.something.com/test6.1-kb2664825-v3-x64.cab"
if windows?
- expect(provider).to receive(:download_source_file).and_return(File.join("#{ENV['TEMP'].downcase}", "\\", "test6.1-kb2664825-v3-x64.cab"))
+ expect(provider).to receive(:download_source_file).and_return(File.join((ENV['TEMP'].downcase).to_s, "\\", "test6.1-kb2664825-v3-x64.cab"))
else
- expect(provider).to receive(:download_source_file).and_return(File.join("#{ENV['TEMP']}", "test6.1-kb2664825-v3-x64.cab"))
+ expect(provider).to receive(:download_source_file).and_return(File.join((ENV['TEMP']).to_s, "test6.1-kb2664825-v3-x64.cab"))
end
provider.cab_file_source
end
diff --git a/spec/unit/provider/service/macosx_spec.rb b/spec/unit/provider/service/macosx_spec.rb
index d6aeed2daf..9864fb0185 100644
--- a/spec/unit/provider/service/macosx_spec.rb
+++ b/spec/unit/provider/service/macosx_spec.rb
@@ -167,7 +167,7 @@ SVC_LIST
describe "running unsupported actions" do
before do
- allow(Dir).to receive(:glob).and_return(["#{plist}"], [])
+ allow(Dir).to receive(:glob).and_return([(plist).to_s], [])
allow(File).to receive(:exists?).and_return([true], [])
end
it "should throw an exception when reload action is attempted" do
@@ -226,7 +226,7 @@ SVC_LIST
context "and plist for service is available" do
before do
- allow(Dir).to receive(:glob).and_return(["#{plist}"], [])
+ allow(Dir).to receive(:glob).and_return([(plist).to_s], [])
provider.load_current_resource
end
@@ -237,7 +237,7 @@ SVC_LIST
describe "and several plists match service name" do
it "throws exception" do
- allow(Dir).to receive(:glob).and_return(["#{plist}",
+ allow(Dir).to receive(:glob).and_return([(plist).to_s,
"/Users/wtf/something.plist"])
provider.load_current_resource
provider.define_resource_requirements
diff --git a/spec/unit/provider/service/openbsd_service_spec.rb b/spec/unit/provider/service/openbsd_service_spec.rb
index 38283f609d..913fddc1cf 100644
--- a/spec/unit/provider/service/openbsd_service_spec.rb
+++ b/spec/unit/provider/service/openbsd_service_spec.rb
@@ -189,7 +189,7 @@ describe Chef::Provider::Service::Openbsd do
let(:lines) do
[
%Q{#{provider.builtin_service_enable_variable_name}_thing="YES"},
- %Q{#{provider.builtin_service_enable_variable_name}},
+ (provider.builtin_service_enable_variable_name).to_s,
] end
it "sets enabled based on the exact match (false)" do
provider.determine_enabled_status!
diff --git a/spec/unit/provider/service/simple_service_spec.rb b/spec/unit/provider/service/simple_service_spec.rb
index 4481a7c0e3..0529462d2f 100644
--- a/spec/unit/provider/service/simple_service_spec.rb
+++ b/spec/unit/provider/service/simple_service_spec.rb
@@ -106,8 +106,8 @@ NOMOCKINGSTRINGSPLZ
describe "when starting the service" do
it "should call the start command if one is specified" do
- @new_resource.start_command("#{@new_resource.start_command}")
- expect(@provider).to receive(:shell_out!).with("#{@new_resource.start_command}", default_env: false)
+ @new_resource.start_command((@new_resource.start_command).to_s)
+ expect(@provider).to receive(:shell_out!).with((@new_resource.start_command).to_s, default_env: false)
@provider.start_service()
end
diff --git a/spec/unit/provider/service/systemd_service_spec.rb b/spec/unit/provider/service/systemd_service_spec.rb
index ccd814a3a9..15b79922b0 100644
--- a/spec/unit/provider/service/systemd_service_spec.rb
+++ b/spec/unit/provider/service/systemd_service_spec.rb
@@ -264,7 +264,7 @@ describe Chef::Provider::Service::Systemd do
before(:each) do
provider.current_resource = current_resource
current_resource.service_name(service_name)
- allow(provider).to receive(:which).with("systemctl").and_return("#{systemctl_path}")
+ allow(provider).to receive(:which).with("systemctl").and_return(systemctl_path.to_s)
end
it "should call '#{systemctl_path} --system enable service_name' to enable the service" do
@@ -282,7 +282,7 @@ describe Chef::Provider::Service::Systemd do
before(:each) do
provider.current_resource = current_resource
current_resource.service_name(service_name)
- allow(provider).to receive(:which).with("systemctl").and_return("#{systemctl_path}")
+ allow(provider).to receive(:which).with("systemctl").and_return(systemctl_path.to_s)
end
it "should call '#{systemctl_path} --system mask service_name' to mask the service" do
@@ -300,7 +300,7 @@ describe Chef::Provider::Service::Systemd do
before(:each) do
provider.current_resource = current_resource
current_resource.service_name(service_name)
- allow(provider).to receive(:which).with("systemctl").and_return("#{systemctl_path}")
+ allow(provider).to receive(:which).with("systemctl").and_return(systemctl_path.to_s)
end
it "should return true if '#{systemctl_path} --system is-active service_name' returns 0" do
@@ -318,7 +318,7 @@ describe Chef::Provider::Service::Systemd do
before(:each) do
provider.current_resource = current_resource
current_resource.service_name(service_name)
- allow(provider).to receive(:which).with("systemctl").and_return("#{systemctl_path}")
+ allow(provider).to receive(:which).with("systemctl").and_return(systemctl_path.to_s)
end
it "should return true if '#{systemctl_path} --system is-enabled service_name' returns 0" do
@@ -336,7 +336,7 @@ describe Chef::Provider::Service::Systemd do
before(:each) do
provider.current_resource = current_resource
current_resource.service_name(service_name)
- allow(provider).to receive(:which).with("systemctl").and_return("#{systemctl_path}")
+ allow(provider).to receive(:which).with("systemctl").and_return(systemctl_path.to_s)
end
it "should return true if '#{systemctl_path} --system is-enabled service_name' returns 'masked' and returns anything except 0" do
diff --git a/spec/unit/provider/service/windows_spec.rb b/spec/unit/provider/service/windows_spec.rb
index 978d180026..dd59089418 100644
--- a/spec/unit/provider/service/windows_spec.rb
+++ b/spec/unit/provider/service/windows_spec.rb
@@ -508,7 +508,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "calls the start command if one is specified" do
new_resource.start_command "sc start #{chef_service_name}"
- expect(provider).to receive(:shell_out!).with("#{new_resource.start_command}").and_return("Starting custom service")
+ expect(provider).to receive(:shell_out!).with((new_resource.start_command).to_s).and_return("Starting custom service")
provider.start_service
expect(new_resource.updated_by_last_action?).to be_truthy
end
@@ -603,7 +603,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "calls the stop command if one is specified" do
new_resource.stop_command "sc stop #{chef_service_name}"
- expect(provider).to receive(:shell_out!).with("#{new_resource.stop_command}").and_return("Stopping custom service")
+ expect(provider).to receive(:shell_out!).with((new_resource.stop_command).to_s).and_return("Stopping custom service")
provider.stop_service
expect(new_resource.updated_by_last_action?).to be_truthy
end
@@ -676,7 +676,7 @@ describe Chef::Provider::Service::Windows, "load_current_resource", :windows_onl
it "calls the restart command if one is specified" do
new_resource.restart_command "sc restart"
- expect(provider).to receive(:shell_out!).with("#{new_resource.restart_command}")
+ expect(provider).to receive(:shell_out!).with((new_resource.restart_command).to_s)
provider.restart_service
expect(new_resource.updated_by_last_action?).to be_truthy
end
diff --git a/spec/unit/provider/systemd_unit_spec.rb b/spec/unit/provider/systemd_unit_spec.rb
index 8c42c41420..93f624933f 100644
--- a/spec/unit/provider/systemd_unit_spec.rb
+++ b/spec/unit/provider/systemd_unit_spec.rb
@@ -803,7 +803,7 @@ describe Chef::Provider::SystemdUnit do
describe "#active?" do
before(:each) do
provider.current_resource = current_resource
- allow(provider).to receive(:which).with("systemctl").and_return("#{systemctl_path}")
+ allow(provider).to receive(:which).with("systemctl").and_return(systemctl_path.to_s)
end
context "when a user is specified" do
@@ -844,7 +844,7 @@ describe Chef::Provider::SystemdUnit do
describe "#enabled?" do
before(:each) do
provider.current_resource = current_resource
- allow(provider).to receive(:which).with("systemctl").and_return("#{systemctl_path}")
+ allow(provider).to receive(:which).with("systemctl").and_return(systemctl_path.to_s)
end
context "when a user is specified" do
@@ -885,7 +885,7 @@ describe Chef::Provider::SystemdUnit do
describe "#masked?" do
before(:each) do
provider.current_resource = current_resource
- allow(provider).to receive(:which).with("systemctl").and_return("#{systemctl_path}")
+ allow(provider).to receive(:which).with("systemctl").and_return(systemctl_path.to_s)
end
context "when a user is specified" do
@@ -926,7 +926,7 @@ describe Chef::Provider::SystemdUnit do
describe "#static?" do
before(:each) do
provider.current_resource = current_resource
- allow(provider).to receive(:which).with("systemctl").and_return("#{systemctl_path}")
+ allow(provider).to receive(:which).with("systemctl").and_return(systemctl_path.to_s)
end
context "when a user is specified" do
diff --git a/tasks/dependencies.rb b/tasks/dependencies.rb
index 12beab9808..562ec50b81 100644
--- a/tasks/dependencies.rb
+++ b/tasks/dependencies.rb
@@ -25,14 +25,14 @@ namespace :dependencies do
desc "Update all dependencies. dependencies:update to update as little as possible."
task :update do |t, rake_args|
# FIXME: probably broken, and needs less indirection
- system("#{File.join(Dir.pwd, "ci", "dependency_update.sh")}")
+ system((File.join(Dir.pwd, "ci", "dependency_update.sh")).to_s)
end
desc "Force update (when adding new gems to Gemfiles)"
task :force_update do |t, rake_args|
# FIXME: probably broken, and needs less indirection
FileUtils.rm_f(File.join(Dir.pwd, ".bundle", "config"))
- system("#{File.join(Dir.pwd, "ci", "dependency_update.sh")}")
+ system((File.join(Dir.pwd, "ci", "dependency_update.sh")).to_s)
end
# Update all dependencies to the latest constraint-matching version