summaryrefslogtreecommitdiff
path: root/lib/chef
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 /lib/chef
parentcdad2f684debda15e8cf773185e78f93892eda35 (diff)
downloadchef-0bdd618fc5146dad3fa5a90d10a4b5e608e4663d.tar.gz
fix Style/UnneededInterpolation
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef')
-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
16 files changed, 22 insertions, 22 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