summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/application/windows_service.rb4
-rw-r--r--lib/chef/application/windows_service_manager.rb2
-rw-r--r--lib/chef/chef_fs/data_handler/container_data_handler.rb2
-rw-r--r--lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb2
-rw-r--r--lib/chef/chef_fs/data_handler/data_handler_base.rb2
-rw-r--r--lib/chef/chef_fs/data_handler/organization_data_handler.rb2
-rw-r--r--lib/chef/chef_fs/data_handler/policy_data_handler.rb4
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb4
-rw-r--r--lib/chef/client.rb2
-rw-r--r--lib/chef/cookbook/cookbook_version_loader.rb2
-rw-r--r--lib/chef/cookbook/remote_file_vendor.rb2
-rw-r--r--lib/chef/cookbook/synchronizer.rb2
-rw-r--r--lib/chef/cookbook_uploader.rb2
-rw-r--r--lib/chef/data_bag_item.rb2
-rw-r--r--lib/chef/encrypted_data_bag_item.rb2
-rw-r--r--lib/chef/encrypted_data_bag_item/decryptor.rb4
-rw-r--r--lib/chef/event_loggers/base.rb2
-rw-r--r--lib/chef/exceptions.rb4
-rw-r--r--lib/chef/formatters/base.rb2
-rw-r--r--lib/chef/formatters/indentable_output_stream.rb2
-rw-r--r--lib/chef/http/json_output.rb2
-rw-r--r--lib/chef/knife.rb2
-rw-r--r--lib/chef/knife/cookbook_download.rb2
-rw-r--r--lib/chef/knife/cookbook_upload.rb6
-rw-r--r--lib/chef/knife/core/gem_glob_loader.rb2
-rw-r--r--lib/chef/knife/core/generic_presenter.rb2
-rw-r--r--lib/chef/knife/core/node_presenter.rb30
-rw-r--r--lib/chef/knife/core/object_loader.rb2
-rw-r--r--lib/chef/knife/core/status_presenter.rb8
-rw-r--r--lib/chef/knife/core/ui.rb8
-rw-r--r--lib/chef/knife/deps.rb4
-rw-r--r--lib/chef/knife/key_list.rb2
-rw-r--r--lib/chef/knife/node_edit.rb2
-rw-r--r--lib/chef/knife/ssh.rb8
-rw-r--r--lib/chef/knife/supermarket_download.rb2
-rw-r--r--lib/chef/knife/supermarket_show.rb2
-rw-r--r--lib/chef/mixin/powershell_out.rb2
-rw-r--r--lib/chef/mixin/powershell_type_coercions.rb4
-rw-r--r--lib/chef/platform/rebooter.rb2
-rw-r--r--lib/chef/platform/service_helpers.rb2
-rw-r--r--lib/chef/policy_builder/expand_node_object.rb2
-rw-r--r--lib/chef/policy_builder/policyfile.rb4
-rw-r--r--lib/chef/provider/dsc_script.rb2
-rw-r--r--lib/chef/provider/file.rb2
-rw-r--r--lib/chef/provider/git.rb2
-rw-r--r--lib/chef/provider/group.rb6
-rw-r--r--lib/chef/provider/group/dscl.rb6
-rw-r--r--lib/chef/provider/group/groupmod.rb2
-rw-r--r--lib/chef/provider/group/pw.rb6
-rw-r--r--lib/chef/provider/group/suse.rb4
-rw-r--r--lib/chef/provider/group/windows.rb2
-rw-r--r--lib/chef/provider/ifconfig.rb8
-rw-r--r--lib/chef/provider/mount/aix.rb4
-rw-r--r--lib/chef/provider/mount/mount.rb2
-rw-r--r--lib/chef/provider/mount/solaris.rb2
-rw-r--r--lib/chef/provider/package.rb8
-rw-r--r--lib/chef/provider/package/cab.rb4
-rw-r--r--lib/chef/provider/package/chocolatey.rb4
-rw-r--r--lib/chef/provider/package/dnf.rb2
-rw-r--r--lib/chef/provider/package/dpkg.rb6
-rw-r--r--lib/chef/provider/package/freebsd/pkgng.rb2
-rw-r--r--lib/chef/provider/package/homebrew.rb2
-rw-r--r--lib/chef/provider/package/msu.rb2
-rw-r--r--lib/chef/provider/package/openbsd.rb2
-rw-r--r--lib/chef/provider/package/portage.rb4
-rw-r--r--lib/chef/provider/package/powershell.rb4
-rw-r--r--lib/chef/provider/package/rubygems.rb6
-rw-r--r--lib/chef/provider/package/yum.rb2
-rw-r--r--lib/chef/provider/registry_key.rb2
-rw-r--r--lib/chef/provider/route.rb4
-rw-r--r--lib/chef/provider/service/arch.rb2
-rw-r--r--lib/chef/provider/service/openbsd.rb4
-rw-r--r--lib/chef/provider/service/redhat.rb4
-rw-r--r--lib/chef/provider/user/dscl.rb2
-rw-r--r--lib/chef/provider/windows_task.rb2
-rw-r--r--lib/chef/resource/build_essential.rb4
-rw-r--r--lib/chef/resource/chef_gem.rb4
-rw-r--r--lib/chef/resource/chocolatey_config.rb4
-rw-r--r--lib/chef/resource/chocolatey_feature.rb4
-rw-r--r--lib/chef/resource/chocolatey_source.rb4
-rw-r--r--lib/chef/resource/dsc_resource.rb2
-rw-r--r--lib/chef/resource/homebrew_tap.rb2
-rw-r--r--lib/chef/resource/locale.rb4
-rw-r--r--lib/chef/resource/swap_file.rb2
-rw-r--r--lib/chef/resource/sysctl.rb16
-rw-r--r--lib/chef/resource/windows_certificate.rb2
-rw-r--r--lib/chef/resource/windows_dfs_folder.rb12
-rw-r--r--lib/chef/resource/windows_dfs_namespace.rb12
-rw-r--r--lib/chef/resource/windows_dfs_server.rb4
-rw-r--r--lib/chef/resource/windows_feature_dism.rb22
-rw-r--r--lib/chef/resource/windows_feature_powershell.rb24
-rw-r--r--lib/chef/resource/windows_firewall_rule.rb4
-rw-r--r--lib/chef/resource/windows_share.rb2
-rw-r--r--lib/chef/resource/windows_task.rb4
-rw-r--r--lib/chef/shell/shell_session.rb2
-rw-r--r--lib/chef/train_transport.rb4
-rw-r--r--lib/chef/util/dsc/configuration_generator.rb2
-rw-r--r--lib/chef/util/dsc/local_configuration_manager.rb4
-rw-r--r--lib/chef/version_constraint.rb2
-rw-r--r--lib/chef/win32/security/sid.rb8
-rw-r--r--lib/chef/win32/version.rb2
103 files changed, 213 insertions, 213 deletions
diff --git a/lib/chef/application/windows_service.rb b/lib/chef/application/windows_service.rb
index 8a942103f1..04a8812efc 100644
--- a/lib/chef/application/windows_service.rb
+++ b/lib/chef/application/windows_service.rb
@@ -40,7 +40,7 @@ class Chef
option :config_file,
short: "-c CONFIG",
long: "--config CONFIG",
- default: "#{ENV['SYSTEMDRIVE']}/chef/client.rb",
+ default: "#{ENV["SYSTEMDRIVE"]}/chef/client.rb",
description: "The configuration file to use for #{Chef::Dist::PRODUCT} runs."
option :log_location,
@@ -60,7 +60,7 @@ class Chef
description: "Set the number of seconds to wait between #{Chef::Dist::PRODUCT} runs.",
proc: lambda { |s| s.to_i }
- DEFAULT_LOG_LOCATION ||= "#{ENV['SYSTEMDRIVE']}/chef/client.log".freeze
+ DEFAULT_LOG_LOCATION ||= "#{ENV["SYSTEMDRIVE"]}/chef/client.log".freeze
def service_init
@service_action_mutex = Mutex.new
diff --git a/lib/chef/application/windows_service_manager.rb b/lib/chef/application/windows_service_manager.rb
index ace8d9d90a..a43c29d072 100644
--- a/lib/chef/application/windows_service_manager.rb
+++ b/lib/chef/application/windows_service_manager.rb
@@ -46,7 +46,7 @@ class Chef
option :config_file,
short: "-c CONFIG",
long: "--config CONFIG",
- default: "#{ENV['SYSTEMDRIVE']}/chef/client.rb",
+ default: "#{ENV["SYSTEMDRIVE"]}/chef/client.rb",
description: "The configuration file to use for #{Chef::Dist::PRODUCT} runs."
option :log_location,
diff --git a/lib/chef/chef_fs/data_handler/container_data_handler.rb b/lib/chef/chef_fs/data_handler/container_data_handler.rb
index 63663ea4ae..25bdf73b04 100644
--- a/lib/chef/chef_fs/data_handler/container_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/container_data_handler.rb
@@ -24,7 +24,7 @@ class Chef
def verify_integrity(object, entry)
base_name = remove_dot_json(entry.name)
if object["containername"] != base_name
- yield("Name in #{entry.path_for_printing} must be '#{base_name}' (is '#{object['containername']}')")
+ yield("Name in #{entry.path_for_printing} must be '#{base_name}' (is '#{object["containername"]}')")
end
end
diff --git a/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb b/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb
index 855bb06dd7..bb42b89cfd 100644
--- a/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb
@@ -54,7 +54,7 @@ class Chef
def verify_integrity(object, entry)
base_name = remove_dot_json(entry.name)
if object["raw_data"]["id"] != base_name
- yield("ID in #{entry.path_for_printing} must be '#{base_name}' (is '#{object['raw_data']['id']}')")
+ yield("ID in #{entry.path_for_printing} must be '#{base_name}' (is '#{object["raw_data"]["id"]}')")
elsif entry.parent.name =~ RESERVED_NAMES
yield("Data bag name ('#{entry.parent.name}') must not match #{RESERVED_NAMES.inspect}")
end
diff --git a/lib/chef/chef_fs/data_handler/data_handler_base.rb b/lib/chef/chef_fs/data_handler/data_handler_base.rb
index febf0daf4b..d51e54e8ab 100644
--- a/lib/chef/chef_fs/data_handler/data_handler_base.rb
+++ b/lib/chef/chef_fs/data_handler/data_handler_base.rb
@@ -197,7 +197,7 @@ class Chef
def verify_integrity(object, entry)
base_name = remove_file_extension(entry.name)
if object["name"] != base_name
- yield("Name must be '#{base_name}' (is '#{object['name']}')")
+ yield("Name must be '#{base_name}' (is '#{object["name"]}')")
end
end
diff --git a/lib/chef/chef_fs/data_handler/organization_data_handler.rb b/lib/chef/chef_fs/data_handler/organization_data_handler.rb
index ebac7051f7..f107e8920b 100644
--- a/lib/chef/chef_fs/data_handler/organization_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/organization_data_handler.rb
@@ -27,7 +27,7 @@ class Chef
# @yieldparam [s<string>] error message
def verify_integrity(object, entry)
if entry.org != object["name"]
- yield("Name must be '#{entry.org}' (is '#{object['name']}')")
+ yield("Name must be '#{entry.org}' (is '#{object["name"]}')")
end
end
end
diff --git a/lib/chef/chef_fs/data_handler/policy_data_handler.rb b/lib/chef/chef_fs/data_handler/policy_data_handler.rb
index 082dc9ec09..8ae749af73 100644
--- a/lib/chef/chef_fs/data_handler/policy_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/policy_data_handler.rb
@@ -35,11 +35,11 @@ class Chef
def verify_integrity(object_data, entry)
name, revision = name_and_revision(entry.name)
if object_data["name"] != name
- yield("Object name '#{object_data['name']}' doesn't match entry '#{name}'.")
+ yield("Object name '#{object_data["name"]}' doesn't match entry '#{name}'.")
end
if object_data["revision_id"] != revision
- yield("Object revision ID '#{object_data['revision_id']}' doesn't match entry '#{revision}'.")
+ yield("Object revision ID '#{object_data["revision_id"]}' doesn't match entry '#{revision}'.")
end
end
end
diff --git a/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb b/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb
index 6c1610876c..273b45a646 100644
--- a/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/cookbook_artifacts_dir.rb
@@ -44,7 +44,7 @@ class Chef
result = []
root.get_json("#{api_path}/?num_versions=all").each_pair do |cookbook_name, cookbooks|
cookbooks["versions"].each do |cookbook_version|
- result << CookbookArtifactDir.new("#{cookbook_name}-#{cookbook_version['identifier']}", self)
+ result << CookbookArtifactDir.new("#{cookbook_name}-#{cookbook_version["identifier"]}", self)
end
end
result.sort_by(&:name)
diff --git a/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb b/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb
index 5973e01e41..0fd1e4acdf 100644
--- a/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb
@@ -50,7 +50,7 @@ class Chef
result = []
root.get_json("#{api_path}/?num_versions=all").each_pair do |cookbook_name, cookbooks|
cookbooks["versions"].each do |cookbook_version|
- result << VersionedCookbookDir.new("#{cookbook_name}-#{cookbook_version['version']}", self)
+ result << VersionedCookbookDir.new("#{cookbook_name}-#{cookbook_version["version"]}", self)
end
end
result.sort_by(&:name)
diff --git a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb
index 2af4a9dd52..31a8a2da80 100644
--- a/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb
+++ b/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb
@@ -140,7 +140,7 @@ class Chef
# Used to print out a human-readable file system description
def fs_description
repo_paths = root_paths || [ File.dirname(child_paths["cookbooks"][0]) ]
- result = "repository at #{repo_paths.join(', ')}\n"
+ result = "repository at #{repo_paths.join(", ")}\n"
if versioned_cookbooks
result << " Multiple versions per cookbook\n"
else
@@ -148,7 +148,7 @@ class Chef
end
child_paths.each_pair do |name, paths|
if paths.any? { |path| !repo_paths.include?(File.dirname(path)) }
- result << " #{name} at #{paths.join(', ')}\n"
+ result << " #{name} at #{paths.join(", ")}\n"
end
end
result
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index d0d6b0dd4c..06370f5d07 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -911,7 +911,7 @@ class Chef
# Chef::Config[:cookbook_path] can be a string or an array
# if it's an array, go through it and check each one, raise error at the last one if no files are found
cookbook_paths = Array(Chef::Config[:cookbook_path])
- logger.trace "Loading from cookbook_path: #{cookbook_paths.map { |path| File.expand_path(path) }.join(', ')}"
+ logger.trace "Loading from cookbook_path: #{cookbook_paths.map { |path| File.expand_path(path) }.join(", ")}"
if cookbook_paths.all? { |path| empty_directory?(path) }
msg = "None of the cookbook paths set in Chef::Config[:cookbook_path], #{cookbook_paths.inspect}, contain any cookbooks"
logger.fatal(msg)
diff --git a/lib/chef/cookbook/cookbook_version_loader.rb b/lib/chef/cookbook/cookbook_version_loader.rb
index 0b62718ab9..ecdfa7ba57 100644
--- a/lib/chef/cookbook/cookbook_version_loader.rb
+++ b/lib/chef/cookbook/cookbook_version_loader.rb
@@ -178,7 +178,7 @@ class Chef
# actually empty, a metadata error here would be misleading, so don't
# raise it (if called by #load!, a different error is raised).
if !empty? && !metadata.valid?
- message = "Cookbook loaded at path [#{cookbook_path}] has invalid metadata: #{metadata.errors.join('; ')}"
+ message = "Cookbook loaded at path [#{cookbook_path}] has invalid metadata: #{metadata.errors.join("; ")}"
raise Exceptions::MetadataNotValid, message
end
false
diff --git a/lib/chef/cookbook/remote_file_vendor.rb b/lib/chef/cookbook/remote_file_vendor.rb
index e5270018fb..dc308b4bf5 100644
--- a/lib/chef/cookbook/remote_file_vendor.rb
+++ b/lib/chef/cookbook/remote_file_vendor.rb
@@ -69,7 +69,7 @@ class Chef
Chef::FileCache.move_to(raw_file.path, cache_filename)
else
Chef::Log.trace("Not fetching #{cache_filename}, as the cache is up to date.")
- Chef::Log.trace("Current checksum: #{current_checksum}; manifest checksum: #{found_manifest_record['checksum']})")
+ Chef::Log.trace("Current checksum: #{current_checksum}; manifest checksum: #{found_manifest_record["checksum"]})")
end
full_path_cache_filename = Chef::FileCache.load(cache_filename, false)
diff --git a/lib/chef/cookbook/synchronizer.rb b/lib/chef/cookbook/synchronizer.rb
index 342fc89f16..62cc39d483 100644
--- a/lib/chef/cookbook/synchronizer.rb
+++ b/lib/chef/cookbook/synchronizer.rb
@@ -163,7 +163,7 @@ class Chef
# === Returns
# true:: Always returns true
def sync_cookbooks
- Chef::Log.info("Loading cookbooks [#{cookbooks.map { |ckbk| ckbk.name + '@' + ckbk.version }.join(', ')}]")
+ Chef::Log.info("Loading cookbooks [#{cookbooks.map { |ckbk| ckbk.name + "@" + ckbk.version }.join(", ")}]")
Chef::Log.trace("Cookbooks detail: #{cookbooks.inspect}")
clear_obsoleted_cookbooks
diff --git a/lib/chef/cookbook_uploader.rb b/lib/chef/cookbook_uploader.rb
index 9aeecf7716..479a26a3f0 100644
--- a/lib/chef/cookbook_uploader.rb
+++ b/lib/chef/cookbook_uploader.rb
@@ -68,7 +68,7 @@ class Chef
new_sandbox["checksums"].each do |checksum, info|
if info["needs_upload"] == true
checksums_to_upload << checksum
- Chef::Log.info("Uploading #{checksum_files[checksum]} (checksum hex = #{checksum}) to #{info['url']}")
+ Chef::Log.info("Uploading #{checksum_files[checksum]} (checksum hex = #{checksum}) to #{info["url"]}")
queue << uploader_function_for(checksum_files[checksum], checksum, info["url"], checksums_to_upload)
else
Chef::Log.trace("#{checksum_files[checksum]} has not changed")
diff --git a/lib/chef/data_bag_item.rb b/lib/chef/data_bag_item.rb
index 2690fcbe51..789afd44a2 100644
--- a/lib/chef/data_bag_item.rb
+++ b/lib/chef/data_bag_item.rb
@@ -197,7 +197,7 @@ class Chef
end
def inspect
- "data_bag_item[#{data_bag.inspect}, #{raw_data['id'].inspect}, #{raw_data.inspect}]"
+ "data_bag_item[#{data_bag.inspect}, #{raw_data["id"].inspect}, #{raw_data.inspect}]"
end
def pretty_print(pretty_printer)
diff --git a/lib/chef/encrypted_data_bag_item.rb b/lib/chef/encrypted_data_bag_item.rb
index d1928d195b..667bec0b8f 100644
--- a/lib/chef/encrypted_data_bag_item.rb
+++ b/lib/chef/encrypted_data_bag_item.rb
@@ -131,7 +131,7 @@ class Chef::EncryptedDataBagItem
def self.load_secret(path = nil)
path ||= Chef::Config[:encrypted_data_bag_secret]
unless path
- raise ArgumentError, "No secret specified and no secret found at #{Chef::Config.platform_specific_path(Chef::Dist::CONF_DIR + '/encrypted_data_bag_secret')}"
+ raise ArgumentError, "No secret specified and no secret found at #{Chef::Config.platform_specific_path(Chef::Dist::CONF_DIR + "/encrypted_data_bag_secret")}"
end
secret = case path
diff --git a/lib/chef/encrypted_data_bag_item/decryptor.rb b/lib/chef/encrypted_data_bag_item/decryptor.rb
index 900a8b7f04..1ddc99391d 100644
--- a/lib/chef/encrypted_data_bag_item/decryptor.rb
+++ b/lib/chef/encrypted_data_bag_item/decryptor.rb
@@ -94,7 +94,7 @@ class Chef::EncryptedDataBagItem
plaintext << openssl_decryptor.final
rescue OpenSSL::Cipher::CipherError => e
# if the key length is less than 255 characters, and it contains slashes, we think it may be a path.
- raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect. #{(@key.length < 255 && @key.include?('/')) ? 'You may need to use --secret-file rather than --secret.' : ''}"
+ raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect. #{(@key.length < 255 && @key.include?("/")) ? "You may need to use --secret-file rather than --secret." : ""}"
end
end
@@ -147,7 +147,7 @@ class Chef::EncryptedDataBagItem
plaintext << openssl_decryptor.final
rescue OpenSSL::Cipher::CipherError => e
# if the key length is less than 255 characters, and it contains slashes, we think it may be a path.
- raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect. #{( @key.length < 255 && @key.include?('/')) ? 'You may need to use --secret-file rather than --secret.' : ''}"
+ raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect. #{( @key.length < 255 && @key.include?("/")) ? "You may need to use --secret-file rather than --secret." : ""}"
end
end
diff --git a/lib/chef/event_loggers/base.rb b/lib/chef/event_loggers/base.rb
index 89eac20fc9..b1a2f84988 100644
--- a/lib/chef/event_loggers/base.rb
+++ b/lib/chef/event_loggers/base.rb
@@ -43,7 +43,7 @@ class Chef
def self.new(name)
event_logger_class = by_name(name.to_s)
- raise UnknownEventLogger, "No event logger found for #{name} (available: #{available_event_loggers.join(', ')})" unless event_logger_class
+ raise UnknownEventLogger, "No event logger found for #{name} (available: #{available_event_loggers.join(", ")})" unless event_logger_class
raise UnavailableEventLogger unless available_event_loggers.include? name.to_s
event_logger_class.new
diff --git a/lib/chef/exceptions.rb b/lib/chef/exceptions.rb
index 65ba0ae340..2d7ac374cb 100644
--- a/lib/chef/exceptions.rb
+++ b/lib/chef/exceptions.rb
@@ -493,9 +493,9 @@ class Chef
@resources_found = resources_found
matches_info = @resources_found.each do |r|
if r["Module"].nil?
- "Resource #{r['Name']} was found in #{r['Module']['Name']}"
+ "Resource #{r["Name"]} was found in #{r["Module"]["Name"]}"
else
- "Resource #{r['Name']} is a binary resource"
+ "Resource #{r["Name"]} is a binary resource"
end
end
super "Found multiple resources matching #{matches_info[0]["Module"]["Name"]}:\n#{(matches_info.map { |f| f["Module"]["Version"] }).uniq.join("\n")}"
diff --git a/lib/chef/formatters/base.rb b/lib/chef/formatters/base.rb
index 0a2e14abd3..3cf04f952e 100644
--- a/lib/chef/formatters/base.rb
+++ b/lib/chef/formatters/base.rb
@@ -52,7 +52,7 @@ class Chef
# TODO: is it too clever to be defining new() on a module like this?
def self.new(name, out, err)
formatter_class = by_name(name.to_s)
- raise UnknownFormatter, "No output formatter found for #{name} (available: #{available_formatters.join(', ')})" unless formatter_class
+ raise UnknownFormatter, "No output formatter found for #{name} (available: #{available_formatters.join(", ")})" unless formatter_class
formatter_class.new(out, err)
end
diff --git a/lib/chef/formatters/indentable_output_stream.rb b/lib/chef/formatters/indentable_output_stream.rb
index e4ad600436..5d58df6f11 100644
--- a/lib/chef/formatters/indentable_output_stream.rb
+++ b/lib/chef/formatters/indentable_output_stream.rb
@@ -161,7 +161,7 @@ class Chef
# the indents.
if options[:name]
if @current_stream != options[:stream]
- @out.print "#{(' ' * indent)}[#{options[:name]}] "
+ @out.print "#{(" " * indent)}[#{options[:name]}] "
else
@out.print " " * (indent + 3 + options[:name].size)
end
diff --git a/lib/chef/http/json_output.rb b/lib/chef/http/json_output.rb
index f2c3e81f95..62fa379096 100644
--- a/lib/chef/http/json_output.rb
+++ b/lib/chef/http/json_output.rb
@@ -61,7 +61,7 @@ class Chef
end
[http_response, rest_request, return_value]
else
- Chef::Log.trace("Expected JSON response, but got content-type '#{http_response['content-type']}'")
+ Chef::Log.trace("Expected JSON response, but got content-type '#{http_response["content-type"]}'")
if http_response.body
Chef::Log.trace("Response body contains:\n#{http_response.body.length < 256 ? http_response.body : http_response.body[0..256] + " [...truncated...]"}")
end
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb
index 86d54ecb98..0617c79e8e 100644
--- a/lib/chef/knife.rb
+++ b/lib/chef/knife.rb
@@ -265,7 +265,7 @@ class Chef
# user could not be resolved to a subcommand.
# @api private
def subcommand_not_found!(args)
- ui.fatal("Cannot find subcommand for: '#{args.join(' ')}'")
+ ui.fatal("Cannot find subcommand for: '#{args.join(" ")}'")
# Mention rehash when the subcommands cache(plugin_manifest.json) is used
if subcommand_loader.is_a?(Chef::Knife::SubcommandLoader::HashedCommandLoader)
diff --git a/lib/chef/knife/cookbook_download.rb b/lib/chef/knife/cookbook_download.rb
index 2da5e138a3..aa6458a5d0 100644
--- a/lib/chef/knife/cookbook_download.rb
+++ b/lib/chef/knife/cookbook_download.rb
@@ -87,7 +87,7 @@ class Chef
ui.info("Downloading #{segment}")
files.each do |segment_file|
dest = File.join(basedir, segment_file["path"].gsub("/", File::SEPARATOR))
- Chef::Log.trace("Downloading #{segment_file['path']} to #{dest}")
+ Chef::Log.trace("Downloading #{segment_file["path"]} to #{dest}")
FileUtils.mkdir_p(File.dirname(dest))
tempfile = rest.streaming_request(segment_file["url"])
FileUtils.mv(tempfile.path, dest)
diff --git a/lib/chef/knife/cookbook_upload.rb b/lib/chef/knife/cookbook_upload.rb
index 1aeb097991..ef66cc16c7 100644
--- a/lib/chef/knife/cookbook_upload.rb
+++ b/lib/chef/knife/cookbook_upload.rb
@@ -224,7 +224,7 @@ class Chef
broken_filenames = Array(broken_files).map { |path, info| path }
ui.error "The cookbook #{cookbook.name} has one or more broken files"
ui.error "This is probably caused by broken symlinks in the cookbook directory"
- ui.error "The broken file(s) are: #{broken_filenames.join(' ')}"
+ ui.error "The broken file(s) are: #{broken_filenames.join(" ")}"
exit 1
end
end
@@ -240,7 +240,7 @@ class Chef
missing_cookbook_names = missing_dependencies.map { |cookbook_name, version| "'#{cookbook_name}' version '#{version}'" }
ui.error "Cookbook #{cookbook.name} depends on cookbooks which are not currently"
ui.error "being uploaded and cannot be found on the server."
- ui.error "The missing cookbook(s) are: #{missing_cookbook_names.join(', ')}"
+ ui.error "The missing cookbook(s) are: #{missing_cookbook_names.join(", ")}"
exit 1
end
end
@@ -253,7 +253,7 @@ class Chef
Log.debug "Versions of cookbook '#{cookbook_name}' returned by the server: #{versions.join(", ")}"
@server_side_cookbooks[cookbook_name]["versions"].each do |versions_hash|
if Chef::VersionConstraint.new(version).include?(versions_hash["version"])
- Log.debug "Matched cookbook '#{cookbook_name}' with constraint '#{version}' to cookbook version '#{versions_hash['version']}' on the server"
+ Log.debug "Matched cookbook '#{cookbook_name}' with constraint '#{version}' to cookbook version '#{versions_hash["version"]}' on the server"
return true
end
end
diff --git a/lib/chef/knife/core/gem_glob_loader.rb b/lib/chef/knife/core/gem_glob_loader.rb
index 15707dee2e..6b969c695f 100644
--- a/lib/chef/knife/core/gem_glob_loader.rb
+++ b/lib/chef/knife/core/gem_glob_loader.rb
@@ -111,7 +111,7 @@ class Chef
def check_spec_for_glob(spec, glob)
dirs = if spec.require_paths.size > 1
- "{#{spec.require_paths.join(',')}}"
+ "{#{spec.require_paths.join(",")}}"
else
spec.require_paths.first
end
diff --git a/lib/chef/knife/core/generic_presenter.rb b/lib/chef/knife/core/generic_presenter.rb
index e219e29707..fe8a84b753 100644
--- a/lib/chef/knife/core/generic_presenter.rb
+++ b/lib/chef/knife/core/generic_presenter.rb
@@ -220,7 +220,7 @@ class Chef
end
key_length = versions_by_cookbook.empty? ? 0 : versions_by_cookbook.keys.map { |name| name.size }.max + 2
versions_by_cookbook.sort.map do |cookbook, versions|
- "#{cookbook.ljust(key_length)} #{versions.join(' ')}"
+ "#{cookbook.ljust(key_length)} #{versions.join(" ")}"
end
end
end
diff --git a/lib/chef/knife/core/node_presenter.rb b/lib/chef/knife/core/node_presenter.rb
index 3f1feb9d16..258a4822fd 100644
--- a/lib/chef/knife/core/node_presenter.rb
+++ b/lib/chef/knife/core/node_presenter.rb
@@ -98,47 +98,47 @@ class Chef
ip = (node[:ec2] && node[:ec2][:public_ipv4]) || node[:ipaddress]
summarized = <<~SUMMARY
- #{ui.color('Node Name:', :bold)} #{ui.color(node.name, :bold)}
+ #{ui.color("Node Name:", :bold)} #{ui.color(node.name, :bold)}
SUMMARY
show_policy = !(node.policy_name.nil? && node.policy_group.nil?)
if show_policy
summarized << <<~POLICY
- #{key('Policy Name:')} #{node.policy_name}
- #{key('Policy Group:')} #{node.policy_group}
+ #{key("Policy Name:")} #{node.policy_name}
+ #{key("Policy Group:")} #{node.policy_group}
POLICY
else
summarized << <<~ENV
- #{key('Environment:')} #{node.chef_environment}
+ #{key("Environment:")} #{node.chef_environment}
ENV
end
summarized << <<~SUMMARY
- #{key('FQDN:')} #{node[:fqdn]}
- #{key('IP:')} #{ip}
- #{key('Run List:')} #{node.run_list}
+ #{key("FQDN:")} #{node[:fqdn]}
+ #{key("IP:")} #{ip}
+ #{key("Run List:")} #{node.run_list}
SUMMARY
unless show_policy
summarized << <<~ROLES
- #{key('Roles:')} #{Array(node[:roles]).join(', ')}
+ #{key("Roles:")} #{Array(node[:roles]).join(", ")}
ROLES
end
summarized << <<~SUMMARY
- #{key('Recipes:')} #{Array(node[:recipes]).join(', ')}
- #{key('Platform:')} #{node[:platform]} #{node[:platform_version]}
- #{key('Tags:')} #{node.tags.join(', ')}
+ #{key("Recipes:")} #{Array(node[:recipes]).join(", ")}
+ #{key("Platform:")} #{node[:platform]} #{node[:platform_version]}
+ #{key("Tags:")} #{node.tags.join(", ")}
SUMMARY
if config[:medium_output] || config[:long_output]
summarized += <<~MORE
- #{key('Attributes:')}
+ #{key("Attributes:")}
#{text_format(node.normal_attrs)}
MORE
end
if config[:long_output]
summarized += <<~MOST
- #{key('Default Attributes:')}
+ #{key("Default Attributes:")}
#{text_format(node.default_attrs)}
- #{key('Override Attributes:')}
+ #{key("Override Attributes:")}
#{text_format(node.override_attrs)}
- #{key('Automatic Attributes (Ohai Data):')}
+ #{key("Automatic Attributes (Ohai Data):")}
#{text_format(node.automatic_attrs)}
MOST
end
diff --git a/lib/chef/knife/core/object_loader.rb b/lib/chef/knife/core/object_loader.rb
index 94b956be04..087213fadf 100644
--- a/lib/chef/knife/core/object_loader.rb
+++ b/lib/chef/knife/core/object_loader.rb
@@ -40,7 +40,7 @@ class Chef
def load_from(repo_location, *components)
unless object_file = find_file(repo_location, *components)
- ui.error "Could not find or open file '#{components.last}' in current directory or in '#{repo_location}/#{components.join('/')}'"
+ ui.error "Could not find or open file '#{components.last}' in current directory or in '#{repo_location}/#{components.join("/")}'"
exit 1
end
object_from_file(object_file)
diff --git a/lib/chef/knife/core/status_presenter.rb b/lib/chef/knife/core/status_presenter.rb
index 8bf419e49a..562bd7b0e9 100644
--- a/lib/chef/knife/core/status_presenter.rb
+++ b/lib/chef/knife/core/status_presenter.rb
@@ -112,9 +112,9 @@ class Chef
if node["ohai_time"]
hours, minutes, seconds = time_difference_in_hms(node["ohai_time"])
- hours_text = "#{hours} hour#{hours == 1 ? ' ' : 's'}"
- minutes_text = "#{minutes} minute#{minutes == 1 ? ' ' : 's'}"
- seconds_text = "#{seconds} second#{seconds == 1 ? ' ' : 's'}"
+ hours_text = "#{hours} hour#{hours == 1 ? " " : "s"}"
+ minutes_text = "#{minutes} minute#{minutes == 1 ? " " : "s"}"
+ seconds_text = "#{seconds} second#{seconds == 1 ? " " : "s"}"
if hours > 24
color = :red
text = hours_text
@@ -140,7 +140,7 @@ class Chef
if node["platform"]
platform = node["platform"].dup
if node["platform_version"]
- platform << " #{node['platform_version']}"
+ platform << " #{node["platform_version"]}"
end
line_parts << platform
end
diff --git a/lib/chef/knife/core/ui.rb b/lib/chef/knife/core/ui.rb
index 88fb5dfac8..41fb37c220 100644
--- a/lib/chef/knife/core/ui.rb
+++ b/lib/chef/knife/core/ui.rb
@@ -108,28 +108,28 @@ class Chef
#
# @param message [String] the text string
def debug(message)
- log("#{color('DEBUG:', :blue, :bold)} #{message}")
+ log("#{color("DEBUG:", :blue, :bold)} #{message}")
end
# Print a warning message
#
# @param message [String] the text string
def warn(message)
- log("#{color('WARNING:', :yellow, :bold)} #{message}")
+ log("#{color("WARNING:", :yellow, :bold)} #{message}")
end
# Print an error message
#
# @param message [String] the text string
def error(message)
- log("#{color('ERROR:', :red, :bold)} #{message}")
+ log("#{color("ERROR:", :red, :bold)} #{message}")
end
# Print a message describing a fatal error.
#
# @param message [String] the text string
def fatal(message)
- log("#{color('FATAL:', :red, :bold)} #{message}")
+ log("#{color("FATAL:", :red, :bold)} #{message}")
end
def color(string, *colors)
diff --git a/lib/chef/knife/deps.rb b/lib/chef/knife/deps.rb
index 021cf902d5..f620b53bfa 100644
--- a/lib/chef/knife/deps.rb
+++ b/lib/chef/knife/deps.rb
@@ -79,7 +79,7 @@ class Chef
def print_dependencies_tree(entry, dependencies, printed = {}, depth = 0)
dependencies[entry.path] = get_dependencies(entry) unless dependencies[entry.path]
- output "#{' ' * depth}#{format_path(entry)}"
+ output "#{" " * depth}#{format_path(entry)}"
if !printed[entry.path] && (config[:recurse] || depth == 0)
printed[entry.path] = true
dependencies[entry.path].each do |child|
@@ -97,7 +97,7 @@ class Chef
node = Chef::JSONCompat.parse(entry.read)
result = []
if node["chef_environment"] && node["chef_environment"] != "_default"
- result << "/environments/#{node['chef_environment']}.json"
+ result << "/environments/#{node["chef_environment"]}.json"
end
if node["run_list"]
result += dependencies_from_runlist(node["run_list"])
diff --git a/lib/chef/knife/key_list.rb b/lib/chef/knife/key_list.rb
index aefb1928df..2ffafc63ed 100644
--- a/lib/chef/knife/key_list.rb
+++ b/lib/chef/knife/key_list.rb
@@ -71,7 +71,7 @@ class Chef
next if !key["expired"] && @config[:only_expired]
next if key["expired"] && @config[:only_non_expired]
- display = "#{colorize(key['name'].ljust(max_length))} #{key['uri']}"
+ display = "#{colorize(key["name"].ljust(max_length))} #{key["uri"]}"
display = "#{display} (expired)" if key["expired"]
display_info(display)
end
diff --git a/lib/chef/knife/node_edit.rb b/lib/chef/knife/node_edit.rb
index d0b9239e28..ca3b54c2a5 100644
--- a/lib/chef/knife/node_edit.rb
+++ b/lib/chef/knife/node_edit.rb
@@ -46,7 +46,7 @@ class Chef
updated_node = node_editor.edit_node
if updated_values = node_editor.updated?
- ui.info "Saving updated #{updated_values.join(', ')} on node #{node.name}"
+ ui.info "Saving updated #{updated_values.join(", ")} on node #{node.name}"
updated_node.save
else
ui.info "Node not updated, skipping node save"
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb
index 26d1bb6458..2a4334570e 100644
--- a/lib/chef/knife/ssh.rb
+++ b/lib/chef/knife/ssh.rb
@@ -185,8 +185,8 @@ class Chef
if fqdns.count != fqdns.uniq.count
duplicated_fqdns = fqdns.uniq
ui.send(config[:duplicated_fqdns],
- "SSH #{duplicated_fqdns.count > 1 ? 'nodes are' : 'node is'} " +
- "duplicated: #{duplicated_fqdns.join(',')}")
+ "SSH #{duplicated_fqdns.count > 1 ? "nodes are" : "node is"} " +
+ "duplicated: #{duplicated_fqdns.join(",")}")
exit 10 if config[:duplicated_fqdns] == :fatal
end
end
@@ -397,7 +397,7 @@ class Chef
# line is input.
def read_line
loop do
- command = reader.readline("#{ui.color('knife-ssh>', :bold)} ", true)
+ command = reader.readline("#{ui.color("knife-ssh>", :bold)} ", true)
if command.nil?
command = "exit"
@@ -486,7 +486,7 @@ class Chef
end.join(" \\; ")
end
- tmux_name = "'knife ssh #{@name_args[0].tr(':.', '=-')}'"
+ tmux_name = "'knife ssh #{@name_args[0].tr(":.", "=-")}'"
begin
server = session.servers_for.first
cmd = ["tmux new-session -d -s #{tmux_name}",
diff --git a/lib/chef/knife/supermarket_download.rb b/lib/chef/knife/supermarket_download.rb
index b48126151f..8bd7b90add 100644
--- a/lib/chef/knife/supermarket_download.rb
+++ b/lib/chef/knife/supermarket_download.rb
@@ -115,7 +115,7 @@ class Chef
end
def specific_cookbook_version_url
- "#{cookbooks_api_url}/#{@name_args[0]}/versions/#{@name_args[1].tr('.', '_')}"
+ "#{cookbooks_api_url}/#{@name_args[0]}/versions/#{@name_args[1].tr(".", "_")}"
end
end
end
diff --git a/lib/chef/knife/supermarket_show.rb b/lib/chef/knife/supermarket_show.rb
index c3f0628029..8ef00fca2b 100644
--- a/lib/chef/knife/supermarket_show.rb
+++ b/lib/chef/knife/supermarket_show.rb
@@ -45,7 +45,7 @@ class Chef
when 1
noauth_rest.get("#{supermarket_uri}/cookbooks/#{@name_args[0]}")
when 2
- noauth_rest.get("#{supermarket_uri}/cookbooks/#{@name_args[0]}/versions/#{name_args[1].tr('.', '_')}")
+ noauth_rest.get("#{supermarket_uri}/cookbooks/#{@name_args[0]}/versions/#{name_args[1].tr(".", "_")}")
end
end
diff --git a/lib/chef/mixin/powershell_out.rb b/lib/chef/mixin/powershell_out.rb
index 3ef4cd84cc..1baece5527 100644
--- a/lib/chef/mixin/powershell_out.rb
+++ b/lib/chef/mixin/powershell_out.rb
@@ -91,7 +91,7 @@ class Chef
"-InputFormat None",
]
- "powershell.exe #{flags.join(' ')} -Command \"#{script.gsub('"', '\"')}\""
+ "powershell.exe #{flags.join(" ")} -Command \"#{script.gsub('"', '\"')}\""
end
end
end
diff --git a/lib/chef/mixin/powershell_type_coercions.rb b/lib/chef/mixin/powershell_type_coercions.rb
index 792ec18842..a75022c771 100644
--- a/lib/chef/mixin/powershell_type_coercions.rb
+++ b/lib/chef/mixin/powershell_type_coercions.rb
@@ -52,14 +52,14 @@ class Chef
translated = x.inject([]) do |memo, (k, v)|
memo << "#{k}=#{translate_type(v)}"
end
- "@{#{translated.join(';')}}"
+ "@{#{translated.join(";")}}"
end
def translate_array(x)
translated = x.map do |v|
translate_type(v)
end
- "@(#{translated.join(',')})"
+ "@(#{translated.join(",")})"
end
def unsafe?(s)
diff --git a/lib/chef/platform/rebooter.rb b/lib/chef/platform/rebooter.rb
index 386970186d..ad17ffad8c 100644
--- a/lib/chef/platform/rebooter.rb
+++ b/lib/chef/platform/rebooter.rb
@@ -38,7 +38,7 @@ class Chef
when Chef::Platform.windows?
# should this do /f as well? do we then need a minimum delay to let apps quit?
# Use explicit path to shutdown.exe, to protect against https://github.com/chef/chef/issues/5594
- windows_shutdown_path = "#{ENV['SYSTEMROOT']}/System32/shutdown.exe"
+ windows_shutdown_path = "#{ENV["SYSTEMROOT"]}/System32/shutdown.exe"
"#{windows_shutdown_path} /r /t #{reboot_info[:delay_mins] * 60} /c \"#{reboot_info[:reason]}\""
when node["os"] == "solaris2"
# SysV-flavored shutdown
diff --git a/lib/chef/platform/service_helpers.rb b/lib/chef/platform/service_helpers.rb
index dddddbe90e..851c3ebffc 100644
--- a/lib/chef/platform/service_helpers.rb
+++ b/lib/chef/platform/service_helpers.rb
@@ -108,7 +108,7 @@ class Chef
def has_systemd_service_unit?(svc_name)
%w{ /etc /usr/lib /lib /run }.any? do |load_path|
file_exist?(
- Chef.path_to("#{load_path}/systemd/system/#{svc_name.gsub(/@.*$/, '@')}.service")
+ Chef.path_to("#{load_path}/systemd/system/#{svc_name.gsub(/@.*$/, "@")}.service")
)
end
end
diff --git a/lib/chef/policy_builder/expand_node_object.rb b/lib/chef/policy_builder/expand_node_object.rb
index fceec9d873..706efd2e0b 100644
--- a/lib/chef/policy_builder/expand_node_object.rb
+++ b/lib/chef/policy_builder/expand_node_object.rb
@@ -139,7 +139,7 @@ class Chef
expand_run_list
Chef::Log.info("Run List is [#{node.run_list}]")
- Chef::Log.info("Run List expands to [#{@expanded_run_list_with_versions.join(', ')}]")
+ Chef::Log.info("Run List expands to [#{@expanded_run_list_with_versions.join(", ")}]")
events.node_load_completed(node, @expanded_run_list_with_versions, Chef::Config)
events.run_list_expanded(@run_list_expansion)
diff --git a/lib/chef/policy_builder/policyfile.rb b/lib/chef/policy_builder/policyfile.rb
index 88e5b48696..70a2e44635 100644
--- a/lib/chef/policy_builder/policyfile.rb
+++ b/lib/chef/policy_builder/policyfile.rb
@@ -156,7 +156,7 @@ class Chef
apply_policyfile_attributes
Chef::Log.info("Run List is [#{run_list}]")
- Chef::Log.info("Run List expands to [#{run_list_with_versions_for_display.join(', ')}]")
+ Chef::Log.info("Run List expands to [#{run_list_with_versions_for_display.join(", ")}]")
events.node_load_completed(node, run_list_with_versions_for_display, Chef::Config)
events.run_list_expanded(run_list_expansion_ish)
@@ -304,7 +304,7 @@ class Chef
if named_run_list_requested?
named_run_list || raise(ConfigurationError,
"Policy '#{retrieved_policy_name}' revision '#{revision_id}' does not have named_run_list '#{named_run_list_name}'" +
- "(available named_run_lists: [#{available_named_run_lists.join(', ')}])")
+ "(available named_run_lists: [#{available_named_run_lists.join(", ")}])")
else
policy["run_list"]
end
diff --git a/lib/chef/provider/dsc_script.rb b/lib/chef/provider/dsc_script.rb
index bffd9812f2..999ea9f33e 100644
--- a/lib/chef/provider/dsc_script.rb
+++ b/lib/chef/provider/dsc_script.rb
@@ -162,7 +162,7 @@ class Chef
# We ignore the last log message because it only contains the time it took, which looks weird
cleaned_messages = resource.change_log[0..-2].map { |c| c.sub(/^#{Regexp.escape(resource.name)}/, "").strip }
unless cleaned_messages.empty?
- "converge DSC resource #{resource.name} by #{cleaned_messages.find_all { |c| c != '' }.join("\n")}"
+ "converge DSC resource #{resource.name} by #{cleaned_messages.find_all { |c| c != "" }.join("\n")}"
else
"converge DSC resource #{resource.name}"
end
diff --git a/lib/chef/provider/file.rb b/lib/chef/provider/file.rb
index 0cd866d84b..054b9718c3 100644
--- a/lib/chef/provider/file.rb
+++ b/lib/chef/provider/file.rb
@@ -341,7 +341,7 @@ class Chef
if tempfile
new_resource.verify.each do |v|
unless v.verify(tempfile.path)
- raise Chef::Exceptions::ValidationFailed.new "Proposed content for #{new_resource.path} failed verification #{new_resource.sensitive ? '[sensitive]' : v}"
+ raise Chef::Exceptions::ValidationFailed.new "Proposed content for #{new_resource.path} failed verification #{new_resource.sensitive ? "[sensitive]" : v}"
end
end
end
diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb
index 16d1e54408..b7ca81b3f8 100644
--- a/lib/chef/provider/git.rb
+++ b/lib/chef/provider/git.rb
@@ -56,7 +56,7 @@ class Chef
"Deploying remote branches is not supported. " +
"Specify the remote branch as a local branch for " +
"the git repository you're deploying from " +
- "(ie: '#{new_resource.revision.gsub('origin/', '')}' rather than '#{new_resource.revision}')."
+ "(ie: '#{new_resource.revision.gsub("origin/", "")}' rather than '#{new_resource.revision}')."
end
requirements.assert(:all_actions) do |a|
diff --git a/lib/chef/provider/group.rb b/lib/chef/provider/group.rb
index c0396d9c6a..1c8a18c037 100644
--- a/lib/chef/provider/group.rb
+++ b/lib/chef/provider/group.rb
@@ -66,7 +66,7 @@ class Chef
if !new_resource.members.nil? && !new_resource.excluded_members.nil?
common_members = new_resource.members & new_resource.excluded_members
a.assertion { common_members.empty? }
- a.failure_message(Chef::Exceptions::ConflictingMembersInGroup, "Attempting to both add and remove users from a group: '#{common_members.join(', ')}'")
+ a.failure_message(Chef::Exceptions::ConflictingMembersInGroup, "Attempting to both add and remove users from a group: '#{common_members.join(", ")}'")
# No why-run alternative
end
end
@@ -93,7 +93,7 @@ class Chef
missing_members << member
end
unless missing_members.empty?
- @change_desc << "add missing member(s): #{missing_members.join(', ')}"
+ @change_desc << "add missing member(s): #{missing_members.join(", ")}"
end
members_to_be_removed = []
@@ -103,7 +103,7 @@ class Chef
end
end
unless members_to_be_removed.empty?
- @change_desc << "remove existing member(s): #{members_to_be_removed.join(', ')}"
+ @change_desc << "remove existing member(s): #{members_to_be_removed.join(", ")}"
end
elsif new_resource.members != current_resource.members
@change_desc << "replace group members with new list of members"
diff --git a/lib/chef/provider/group/dscl.rb b/lib/chef/provider/group/dscl.rb
index ce4a6adaf7..decad69e40 100644
--- a/lib/chef/provider/group/dscl.rb
+++ b/lib/chef/provider/group/dscl.rb
@@ -108,7 +108,7 @@ class Chef
def set_members
# First reset the memberships if the append is not set
unless new_resource.append
- logger.trace("#{new_resource} removing group members #{current_resource.members.join(' ')}") unless current_resource.members.empty?
+ logger.trace("#{new_resource} removing group members #{current_resource.members.join(" ")}") unless current_resource.members.empty?
safe_dscl("create", "/Groups/#{new_resource.group_name}", "GroupMembers", "") # clear guid list
safe_dscl("create", "/Groups/#{new_resource.group_name}", "GroupMembership", "") # clear user list
current_resource.members([ ])
@@ -121,7 +121,7 @@ class Chef
members_to_be_added << member unless current_resource.members.include?(member)
end
unless members_to_be_added.empty?
- logger.trace("#{new_resource} setting group members #{members_to_be_added.join(', ')}")
+ logger.trace("#{new_resource} setting group members #{members_to_be_added.join(", ")}")
safe_dscl("append", "/Groups/#{new_resource.group_name}", "GroupMembership", *members_to_be_added)
end
end
@@ -133,7 +133,7 @@ class Chef
members_to_be_removed << member if current_resource.members.include?(member)
end
unless members_to_be_removed.empty?
- logger.trace("#{new_resource} removing group members #{members_to_be_removed.join(', ')}")
+ logger.trace("#{new_resource} removing group members #{members_to_be_removed.join(", ")}")
safe_dscl("delete", "/Groups/#{new_resource.group_name}", "GroupMembership", *members_to_be_removed)
end
end
diff --git a/lib/chef/provider/group/groupmod.rb b/lib/chef/provider/group/groupmod.rb
index ac033e607d..c560e55f99 100644
--- a/lib/chef/provider/group/groupmod.rb
+++ b/lib/chef/provider/group/groupmod.rb
@@ -84,7 +84,7 @@ class Chef
# Adds a list of usernames to the group using `user mod`
def add_group_members(members)
- logger.trace("#{new_resource} adding members #{members.join(', ')}") unless members.empty?
+ logger.trace("#{new_resource} adding members #{members.join(", ")}") unless members.empty?
members.each do |user|
shell_out!("user", "mod", "-G", new_resource.group_name, user)
end
diff --git a/lib/chef/provider/group/pw.rb b/lib/chef/provider/group/pw.rb
index 2a1f294bde..c018de8d4d 100644
--- a/lib/chef/provider/group/pw.rb
+++ b/lib/chef/provider/group/pw.rb
@@ -44,7 +44,7 @@ class Chef
# new or existing group. Because pw groupadd does not support the -m
# and -d options used by manage_group, we treat group creation as a
# special case and use -M.
- logger.trace("#{new_resource} setting group members: #{new_resource.members.join(',')}")
+ logger.trace("#{new_resource} setting group members: #{new_resource.members.join(",")}")
command += [ "-M", new_resource.members.join(",") ]
end
@@ -119,12 +119,12 @@ class Chef
end
unless members_to_be_added.empty?
- logger.trace("#{new_resource} adding group members: #{members_to_be_added.join(',')}")
+ logger.trace("#{new_resource} adding group members: #{members_to_be_added.join(",")}")
opts << [ "-m", members_to_be_added.join(",") ]
end
unless members_to_be_removed.empty?
- logger.trace("#{new_resource} removing group members: #{members_to_be_removed.join(',')}")
+ logger.trace("#{new_resource} removing group members: #{members_to_be_removed.join(",")}")
opts << [ "-d", members_to_be_removed.join(",") ]
end
diff --git a/lib/chef/provider/group/suse.rb b/lib/chef/provider/group/suse.rb
index f17c1fc005..7bd9700a15 100644
--- a/lib/chef/provider/group/suse.rb
+++ b/lib/chef/provider/group/suse.rb
@@ -45,8 +45,8 @@ class Chef
false
end
end
- a.failure_message Chef::Exceptions::Group, "Could not add users #{to_add(new_resource.members).join(', ')} to #{new_resource.group_name}: one of these users does not exist"
- a.whyrun "Could not find one of these users: #{to_add(new_resource.members).join(', ')}. Assuming it will be created by a prior step"
+ a.failure_message Chef::Exceptions::Group, "Could not add users #{to_add(new_resource.members).join(", ")} to #{new_resource.group_name}: one of these users does not exist"
+ a.whyrun "Could not find one of these users: #{to_add(new_resource.members).join(", ")}. Assuming it will be created by a prior step"
end
end
diff --git a/lib/chef/provider/group/windows.rb b/lib/chef/provider/group/windows.rb
index fc4d7df96b..6dda6a7cc2 100644
--- a/lib/chef/provider/group/windows.rb
+++ b/lib/chef/provider/group/windows.rb
@@ -90,7 +90,7 @@ class Chef
end
def locally_qualified_name(account_name)
- account_name.include?("\\") ? account_name : "#{ENV['COMPUTERNAME']}\\#{account_name}"
+ account_name.include?("\\") ? account_name : "#{ENV["COMPUTERNAME"]}\\#{account_name}"
end
def validate_member!(member)
diff --git a/lib/chef/provider/ifconfig.rb b/lib/chef/provider/ifconfig.rb
index 6a196081ca..93db827e97 100644
--- a/lib/chef/provider/ifconfig.rb
+++ b/lib/chef/provider/ifconfig.rb
@@ -165,7 +165,7 @@ class Chef
unless current_resource.inet_addr
unless new_resource.device == loopback_device
command = add_command
- converge_by("run #{command.join(' ')} to add #{new_resource}") do
+ converge_by("run #{command.join(" ")} to add #{new_resource}") do
shell_out!(command)
logger.info("#{new_resource} added")
end
@@ -182,7 +182,7 @@ class Chef
return if new_resource.device == loopback_device
command = enable_command
- converge_by("run #{command.join(' ')} to enable #{new_resource}") do
+ converge_by("run #{command.join(" ")} to enable #{new_resource}") do
shell_out!(command)
logger.info("#{new_resource} enabled")
end
@@ -192,7 +192,7 @@ class Chef
# check to see if load_current_resource found the interface
if current_resource.device
command = delete_command
- converge_by("run #{command.join(' ')} to delete #{new_resource}") do
+ converge_by("run #{command.join(" ")} to delete #{new_resource}") do
shell_out!(command)
logger.info("#{new_resource} deleted")
end
@@ -207,7 +207,7 @@ class Chef
# disables, but leaves config files in place.
if current_resource.device
command = disable_command
- converge_by("run #{command.join(' ')} to disable #{new_resource}") do
+ converge_by("run #{command.join(" ")} to disable #{new_resource}") do
shell_out!(command)
logger.info("#{new_resource} disabled")
end
diff --git a/lib/chef/provider/mount/aix.rb b/lib/chef/provider/mount/aix.rb
index 0a5e30447b..29e31f166e 100644
--- a/lib/chef/provider/mount/aix.rb
+++ b/lib/chef/provider/mount/aix.rb
@@ -146,7 +146,7 @@ class Chef
def remount_command
if !(@new_resource.options.nil? || @new_resource.options.empty?)
- [ "mount", "-o", "remount,#{@new_resource.options.join(',')}", @new_resource.device, @new_resource.mount_point ]
+ [ "mount", "-o", "remount,#{@new_resource.options.join(",")}", @new_resource.device, @new_resource.mount_point ]
else
[ "mount", "-o", "remount", @new_resource.device, @new_resource.mount_point ]
end
@@ -174,7 +174,7 @@ class Chef
end
fstab.puts("\tvfs\t\t= #{@new_resource.fstype}")
fstab.puts("\tmount\t\t= false")
- fstab.puts "\toptions\t\t= #{@new_resource.options.join(',')}" unless @new_resource.options.nil? || @new_resource.options.empty?
+ fstab.puts "\toptions\t\t= #{@new_resource.options.join(",")}" unless @new_resource.options.nil? || @new_resource.options.empty?
logger.trace("#{@new_resource} is enabled at #{@new_resource.mount_point}")
end
end
diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb
index 4fdcc257da..17b357ec70 100644
--- a/lib/chef/provider/mount/mount.rb
+++ b/lib/chef/provider/mount/mount.rb
@@ -138,7 +138,7 @@ class Chef
end
def remount_command
- [ "mount", "-o", "remount,#{@new_resource.options.join(',')}", @new_resource.mount_point ]
+ [ "mount", "-o", "remount,#{@new_resource.options.join(",")}", @new_resource.mount_point ]
end
def remount_fs
diff --git a/lib/chef/provider/mount/solaris.rb b/lib/chef/provider/mount/solaris.rb
index ae26d13117..24f3a1f7ec 100644
--- a/lib/chef/provider/mount/solaris.rb
+++ b/lib/chef/provider/mount/solaris.rb
@@ -93,7 +93,7 @@ class Chef
# FIXME: Should remount always do the remount or only if the options change?
actual_options = native_options(options)
actual_options.delete("-")
- mount_options = actual_options.empty? ? "" : ",#{actual_options.join(',')}"
+ mount_options = actual_options.empty? ? "" : ",#{actual_options.join(",")}"
shell_out!("mount", "-o", "remount#{mount_options}", mount_point)
end
diff --git a/lib/chef/provider/package.rb b/lib/chef/provider/package.rb
index 0205bdbf82..5ccb264adf 100644
--- a/lib/chef/provider/package.rb
+++ b/lib/chef/provider/package.rb
@@ -68,8 +68,8 @@ class Chef
# if not, shouldn't we raise to tell the user to use install instead of upgrade if they want to pin a version?
requirements.assert(:install) do |a|
a.assertion { candidates_exist_for_all_forced_changes? }
- a.failure_message(Chef::Exceptions::Package, "No version specified, and no candidate version available for #{forced_packages_missing_candidates.join(', ')}")
- a.whyrun("Assuming a repository that offers #{forced_packages_missing_candidates.join(', ')} would have been configured")
+ a.failure_message(Chef::Exceptions::Package, "No version specified, and no candidate version available for #{forced_packages_missing_candidates.join(", ")}")
+ a.whyrun("Assuming a repository that offers #{forced_packages_missing_candidates.join(", ")} would have been configured")
end
# XXX: Does it make sense to pass in a source with :upgrade? Probably
@@ -77,8 +77,8 @@ class Chef
# so we'll just leave things as-is for now.
requirements.assert(:upgrade, :install) do |a|
a.assertion { candidates_exist_for_all_uninstalled? || new_resource.source }
- a.failure_message(Chef::Exceptions::Package, "No candidate version available for #{packages_missing_candidates.join(', ')}")
- a.whyrun("Assuming a repository that offers #{packages_missing_candidates.join(', ')} would have been configured")
+ a.failure_message(Chef::Exceptions::Package, "No candidate version available for #{packages_missing_candidates.join(", ")}")
+ a.whyrun("Assuming a repository that offers #{packages_missing_candidates.join(", ")} would have been configured")
end
end
diff --git a/lib/chef/provider/package/cab.rb b/lib/chef/provider/package/cab.rb
index c98e135868..fd099811e0 100644
--- a/lib/chef/provider/package/cab.rb
+++ b/lib/chef/provider/package/cab.rb
@@ -89,7 +89,7 @@ class Chef
# e.g. Package_for_KB2975719~31bf3856ad364e35~amd64~~6.3.1.8
package = new_cab_identity
# Search for just the package name to catch a different version being installed
- logger.trace("#{new_resource} searching for installed package #{package['name']}")
+ logger.trace("#{new_resource} searching for installed package #{package["name"]}")
existing_package_identities = installed_packages.map do |p|
split_package_identity(p["package_identity"])
end
@@ -102,7 +102,7 @@ class Chef
found_packages.first["version"]
else
# Presuming this won't happen, otherwise we need to handle it
- raise Chef::Exceptions::Package, "Found multiple packages installed matching name #{package['name']}, found: #{found_packages.length} matches"
+ raise Chef::Exceptions::Package, "Found multiple packages installed matching name #{package["name"]}, found: #{found_packages.length} matches"
end
end
diff --git a/lib/chef/provider/package/chocolatey.rb b/lib/chef/provider/package/chocolatey.rb
index 98cb57cb79..a09bbf55de 100644
--- a/lib/chef/provider/package/chocolatey.rb
+++ b/lib/chef/provider/package/chocolatey.rb
@@ -59,8 +59,8 @@ class Chef
# so we want to assert candidates exist for the alternate source
requirements.assert(:upgrade, :install) do |a|
a.assertion { candidates_exist_for_all_uninstalled? }
- a.failure_message(Chef::Exceptions::Package, "No candidate version available for #{packages_missing_candidates.join(', ')}")
- a.whyrun("Assuming a repository that offers #{packages_missing_candidates.join(', ')} would have been configured")
+ a.failure_message(Chef::Exceptions::Package, "No candidate version available for #{packages_missing_candidates.join(", ")}")
+ a.whyrun("Assuming a repository that offers #{packages_missing_candidates.join(", ")} would have been configured")
end
end
diff --git a/lib/chef/provider/package/dnf.rb b/lib/chef/provider/package/dnf.rb
index 5cfc82ad1c..d7b61e0789 100644
--- a/lib/chef/provider/package/dnf.rb
+++ b/lib/chef/provider/package/dnf.rb
@@ -126,7 +126,7 @@ class Chef
# does not match what the dnf library accepts.
case line
when /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)$/
- return Version.new($1, "#{$2 == '(none)' ? '0' : $2}:#{$3}-#{$4}", $5)
+ return Version.new($1, "#{$2 == "(none)" ? "0" : $2}:#{$3}-#{$4}", $5)
end
end
end
diff --git a/lib/chef/provider/package/dpkg.rb b/lib/chef/provider/package/dpkg.rb
index 47bc53ba8a..e6012edee8 100644
--- a/lib/chef/provider/package/dpkg.rb
+++ b/lib/chef/provider/package/dpkg.rb
@@ -75,17 +75,17 @@ class Chef
def install_package(name, version)
sources = name.map { |n| name_sources[n] }
- logger.info("#{new_resource} installing package(s): #{name.join(' ')}")
+ logger.info("#{new_resource} installing package(s): #{name.join(" ")}")
run_noninteractive("dpkg", "-i", *options, *sources)
end
def remove_package(name, version)
- logger.info("#{new_resource} removing package(s): #{name.join(' ')}")
+ logger.info("#{new_resource} removing package(s): #{name.join(" ")}")
run_noninteractive("dpkg", "-r", *options, *name)
end
def purge_package(name, version)
- logger.info("#{new_resource} purging packages(s): #{name.join(' ')}")
+ logger.info("#{new_resource} purging packages(s): #{name.join(" ")}")
run_noninteractive("dpkg", "-P", *options, *name)
end
diff --git a/lib/chef/provider/package/freebsd/pkgng.rb b/lib/chef/provider/package/freebsd/pkgng.rb
index fb79af617f..48fc7a0dd5 100644
--- a/lib/chef/provider/package/freebsd/pkgng.rb
+++ b/lib/chef/provider/package/freebsd/pkgng.rb
@@ -38,7 +38,7 @@ class Chef
def remove_package(name, version)
options_dup = options && options.map { |str| str.sub(repo_regex, "") }.reject!(&:empty?)
- shell_out!("pkg", "delete", "-y", options_dup, "#{name}#{version ? '-' + version : ''}", env: nil).status
+ shell_out!("pkg", "delete", "-y", options_dup, "#{name}#{version ? "-" + version : ""}", env: nil).status
end
def current_installed_version
diff --git a/lib/chef/provider/package/homebrew.rb b/lib/chef/provider/package/homebrew.rb
index f71aaf1882..3d60ee4380 100644
--- a/lib/chef/provider/package/homebrew.rb
+++ b/lib/chef/provider/package/homebrew.rb
@@ -126,7 +126,7 @@ class Chef
homebrew_uid = find_homebrew_uid(new_resource.respond_to?(:homebrew_user) && new_resource.homebrew_user)
homebrew_user = Etc.getpwuid(homebrew_uid)
- logger.trace "Executing '#{command.join(' ')}' as user '#{homebrew_user.name}'"
+ logger.trace "Executing '#{command.join(" ")}' as user '#{homebrew_user.name}'"
# FIXME: this 1800 second default timeout should be deprecated
output = shell_out!(*command, timeout: 1800, user: homebrew_uid, environment: { "HOME" => homebrew_user.dir, "RUBYOPT" => nil, "TMPDIR" => nil })
output.stdout.chomp
diff --git a/lib/chef/provider/package/msu.rb b/lib/chef/provider/package/msu.rb
index 0f2dca1290..a00b3f3471 100644
--- a/lib/chef/provider/package/msu.rb
+++ b/lib/chef/provider/package/msu.rb
@@ -126,7 +126,7 @@ class Chef
def extract_msu_contents(msu_file, destination)
with_os_architecture(nil) do
- shell_out!("#{ENV['SYSTEMROOT']}\\system32\\expand.exe -f:* #{msu_file} #{destination}")
+ shell_out!("#{ENV["SYSTEMROOT"]}\\system32\\expand.exe -f:* #{msu_file} #{destination}")
end
end
diff --git a/lib/chef/provider/package/openbsd.rb b/lib/chef/provider/package/openbsd.rb
index b7f8260e7b..38ff84f105 100644
--- a/lib/chef/provider/package/openbsd.rb
+++ b/lib/chef/provider/package/openbsd.rb
@@ -130,7 +130,7 @@ class Chef
end
def pkg_path
- ENV["PKG_PATH"] || "http://ftp.OpenBSD.org/pub/#{node['kernel']['name']}/#{node['kernel']['release']}/packages/#{node['kernel']['machine']}/"
+ ENV["PKG_PATH"] || "http://ftp.OpenBSD.org/pub/#{node["kernel"]["name"]}/#{node["kernel"]["release"]}/packages/#{node["kernel"]["machine"]}/"
end
end
diff --git a/lib/chef/provider/package/portage.rb b/lib/chef/provider/package/portage.rb
index aa8b9852b0..889d262d1e 100644
--- a/lib/chef/provider/package/portage.rb
+++ b/lib/chef/provider/package/portage.rb
@@ -38,7 +38,7 @@ class Chef
globsafe_category = category ? Chef::Util::PathHelper.escape_glob_dir(category) : nil
globsafe_pkg = Chef::Util::PathHelper.escape_glob_dir(pkg)
- possibilities = Dir["/var/db/pkg/#{globsafe_category || '*'}/#{globsafe_pkg}-*"].map { |d| d.sub(%r{/var/db/pkg/}, "") }
+ possibilities = Dir["/var/db/pkg/#{globsafe_category || "*"}/#{globsafe_pkg}-*"].map { |d| d.sub(%r{/var/db/pkg/}, "") }
versions = possibilities.map do |entry|
if entry =~ %r{[^/]+/#{Regexp.escape(pkg)}\-(\d[\.\d]*[a-z]?((_(alpha|beta|pre|rc|p)\d*)*)?(-r\d+)?)}
[$&, $1]
@@ -49,7 +49,7 @@ class Chef
atoms = versions.map(&:first).sort
categories = atoms.map { |v| v.split("/")[0] }.uniq
if !category && categories.size > 1
- raise Chef::Exceptions::Package, "Multiple packages found for #{new_resource.package_name}: #{atoms.join(' ')}. Specify a category."
+ raise Chef::Exceptions::Package, "Multiple packages found for #{new_resource.package_name}: #{atoms.join(" ")}. Specify a category."
end
elsif versions.size == 1
current_resource.version(versions.first.last)
diff --git a/lib/chef/provider/package/powershell.rb b/lib/chef/provider/package/powershell.rb
index c10150a32c..a27f7fa6c8 100644
--- a/lib/chef/provider/package/powershell.rb
+++ b/lib/chef/provider/package/powershell.rb
@@ -42,8 +42,8 @@ class Chef
requirements.assert(:install) do |a|
a.assertion { candidates_exist_for_all_uninstalled? }
- a.failure_message(Chef::Exceptions::Package, "No candidate version available for #{packages_missing_candidates.join(', ')}")
- a.whyrun("Assuming a repository that offers #{packages_missing_candidates.join(', ')} would have been configured")
+ a.failure_message(Chef::Exceptions::Package, "No candidate version available for #{packages_missing_candidates.join(", ")}")
+ a.whyrun("Assuming a repository that offers #{packages_missing_candidates.join(", ")} would have been configured")
end
end
diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb
index 1980629da1..876a90392c 100644
--- a/lib/chef/provider/package/rubygems.rb
+++ b/lib/chef/provider/package/rubygems.rb
@@ -199,7 +199,7 @@ class Chef
logger.trace { "found gem #{spec.name} version #{version} for platform #{spec.platform} from #{source}" }
version
else
- source_list = sources.compact.empty? ? "[#{Gem.sources.to_a.join(', ')}]" : "[#{sources.join(', ')}]"
+ source_list = sources.compact.empty? ? "[#{Gem.sources.to_a.join(", ")}]" : "[#{sources.join(", ")}]"
logger.warn { "failed to find gem #{gem_dependency} from #{source_list}" }
nil
end
@@ -421,11 +421,11 @@ class Chef
def is_omnibus?
if RbConfig::CONFIG["bindir"] =~ %r{/(opscode|chef|chefdk)/embedded/bin}
- logger.trace("#{new_resource} detected omnibus installation in #{RbConfig::CONFIG['bindir']}")
+ logger.trace("#{new_resource} detected omnibus installation in #{RbConfig::CONFIG["bindir"]}")
# Omnibus installs to a static path because of linking on unix, find it.
true
elsif RbConfig::CONFIG["bindir"].sub(/^[\w]:/, "") == "/opscode/chef/embedded/bin"
- logger.trace("#{new_resource} detected omnibus installation in #{RbConfig::CONFIG['bindir']}")
+ logger.trace("#{new_resource} detected omnibus installation in #{RbConfig::CONFIG["bindir"]}")
# windows, with the drive letter removed
true
else
diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb
index d5d6e76fa5..e32457cc0c 100644
--- a/lib/chef/provider/package/yum.rb
+++ b/lib/chef/provider/package/yum.rb
@@ -216,7 +216,7 @@ class Chef
# does not match what the yum library accepts.
case line
when /^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)$/
- return Version.new($1, "#{$2 == '(none)' ? '0' : $2}:#{$3}-#{$4}", $5)
+ return Version.new($1, "#{$2 == "(none)" ? "0" : $2}:#{$3}-#{$4}", $5)
end
end
end
diff --git a/lib/chef/provider/registry_key.rb b/lib/chef/provider/registry_key.rb
index 9a9df61b2b..5dcb9f1959 100644
--- a/lib/chef/provider/registry_key.rb
+++ b/lib/chef/provider/registry_key.rb
@@ -76,7 +76,7 @@ class Chef
def define_resource_requirements
requirements.assert(:create, :create_if_missing, :delete, :delete_key) do |a|
a.assertion { registry.hive_exists?(new_resource.key) }
- a.failure_message(Chef::Exceptions::Win32RegHiveMissing, "Hive #{new_resource.key.split("\\").shift} does not exist")
+ a.failure_message(Chef::Exceptions::Win32RegHiveMissing, "Hive #{new_resource.key.split('\\').shift} does not exist")
end
requirements.assert(:create) do |a|
diff --git a/lib/chef/provider/route.rb b/lib/chef/provider/route.rb
index 729ac98386..009c57e546 100644
--- a/lib/chef/provider/route.rb
+++ b/lib/chef/provider/route.rb
@@ -133,7 +133,7 @@ class Chef
logger.trace("#{new_resource} route already active - nothing to do")
else
command = generate_command(:add)
- converge_by("run #{command.join(' ')} to add route") do
+ converge_by("run #{command.join(" ")} to add route") do
shell_out!(*command)
logger.info("#{new_resource} added")
end
@@ -146,7 +146,7 @@ class Chef
def action_delete
if is_running
command = generate_command(:delete)
- converge_by("run #{command.join(' ')} to delete route ") do
+ converge_by("run #{command.join(" ")} to delete route ") do
shell_out!(*command)
logger.info("#{new_resource} removed")
end
diff --git a/lib/chef/provider/service/arch.rb b/lib/chef/provider/service/arch.rb
index cbd2340610..bb209e22ae 100644
--- a/lib/chef/provider/service/arch.rb
+++ b/lib/chef/provider/service/arch.rb
@@ -61,7 +61,7 @@ class Chef::Provider::Service::Arch < Chef::Provider::Service::Init
# FIXME: Multiple entries of DAEMONS will cause very bad results :)
def update_daemons(entries)
- content = ::File.read("/etc/rc.conf").gsub(/DAEMONS=\((.*)\)/m, "DAEMONS=(#{entries.join(' ')})")
+ content = ::File.read("/etc/rc.conf").gsub(/DAEMONS=\((.*)\)/m, "DAEMONS=(#{entries.join(" ")})")
::File.open("/etc/rc.conf", "w") do |f|
f.write(content)
end
diff --git a/lib/chef/provider/service/openbsd.rb b/lib/chef/provider/service/openbsd.rb
index e427606571..c368815418 100644
--- a/lib/chef/provider/service/openbsd.rb
+++ b/lib/chef/provider/service/openbsd.rb
@@ -92,9 +92,9 @@ class Chef
old_services_list = old_services_list ? old_services_list[1].split(" ") : []
new_services_list = old_services_list + [new_resource.service_name]
if rc_conf_local =~ /^pkg_scripts="(.*)"/
- new_rcl = rc_conf_local.sub(/^pkg_scripts="(.*)"/, "pkg_scripts=\"#{new_services_list.join(' ')}\"")
+ new_rcl = rc_conf_local.sub(/^pkg_scripts="(.*)"/, "pkg_scripts=\"#{new_services_list.join(" ")}\"")
else
- new_rcl = rc_conf_local + "\n" + "pkg_scripts=\"#{new_services_list.join(' ')}\"\n"
+ new_rcl = rc_conf_local + "\n" + "pkg_scripts=\"#{new_services_list.join(" ")}\"\n"
end
update_rcl new_rcl
end
diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb
index f3c081534c..8751090d44 100644
--- a/lib/chef/provider/service/redhat.rb
+++ b/lib/chef/provider/service/redhat.rb
@@ -106,13 +106,13 @@ class Chef
# @api private
def levels
- (run_levels.nil? || run_levels.empty?) ? "" : "--level #{run_levels.join('')} "
+ (run_levels.nil? || run_levels.empty?) ? "" : "--level #{run_levels.join("")} "
end
def enable_service
unless run_levels.nil? || run_levels.empty?
disable_levels = current_run_levels - run_levels
- shell_out! "/sbin/chkconfig --level #{disable_levels.join('')} #{new_resource.service_name} off" unless disable_levels.empty?
+ shell_out! "/sbin/chkconfig --level #{disable_levels.join("")} #{new_resource.service_name} off" unless disable_levels.empty?
end
shell_out! "/sbin/chkconfig #{levels}#{new_resource.service_name} on"
end
diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb
index e67aec974a..b8f85618da 100644
--- a/lib/chef/provider/user/dscl.rb
+++ b/lib/chef/provider/user/dscl.rb
@@ -128,7 +128,7 @@ in 'password', with the associated 'salt' and 'iterations'.")
# Convert the salt from Base64 encoding to hex before consuming them
current_resource.salt(shadow_hash["SALTED-SHA512-PBKDF2"]["salt"].string.unpack("H*").first)
else
- raise(Chef::Exceptions::User, "Unknown shadow_hash format: #{shadow_hash.keys.join(' ')}")
+ raise(Chef::Exceptions::User, "Unknown shadow_hash format: #{shadow_hash.keys.join(" ")}")
end
end
diff --git a/lib/chef/provider/windows_task.rb b/lib/chef/provider/windows_task.rb
index 42f662310d..b94b6b875c 100644
--- a/lib/chef/provider/windows_task.rb
+++ b/lib/chef/provider/windows_task.rb
@@ -604,7 +604,7 @@ class Chef
validate << "Task Name" if new_resource.task_name.nil? || new_resource.task_name.empty?
return true if validate.empty?
- raise Chef::Exceptions::ValidationFailed.new "Value for '#{validate.join(', ')}' option cannot be empty"
+ raise Chef::Exceptions::ValidationFailed.new "Value for '#{validate.join(", ")}' option cannot be empty"
end
# rubocop:disable Style/StringLiteralsInInterpolation
diff --git a/lib/chef/resource/build_essential.rb b/lib/chef/resource/build_essential.rb
index 5a8513389e..b38ec6b24a 100644
--- a/lib/chef/resource/build_essential.rb
+++ b/lib/chef/resource/build_essential.rb
@@ -79,7 +79,7 @@ class Chef
# Per OmniOS documentation, the gcc bin dir isn't in the default
# $PATH, so add it to the running process environment
# http://omnios.omniti.com/wiki.php/DevEnv
- ENV["PATH"] = "#{ENV['PATH']}:/opt/gcc-4.7.2/bin"
+ ENV["PATH"] = "#{ENV["PATH"]}:/opt/gcc-4.7.2/bin"
when "solaris2"
package "autoconf"
package "automake"
@@ -110,7 +110,7 @@ class Chef
package %w{ gcc48 gcc48-c++ } if node["platform_version"].to_i < 12
else
Chef::Log.warn <<-EOH
- The build_essential resource does not currently support the '#{node['platform_family']}'
+ The build_essential resource does not currently support the '#{node["platform_family"]}'
platform family. Skipping...
EOH
end
diff --git a/lib/chef/resource/chef_gem.rb b/lib/chef/resource/chef_gem.rb
index 755040f26b..04492e2a26 100644
--- a/lib/chef/resource/chef_gem.rb
+++ b/lib/chef/resource/chef_gem.rb
@@ -37,10 +37,10 @@ class Chef
class ChefGem < Chef::Resource::Package::GemPackage
resource_name :chef_gem
- property :gem_binary, default: "#{RbConfig::CONFIG['bindir']}/gem", default_description: "Chef's built-in gem binary.",
+ property :gem_binary, default: "#{RbConfig::CONFIG["bindir"]}/gem", default_description: "Chef's built-in gem binary.",
description: "The path of a gem binary to use for the installation. By default, the same version of Ruby that is used by the #{Chef::Dist::CLIENT} will be installed.",
callbacks: {
- "The chef_gem resource is restricted to the current gem environment, use gem_package to install to other environments." => proc { |v| v == "#{RbConfig::CONFIG['bindir']}/gem" },
+ "The chef_gem resource is restricted to the current gem environment, use gem_package to install to other environments." => proc { |v| v == "#{RbConfig::CONFIG["bindir"]}/gem" },
}
property :compile_time, [TrueClass, FalseClass],
description: "Controls the phase during which a gem is installed on a node. Set to 'true' to install a gem while the resource collection is being built (the 'compile phase'). Set to 'false' to install a gem while the #{Chef::Dist::CLIENT} is configuring the node (the 'converge phase').",
diff --git a/lib/chef/resource/chocolatey_config.rb b/lib/chef/resource/chocolatey_config.rb
index 3a3814db3a..2be4b7be0a 100644
--- a/lib/chef/resource/chocolatey_config.rb
+++ b/lib/chef/resource/chocolatey_config.rb
@@ -40,7 +40,7 @@ class Chef
# @return [String] the element's value field
def fetch_config_element(id)
require "rexml/document" unless defined?(REXML::Document)
- config_file = "#{ENV['ALLUSERSPROFILE']}\\chocolatey\\config\\chocolatey.config"
+ config_file = "#{ENV["ALLUSERSPROFILE"]}\\chocolatey\\config\\chocolatey.config"
raise "Could not find the Chocolatey config at #{config_file}!" unless ::File.exist?(config_file)
contents = REXML::Document.new(::File.read(config_file))
@@ -72,7 +72,7 @@ class Chef
# @param [String] action the name of the action to perform
# @return [String] the choco config command string
def choco_cmd(action)
- cmd = "#{ENV['ALLUSERSPROFILE']}\\chocolatey\\bin\\choco config #{action} --name #{new_resource.config_key}"
+ cmd = "#{ENV["ALLUSERSPROFILE"]}\\chocolatey\\bin\\choco config #{action} --name #{new_resource.config_key}"
cmd << " --value #{new_resource.value}" if action == "set"
cmd
end
diff --git a/lib/chef/resource/chocolatey_feature.rb b/lib/chef/resource/chocolatey_feature.rb
index 1c190905f3..eef28cbe0a 100644
--- a/lib/chef/resource/chocolatey_feature.rb
+++ b/lib/chef/resource/chocolatey_feature.rb
@@ -39,7 +39,7 @@ class Chef
# @return [String] the element's value field
def fetch_feature_element(name)
require "rexml/document" unless defined?(REXML::Document)
- config_file = "#{ENV['ALLUSERSPROFILE']}\\chocolatey\\config\\chocolatey.config"
+ config_file = "#{ENV["ALLUSERSPROFILE"]}\\chocolatey\\config\\chocolatey.config"
raise "Could not find the Chocolatey config at #{config_file}!" unless ::File.exist?(config_file)
contents = REXML::Document.new(::File.read(config_file))
@@ -71,7 +71,7 @@ class Chef
# @param [String] action the name of the action to perform
# @return [String] the choco feature command string
def choco_cmd(action)
- cmd = "#{ENV['ALLUSERSPROFILE']}\\chocolatey\\bin\\choco feature #{action} --name #{new_resource.feature_name}"
+ cmd = "#{ENV["ALLUSERSPROFILE"]}\\chocolatey\\bin\\choco feature #{action} --name #{new_resource.feature_name}"
cmd
end
end
diff --git a/lib/chef/resource/chocolatey_source.rb b/lib/chef/resource/chocolatey_source.rb
index 22ca387679..9f57e0dbdc 100644
--- a/lib/chef/resource/chocolatey_source.rb
+++ b/lib/chef/resource/chocolatey_source.rb
@@ -62,7 +62,7 @@ class Chef
def fetch_source_element(id)
require "rexml/document" unless defined?(REXML::Document)
- config_file = "#{ENV['ALLUSERSPROFILE']}\\chocolatey\\config\\chocolatey.config"
+ config_file = "#{ENV["ALLUSERSPROFILE"]}\\chocolatey\\config\\chocolatey.config"
raise "Could not find the Chocolatey config at #{config_file}!" unless ::File.exist?(config_file)
config_contents = REXML::Document.new(::File.read(config_file))
@@ -114,7 +114,7 @@ class Chef
# @param [String] action the name of the action to perform
# @return [String] the choco source command string
def choco_cmd(action)
- cmd = "#{ENV['ALLUSERSPROFILE']}\\chocolatey\\bin\\choco source #{action} -n \"#{new_resource.source_name}\""
+ cmd = "#{ENV["ALLUSERSPROFILE"]}\\chocolatey\\bin\\choco source #{action} -n \"#{new_resource.source_name}\""
if action == "add"
cmd << " -s #{new_resource.source} --priority=#{new_resource.priority}"
cmd << " --bypassproxy" if new_resource.bypass_proxy
diff --git a/lib/chef/resource/dsc_resource.rb b/lib/chef/resource/dsc_resource.rb
index c2965944ec..fe47d7fd1a 100644
--- a/lib/chef/resource/dsc_resource.rb
+++ b/lib/chef/resource/dsc_resource.rb
@@ -42,7 +42,7 @@ class Chef
end
"#{property}=>#{obj_text}"
end
- "{#{descriptions.join(', ')}}"
+ "{#{descriptions.join(", ")}}"
end
end
diff --git a/lib/chef/resource/homebrew_tap.rb b/lib/chef/resource/homebrew_tap.rb
index 8f415a3ff1..23738d6e51 100644
--- a/lib/chef/resource/homebrew_tap.rb
+++ b/lib/chef/resource/homebrew_tap.rb
@@ -57,7 +57,7 @@ class Chef
unless tapped?(new_resource.tap_name)
converge_by("tap #{new_resource.tap_name}") do
- shell_out!("#{new_resource.homebrew_path} tap #{new_resource.full ? '--full' : ''} #{new_resource.tap_name} #{new_resource.url || ''}",
+ shell_out!("#{new_resource.homebrew_path} tap #{new_resource.full ? "--full" : ""} #{new_resource.tap_name} #{new_resource.url || ""}",
user: new_resource.owner,
env: { "HOME" => ::Dir.home(new_resource.owner), "USER" => new_resource.owner },
cwd: ::Dir.home(new_resource.owner))
diff --git a/lib/chef/resource/locale.rb b/lib/chef/resource/locale.rb
index 331786a02f..8edb278e48 100644
--- a/lib/chef/resource/locale.rb
+++ b/lib/chef/resource/locale.rb
@@ -43,7 +43,7 @@ class Chef
if h.respond_to?(:keys)
invalid_keys = h.keys - LC_VARIABLES
unless invalid_keys.empty?
- error_msg = "Key of option lc_env must be equal to one of: \"#{LC_VARIABLES.join('", "')}\"! You passed \"#{invalid_keys.join(', ')}\"."
+ error_msg = "Key of option lc_env must be equal to one of: \"#{LC_VARIABLES.join('", "')}\"! You passed \"#{invalid_keys.join(", ")}\"."
raise Chef::Exceptions::ValidationFailed, error_msg
end
end
@@ -97,7 +97,7 @@ class Chef
# @raise [Mixlib::ShellOut::ShellCommandFailed] not a supported language or locale
#
def generate_locales
- shell_out!("locale-gen #{unavailable_locales.join(' ')}")
+ shell_out!("locale-gen #{unavailable_locales.join(" ")}")
end
# Updates system locale by appropriately writing them in /etc/locale.conf
diff --git a/lib/chef/resource/swap_file.rb b/lib/chef/resource/swap_file.rb
index 4a5629d824..2efe040c47 100644
--- a/lib/chef/resource/swap_file.rb
+++ b/lib/chef/resource/swap_file.rb
@@ -51,7 +51,7 @@ class Chef
Chef::Log.debug("#{new_resource} already created - nothing to do")
else
begin
- Chef::Log.info "starting first create: #{node['virtualization']['system']}"
+ Chef::Log.info "starting first create: #{node["virtualization"]["system"]}"
do_create(swap_creation_command)
rescue Mixlib::ShellOut::ShellCommandFailed => e
Chef::Log.warn("#{new_resource} Rescuing failed swapfile creation for #{new_resource.path}")
diff --git a/lib/chef/resource/sysctl.rb b/lib/chef/resource/sysctl.rb
index d116b5fdc7..a6c316c5bc 100644
--- a/lib/chef/resource/sysctl.rb
+++ b/lib/chef/resource/sysctl.rb
@@ -80,12 +80,12 @@ class Chef
directory new_resource.conf_dir
- file "#{new_resource.conf_dir}/99-chef-#{new_resource.key.tr('/', '.')}.conf" do
+ file "#{new_resource.conf_dir}/99-chef-#{new_resource.key.tr("/", ".")}.conf" do
content "#{new_resource.key} = #{new_resource.value}"
end
execute "Load sysctl values" do
- command "sysctl #{'-e ' if new_resource.ignore_error}-p"
+ command "sysctl #{"-e " if new_resource.ignore_error}-p"
default_env true
action :run
end
@@ -96,9 +96,9 @@ class Chef
description "Remove a sysctl value."
# only converge the resource if the file actually exists to delete
- if ::File.exist?("#{new_resource.conf_dir}/99-chef-#{new_resource.key.tr('/', '.')}.conf")
- converge_by "removing sysctl config at #{new_resource.conf_dir}/99-chef-#{new_resource.key.tr('/', '.')}.conf" do
- file "#{new_resource.conf_dir}/99-chef-#{new_resource.key.tr('/', '.')}.conf" do
+ if ::File.exist?("#{new_resource.conf_dir}/99-chef-#{new_resource.key.tr("/", ".")}.conf")
+ converge_by "removing sysctl config at #{new_resource.conf_dir}/99-chef-#{new_resource.key.tr("/", ".")}.conf" do
+ file "#{new_resource.conf_dir}/99-chef-#{new_resource.key.tr("/", ".")}.conf" do
action :delete
end
@@ -113,7 +113,7 @@ class Chef
action_class do
def set_sysctl_param(key, value)
- shell_out!("sysctl #{'-e ' if new_resource.ignore_error}-w \"#{key}=#{value}\"")
+ shell_out!("sysctl #{"-e " if new_resource.ignore_error}-w \"#{key}=#{value}\"")
end
end
@@ -141,9 +141,9 @@ class Chef
# return the value. Raise in case this conf file needs to be created
# or updated
def get_sysctld_value(key)
- raise unless ::File.exist?("/etc/sysctl.d/99-chef-#{key.tr('/', '.')}.conf")
+ raise unless ::File.exist?("/etc/sysctl.d/99-chef-#{key.tr("/", ".")}.conf")
- k, v = ::File.read("/etc/sysctl.d/99-chef-#{key.tr('/', '.')}.conf").match(/(.*) = (.*)/).captures
+ k, v = ::File.read("/etc/sysctl.d/99-chef-#{key.tr("/", ".")}.conf").match(/(.*) = (.*)/).captures
raise "Unknown sysctl key!" if k.nil?
raise "Unknown sysctl value!" if v.nil?
diff --git a/lib/chef/resource/windows_certificate.rb b/lib/chef/resource/windows_certificate.rb
index fa76d7273d..a85c56748f 100644
--- a/lib/chef/resource/windows_certificate.rb
+++ b/lib/chef/resource/windows_certificate.rb
@@ -77,7 +77,7 @@ class Chef
guard_script = cert_script(false)
else
# make sure we have no spaces in the hash string
- hash = "\"#{new_resource.source.gsub(/\s/, '')}\""
+ hash = "\"#{new_resource.source.gsub(/\s/, "")}\""
code_script = ""
guard_script = ""
end
diff --git a/lib/chef/resource/windows_dfs_folder.rb b/lib/chef/resource/windows_dfs_folder.rb
index e75e8b86a4..8078f965fb 100644
--- a/lib/chef/resource/windows_dfs_folder.rb
+++ b/lib/chef/resource/windows_dfs_folder.rb
@@ -50,14 +50,14 @@ class Chef
powershell_script "Create or Update DFS Folder" do
code <<-EOH
- $needs_creating = (Get-DfsnFolder -Path '\\\\#{ENV['COMPUTERNAME']}\\#{new_resource.namespace_name}\\#{new_resource.folder_path}' -ErrorAction SilentlyContinue) -eq $null
+ $needs_creating = (Get-DfsnFolder -Path '\\\\#{ENV["COMPUTERNAME"]}\\#{new_resource.namespace_name}\\#{new_resource.folder_path}' -ErrorAction SilentlyContinue) -eq $null
if (!($needs_creating))
{
- Remove-DfsnFolder -Path '\\\\#{ENV['COMPUTERNAME']}\\#{new_resource.namespace_name}\\#{new_resource.folder_path}' -Force
+ Remove-DfsnFolder -Path '\\\\#{ENV["COMPUTERNAME"]}\\#{new_resource.namespace_name}\\#{new_resource.folder_path}' -Force
}
- New-DfsnFolder -Path '\\\\#{ENV['COMPUTERNAME']}\\#{new_resource.namespace_name}\\#{new_resource.folder_path}' -TargetPath '#{new_resource.target_path}' -Description '#{new_resource.description}'
+ New-DfsnFolder -Path '\\\\#{ENV["COMPUTERNAME"]}\\#{new_resource.namespace_name}\\#{new_resource.folder_path}' -TargetPath '#{new_resource.target_path}' -Description '#{new_resource.description}'
EOH
- not_if "return ((Get-DfsnFolder -Path '\\\\#{ENV['COMPUTERNAME']}\\#{new_resource.namespace_name}\\#{new_resource.folder_path}' -ErrorAction SilentlyContinue).Description -eq '#{new_resource.description}' -and (Get-DfsnFolderTarget -Path '\\\\#{ENV['COMPUTERNAME']}\\#{new_resource.namespace_name}\\#{new_resource.folder_path}').TargetPath -eq '#{new_resource.target_path}' )"
+ not_if "return ((Get-DfsnFolder -Path '\\\\#{ENV["COMPUTERNAME"]}\\#{new_resource.namespace_name}\\#{new_resource.folder_path}' -ErrorAction SilentlyContinue).Description -eq '#{new_resource.description}' -and (Get-DfsnFolderTarget -Path '\\\\#{ENV["COMPUTERNAME"]}\\#{new_resource.namespace_name}\\#{new_resource.folder_path}').TargetPath -eq '#{new_resource.target_path}' )"
end
end
@@ -66,9 +66,9 @@ class Chef
powershell_script "Delete DFS Namespace" do
code <<-EOH
- Remove-DfsnFolder -Path '\\\\#{ENV['COMPUTERNAME']}\\#{new_resource.namespace_name}\\#{new_resource.folder_path}' -Force
+ Remove-DfsnFolder -Path '\\\\#{ENV["COMPUTERNAME"]}\\#{new_resource.namespace_name}\\#{new_resource.folder_path}' -Force
EOH
- only_if "return ((Get-DfsnFolder -Path '\\\\#{ENV['COMPUTERNAME']}\\#{new_resource.namespace_name}\\#{new_resource.folder_path}' ) -ne $null)"
+ only_if "return ((Get-DfsnFolder -Path '\\\\#{ENV["COMPUTERNAME"]}\\#{new_resource.namespace_name}\\#{new_resource.folder_path}' ) -ne $null)"
end
end
end
diff --git a/lib/chef/resource/windows_dfs_namespace.rb b/lib/chef/resource/windows_dfs_namespace.rb
index 34ac58ff2e..3b201d1028 100644
--- a/lib/chef/resource/windows_dfs_namespace.rb
+++ b/lib/chef/resource/windows_dfs_namespace.rb
@@ -69,17 +69,17 @@ class Chef
powershell_script "Create DFS Namespace" do
code <<-EOH
- $needs_creating = (Get-DfsnRoot -Path '\\\\#{ENV['COMPUTERNAME']}\\#{new_resource.namespace_name}' -ErrorAction SilentlyContinue) -eq $null
+ $needs_creating = (Get-DfsnRoot -Path '\\\\#{ENV["COMPUTERNAME"]}\\#{new_resource.namespace_name}' -ErrorAction SilentlyContinue) -eq $null
if ($needs_creating)
{
- New-DfsnRoot -Path '\\\\#{ENV['COMPUTERNAME']}\\#{new_resource.namespace_name}' -TargetPath '\\\\#{ENV['COMPUTERNAME']}\\#{new_resource.namespace_name}' -Type Standalone -Description '#{new_resource.description}'
+ New-DfsnRoot -Path '\\\\#{ENV["COMPUTERNAME"]}\\#{new_resource.namespace_name}' -TargetPath '\\\\#{ENV["COMPUTERNAME"]}\\#{new_resource.namespace_name}' -Type Standalone -Description '#{new_resource.description}'
}
else
{
- Set-DfsnRoot -Path '\\\\#{ENV['COMPUTERNAME']}\\#{new_resource.namespace_name}' -Description '#{new_resource.description}'
+ Set-DfsnRoot -Path '\\\\#{ENV["COMPUTERNAME"]}\\#{new_resource.namespace_name}' -Description '#{new_resource.description}'
}
EOH
- not_if "return (Get-DfsnRoot -Path '\\\\#{ENV['COMPUTERNAME']}\\#{new_resource.namespace_name}' -ErrorAction SilentlyContinue).description -eq '#{new_resource.description}'"
+ not_if "return (Get-DfsnRoot -Path '\\\\#{ENV["COMPUTERNAME"]}\\#{new_resource.namespace_name}' -ErrorAction SilentlyContinue).description -eq '#{new_resource.description}'"
end
end
@@ -88,9 +88,9 @@ class Chef
powershell_script "Delete DFS Namespace" do
code <<-EOH
- Remove-DfsnRoot -Path '\\\\#{ENV['COMPUTERNAME']}\\#{new_resource.namespace_name}' -Force
+ Remove-DfsnRoot -Path '\\\\#{ENV["COMPUTERNAME"]}\\#{new_resource.namespace_name}' -Force
EOH
- only_if "return ((Get-DfsnRoot -Path '\\\\#{ENV['COMPUTERNAME']}\\#{new_resource.namespace_name}') -ne $null)"
+ only_if "return ((Get-DfsnRoot -Path '\\\\#{ENV["COMPUTERNAME"]}\\#{new_resource.namespace_name}') -ne $null)"
end
windows_share new_resource.namespace_name do
diff --git a/lib/chef/resource/windows_dfs_server.rb b/lib/chef/resource/windows_dfs_server.rb
index cfcf20ec59..89376a0877 100644
--- a/lib/chef/resource/windows_dfs_server.rb
+++ b/lib/chef/resource/windows_dfs_server.rb
@@ -48,7 +48,7 @@ class Chef
default: 3600
load_current_value do
- ps_results = powershell_out("Get-DfsnServerConfiguration -ComputerName '#{ENV['COMPUTERNAME']}' | Select LdapTimeoutSec, PreferLogonDC, EnableSiteCostedReferrals, SyncIntervalSec, UseFqdn | ConvertTo-Json")
+ ps_results = powershell_out("Get-DfsnServerConfiguration -ComputerName '#{ENV["COMPUTERNAME"]}' | Select LdapTimeoutSec, PreferLogonDC, EnableSiteCostedReferrals, SyncIntervalSec, UseFqdn | ConvertTo-Json")
if ps_results.error?
raise "The dfs_server resource failed to fetch the current state via the Get-DfsnServerConfiguration PowerShell cmlet. Is the DFS Windows feature installed?"
@@ -68,7 +68,7 @@ class Chef
description "Configure DFS settings."
converge_if_changed do
- powershell_out("Set-DfsnServerConfiguration -ComputerName '#{ENV['COMPUTERNAME']}' EnableSiteCostedReferrals $#{new_resource.enable_site_costed_referrals} -UseFqdn $#{new_resource.use_fqdn} -LdapTimeoutSec #{new_resource.ldap_timeout_secs} -PreferLogonDC $#{new_resource.prefer_login_dc} -SyncIntervalSec #{new_resource.sync_interval_secs}")
+ powershell_out("Set-DfsnServerConfiguration -ComputerName '#{ENV["COMPUTERNAME"]}' EnableSiteCostedReferrals $#{new_resource.enable_site_costed_referrals} -UseFqdn $#{new_resource.use_fqdn} -LdapTimeoutSec #{new_resource.ldap_timeout_secs} -PreferLogonDC $#{new_resource.prefer_login_dc} -SyncIntervalSec #{new_resource.sync_interval_secs}")
end
end
end
diff --git a/lib/chef/resource/windows_feature_dism.rb b/lib/chef/resource/windows_feature_dism.rb
index ab4ac32ca1..faeb0b0762 100644
--- a/lib/chef/resource/windows_feature_dism.rb
+++ b/lib/chef/resource/windows_feature_dism.rb
@@ -58,11 +58,11 @@ class Chef
reload_cached_dism_data unless node["dism_features_cache"]
fail_if_unavailable # fail if the features don't exist
- logger.trace("Windows features needing installation: #{features_to_install.empty? ? 'none' : features_to_install.join(',')}")
+ logger.trace("Windows features needing installation: #{features_to_install.empty? ? "none" : features_to_install.join(",")}")
unless features_to_install.empty?
- message = "install Windows feature#{'s' if features_to_install.count > 1} #{features_to_install.join(',')}"
+ message = "install Windows feature#{"s" if features_to_install.count > 1} #{features_to_install.join(",")}"
converge_by(message) do
- install_command = "dism.exe /online /enable-feature #{features_to_install.map { |f| "/featurename:#{f}" }.join(' ')} /norestart"
+ install_command = "dism.exe /online /enable-feature #{features_to_install.map { |f| "/featurename:#{f}" }.join(" ")} /norestart"
install_command << " /LimitAccess /Source:\"#{new_resource.source}\"" if new_resource.source
install_command << " /All" if new_resource.all
begin
@@ -83,12 +83,12 @@ class Chef
reload_cached_dism_data unless node["dism_features_cache"]
- logger.trace("Windows features needing removal: #{features_to_remove.empty? ? 'none' : features_to_remove.join(',')}")
+ logger.trace("Windows features needing removal: #{features_to_remove.empty? ? "none" : features_to_remove.join(",")}")
unless features_to_remove.empty?
- message = "remove Windows feature#{'s' if features_to_remove.count > 1} #{features_to_remove.join(',')}"
+ message = "remove Windows feature#{"s" if features_to_remove.count > 1} #{features_to_remove.join(",")}"
converge_by(message) do
- shell_out!("dism.exe /online /disable-feature #{features_to_remove.map { |f| "/featurename:#{f}" }.join(' ')} /norestart", returns: [0, 42, 127, 3010], timeout: new_resource.timeout)
+ shell_out!("dism.exe /online /disable-feature #{features_to_remove.map { |f| "/featurename:#{f}" }.join(" ")} /norestart", returns: [0, 42, 127, 3010], timeout: new_resource.timeout)
reload_cached_dism_data # Reload cached dism feature state
end
@@ -104,11 +104,11 @@ class Chef
fail_if_unavailable # fail if the features don't exist
- logger.trace("Windows features needing deletion: #{features_to_delete.empty? ? 'none' : features_to_delete.join(',')}")
+ logger.trace("Windows features needing deletion: #{features_to_delete.empty? ? "none" : features_to_delete.join(",")}")
unless features_to_delete.empty?
- message = "delete Windows feature#{'s' if features_to_delete.count > 1} #{features_to_delete.join(',')} from the image"
+ message = "delete Windows feature#{"s" if features_to_delete.count > 1} #{features_to_delete.join(",")} from the image"
converge_by(message) do
- shell_out!("dism.exe /online /disable-feature #{features_to_delete.map { |f| "/featurename:#{f}" }.join(' ')} /Remove /norestart", returns: [0, 42, 127, 3010], timeout: new_resource.timeout)
+ shell_out!("dism.exe /online /disable-feature #{features_to_delete.map { |f| "/featurename:#{f}" }.join(" ")} /Remove /norestart", returns: [0, 42, 127, 3010], timeout: new_resource.timeout)
reload_cached_dism_data # Reload cached dism feature state
end
@@ -159,7 +159,7 @@ class Chef
# the difference of desired features to install to all features is what's not available
unavailable = (new_resource.feature_name - all_available)
- raise "The Windows feature#{'s' if unavailable.count > 1} #{unavailable.join(',')} #{unavailable.count > 1 ? 'are' : 'is'} not available on this version of Windows. Run 'dism /online /Get-Features' to see the list of available feature names." unless unavailable.empty?
+ raise "The Windows feature#{"s" if unavailable.count > 1} #{unavailable.join(",")} #{unavailable.count > 1 ? "are" : "is"} not available on this version of Windows. Run 'dism /online /Get-Features' to see the list of available feature names." unless unavailable.empty?
end
# run dism.exe to get a list of all available features and their state
@@ -190,7 +190,7 @@ class Chef
add_to_feature_mash("disabled", feature_details_raw)
end
end
- logger.trace("The cache contains\n#{node['dism_features_cache']}")
+ logger.trace("The cache contains\n#{node["dism_features_cache"]}")
end
# parse the feature string and add the values to the appropriate array
diff --git a/lib/chef/resource/windows_feature_powershell.rb b/lib/chef/resource/windows_feature_powershell.rb
index 908bb96c76..5cdbe1f74c 100644
--- a/lib/chef/resource/windows_feature_powershell.rb
+++ b/lib/chef/resource/windows_feature_powershell.rb
@@ -68,10 +68,10 @@ class Chef
fail_if_unavailable # fail if the features don't exist
fail_if_removed # fail if the features are in removed state
- Chef::Log.debug("Windows features needing installation: #{features_to_install.empty? ? 'none' : features_to_install.join(',')}")
+ Chef::Log.debug("Windows features needing installation: #{features_to_install.empty? ? "none" : features_to_install.join(",")}")
unless features_to_install.empty?
- converge_by("install Windows feature#{'s' if features_to_install.count > 1} #{features_to_install.join(',')}") do
- install_command = "#{install_feature_cmdlet} #{features_to_install.join(',')}"
+ converge_by("install Windows feature#{"s" if features_to_install.count > 1} #{features_to_install.join(",")}") do
+ install_command = "#{install_feature_cmdlet} #{features_to_install.join(",")}"
install_command << " -IncludeAllSubFeature" if new_resource.all
if older_than_win_2012_or_8? && (new_resource.source || new_resource.management_tools)
Chef::Log.warn("The 'source' and 'management_tools' properties are only available on Windows 8/2012 or greater. Skipping these properties!")
@@ -93,11 +93,11 @@ class Chef
reload_cached_powershell_data unless node["powershell_features_cache"]
- Chef::Log.debug("Windows features needing removal: #{features_to_remove.empty? ? 'none' : features_to_remove.join(',')}")
+ Chef::Log.debug("Windows features needing removal: #{features_to_remove.empty? ? "none" : features_to_remove.join(",")}")
unless features_to_remove.empty?
- converge_by("remove Windows feature#{'s' if features_to_remove.count > 1} #{features_to_remove.join(',')}") do
- cmd = powershell_out!("#{remove_feature_cmdlet} #{features_to_remove.join(',')}", timeout: new_resource.timeout)
+ converge_by("remove Windows feature#{"s" if features_to_remove.count > 1} #{features_to_remove.join(",")}") do
+ cmd = powershell_out!("#{remove_feature_cmdlet} #{features_to_remove.join(",")}", timeout: new_resource.timeout)
Chef::Log.info(cmd.stdout)
reload_cached_powershell_data # Reload cached powershell feature state
@@ -113,11 +113,11 @@ class Chef
fail_if_unavailable # fail if the features don't exist
- Chef::Log.debug("Windows features needing deletion: #{features_to_delete.empty? ? 'none' : features_to_delete.join(',')}")
+ Chef::Log.debug("Windows features needing deletion: #{features_to_delete.empty? ? "none" : features_to_delete.join(",")}")
unless features_to_delete.empty?
- converge_by("delete Windows feature#{'s' if features_to_delete.count > 1} #{features_to_delete.join(',')} from the image") do
- cmd = powershell_out!("Uninstall-WindowsFeature #{features_to_delete.join(',')} -Remove", timeout: new_resource.timeout)
+ converge_by("delete Windows feature#{"s" if features_to_delete.count > 1} #{features_to_delete.join(",")} from the image") do
+ cmd = powershell_out!("Uninstall-WindowsFeature #{features_to_delete.join(",")} -Remove", timeout: new_resource.timeout)
Chef::Log.info(cmd.stdout)
reload_cached_powershell_data # Reload cached powershell feature state
@@ -196,7 +196,7 @@ class Chef
# the difference of desired features to install to all features is what's not available
unavailable = (new_resource.feature_name - all_available)
- raise "The Windows feature#{'s' if unavailable.count > 1} #{unavailable.join(',')} #{unavailable.count > 1 ? 'are' : 'is'} not available on this version of Windows. Run 'Get-WindowsFeature' to see the list of available feature names." unless unavailable.empty?
+ raise "The Windows feature#{"s" if unavailable.count > 1} #{unavailable.join(",")} #{unavailable.count > 1 ? "are" : "is"} not available on this version of Windows. Run 'Get-WindowsFeature' to see the list of available feature names." unless unavailable.empty?
end
# run Get-WindowsFeature to get a list of all available features and their state
@@ -219,7 +219,7 @@ class Chef
add_to_feature_mash("disabled", feature_details_raw["Name"])
end
end
- Chef::Log.debug("The powershell cache contains\n#{node['powershell_features_cache']}")
+ Chef::Log.debug("The powershell cache contains\n#{node["powershell_features_cache"]}")
end
# fetch the list of available feature names and state in JSON and parse the JSON
@@ -251,7 +251,7 @@ class Chef
return if registry_key_exists?('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Servicing') && registry_value_exists?('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Servicing', name: "LocalSourcePath") # if source is defined in the registry, still fine
end
removed = new_resource.feature_name & node["powershell_features_cache"]["removed"]
- raise "The Windows feature#{'s' if removed.count > 1} #{removed.join(',')} #{removed.count > 1 ? 'are' : 'is'} removed from the host and cannot be installed." unless removed.empty?
+ raise "The Windows feature#{"s" if removed.count > 1} #{removed.join(",")} #{removed.count > 1 ? "are" : "is"} removed from the host and cannot be installed." unless removed.empty?
end
# Fail unless we're on windows 8+ / 2012+ where deleting a feature is supported
diff --git a/lib/chef/resource/windows_firewall_rule.rb b/lib/chef/resource/windows_firewall_rule.rb
index 28144d2805..0787d634f4 100644
--- a/lib/chef/resource/windows_firewall_rule.rb
+++ b/lib/chef/resource/windows_firewall_rule.rb
@@ -152,9 +152,9 @@ class Chef
cmd << " -DisplayName '#{new_resource.rule_name}'" if cmdlet_type == "New"
cmd << " -Description '#{new_resource.description}'" if new_resource.description
cmd << " -LocalAddress '#{new_resource.local_address}'" if new_resource.local_address
- cmd << " -LocalPort #{new_resource.local_port.join(',')}" if new_resource.local_port
+ cmd << " -LocalPort #{new_resource.local_port.join(",")}" if new_resource.local_port
cmd << " -RemoteAddress '#{new_resource.remote_address}'" if new_resource.remote_address
- cmd << " -RemotePort #{new_resource.remote_port.join(',')}" if new_resource.remote_port
+ cmd << " -RemotePort #{new_resource.remote_port.join(",")}" if new_resource.remote_port
cmd << " -Direction '#{new_resource.direction}'" if new_resource.direction
cmd << " -Protocol '#{new_resource.protocol}'" if new_resource.protocol
cmd << " -Action '#{new_resource.firewall_action}'" if new_resource.firewall_action
diff --git a/lib/chef/resource/windows_share.rb b/lib/chef/resource/windows_share.rb
index 9869fc5e14..a5924d2996 100644
--- a/lib/chef/resource/windows_share.rb
+++ b/lib/chef/resource/windows_share.rb
@@ -173,7 +173,7 @@ class Chef
# local names are returned from Get-SmbShareAccess in the full format MACHINE\\NAME
# but users of this resource would simply say NAME so we need to strip the values for comparison
def stripped_account(name)
- name.slice!("#{node['hostname']}\\")
+ name.slice!("#{node["hostname"]}\\")
name
end
diff --git a/lib/chef/resource/windows_task.rb b/lib/chef/resource/windows_task.rb
index 6220400069..95de6b37c2 100644
--- a/lib/chef/resource/windows_task.rb
+++ b/lib/chef/resource/windows_task.rb
@@ -302,7 +302,7 @@ class Chef
else
days.map! { |day| day.to_s.strip.downcase }
unless (days - VALID_WEEK_DAYS).empty?
- raise ArgumentError, "day property invalid. Only valid values are: #{VALID_WEEK_DAYS.map(&:upcase).join(', ')}. Multiple values must be separated by a comma."
+ raise ArgumentError, "day property invalid. Only valid values are: #{VALID_WEEK_DAYS.map(&:upcase).join(", ")}. Multiple values must be separated by a comma."
end
end
end
@@ -315,7 +315,7 @@ class Chef
months = months.split(",")
months.map! { |month| month.strip.upcase }
unless (months - VALID_MONTHS).empty?
- raise ArgumentError, "months property invalid. Only valid values are: #{VALID_MONTHS.join(', ')}. Multiple values must be separated by a comma."
+ raise ArgumentError, "months property invalid. Only valid values are: #{VALID_MONTHS.join(", ")}. Multiple values must be separated by a comma."
end
end
end
diff --git a/lib/chef/shell/shell_session.rb b/lib/chef/shell/shell_session.rb
index d17d212d18..85e5b85ab3 100644
--- a/lib/chef/shell/shell_session.rb
+++ b/lib/chef/shell/shell_session.rb
@@ -260,7 +260,7 @@ module Shell
@run_list_expansion = @node.expand!("server")
@expanded_run_list_with_versions = @run_list_expansion.recipes.with_version_constraints_strings
Chef::Log.info("Run List is [#{@node.run_list}]")
- Chef::Log.info("Run List expands to [#{@expanded_run_list_with_versions.join(', ')}]")
+ Chef::Log.info("Run List expands to [#{@expanded_run_list_with_versions.join(", ")}]")
@node
end
diff --git a/lib/chef/train_transport.rb b/lib/chef/train_transport.rb
index fa7e85c9c1..accaa6355b 100644
--- a/lib/chef/train_transport.rb
+++ b/lib/chef/train_transport.rb
@@ -100,7 +100,7 @@ class Chef
tm_config = Chef::Config.target_mode
protocol = tm_config.protocol
train_config = tm_config.to_hash.select { |k| Train.options(protocol).key?(k) }
- Chef::Log.trace("Using target mode options from Chef config file: #{train_config.keys.join(', ')}") if train_config
+ Chef::Log.trace("Using target mode options from Chef config file: #{train_config.keys.join(", ")}") if train_config
# Load the credentials file, and place any valid settings into the train configuration
credentials = load_credentials(tm_config.host)
@@ -108,7 +108,7 @@ class Chef
valid_settings = credentials.select { |k| Train.options(protocol).key?(k) }
valid_settings[:enable_password] = credentials[:enable_password] if credentials.key?(:enable_password)
train_config.merge!(valid_settings)
- Chef::Log.trace("Using target mode options from credentials file: #{valid_settings.keys.join(', ')}") if valid_settings
+ Chef::Log.trace("Using target mode options from credentials file: #{valid_settings.keys.join(", ")}") if valid_settings
end
train_config[:logger] = logger
diff --git a/lib/chef/util/dsc/configuration_generator.rb b/lib/chef/util/dsc/configuration_generator.rb
index bc331d7971..d2d358d61f 100644
--- a/lib/chef/util/dsc/configuration_generator.rb
+++ b/lib/chef/util/dsc/configuration_generator.rb
@@ -101,7 +101,7 @@ class Chef::Util::DSC
if resources.length == 0 || resources.include?("*")
"Import-DscResource -ModuleName #{resource_module}"
else
- "Import-DscResource -ModuleName #{resource_module} -Name #{resources.join(',')}"
+ "Import-DscResource -ModuleName #{resource_module} -Name #{resources.join(",")}"
end
end
else
diff --git a/lib/chef/util/dsc/local_configuration_manager.rb b/lib/chef/util/dsc/local_configuration_manager.rb
index 79c57c50c2..c0c05faba9 100644
--- a/lib/chef/util/dsc/local_configuration_manager.rb
+++ b/lib/chef/util/dsc/local_configuration_manager.rb
@@ -93,9 +93,9 @@ class Chef::Util::DSC
# LCM returns an error if any of the resources do not support the opptional What-If
Chef::Log.warn("Received error while testing configuration due to resource not supporting 'WhatIf'")
elsif dsc_module_import_failure?(dsc_exception_output)
- Chef::Log.warn("Received error while testing configuration due to a module for an imported resource possibly not being fully installed:\n#{dsc_exception_output.gsub(/\s+/, ' ')}")
+ Chef::Log.warn("Received error while testing configuration due to a module for an imported resource possibly not being fully installed:\n#{dsc_exception_output.gsub(/\s+/, " ")}")
else
- Chef::Log.warn("Received error while testing configuration:\n#{dsc_exception_output.gsub(/\s+/, ' ')}")
+ Chef::Log.warn("Received error while testing configuration:\n#{dsc_exception_output.gsub(/\s+/, " ")}")
end
end
diff --git a/lib/chef/version_constraint.rb b/lib/chef/version_constraint.rb
index ba0a3669ed..bfaf403f47 100644
--- a/lib/chef/version_constraint.rb
+++ b/lib/chef/version_constraint.rb
@@ -90,7 +90,7 @@ class Chef
parse(constraint_spec.first)
else
msg = "only one version constraint operation is supported, but you gave #{constraint_spec.size} "
- msg << "['#{constraint_spec.join(', ')}']"
+ msg << "['#{constraint_spec.join(", ")}']"
raise Chef::Exceptions::InvalidVersionConstraint, msg
end
end
diff --git a/lib/chef/win32/security/sid.rb b/lib/chef/win32/security/sid.rb
index a8dbb56a2f..9643a80c67 100644
--- a/lib/chef/win32/security/sid.rb
+++ b/lib/chef/win32/security/sid.rb
@@ -231,19 +231,19 @@ class Chef
end
def self.None
- SID.from_account("#{::ENV['COMPUTERNAME']}\\None")
+ SID.from_account("#{::ENV["COMPUTERNAME"]}\\None")
end
def self.Administrator
- SID.from_account("#{::ENV['COMPUTERNAME']}\\#{SID.admin_account_name}")
+ SID.from_account("#{::ENV["COMPUTERNAME"]}\\#{SID.admin_account_name}")
end
def self.Guest
- SID.from_account("#{::ENV['COMPUTERNAME']}\\Guest")
+ SID.from_account("#{::ENV["COMPUTERNAME"]}\\Guest")
end
def self.current_user
- SID.from_account("#{::ENV['USERDOMAIN']}\\#{::ENV['USERNAME']}")
+ SID.from_account("#{::ENV["USERDOMAIN"]}\\#{::ENV["USERNAME"]}")
end
SERVICE_ACCOUNT_USERS = [self.LocalSystem,
diff --git a/lib/chef/win32/version.rb b/lib/chef/win32/version.rb
index 7994bd3c12..daf043d84a 100644
--- a/lib/chef/win32/version.rb
+++ b/lib/chef/win32/version.rb
@@ -43,7 +43,7 @@ class Chef
private_class_method :get_system_metrics
def self.method_name_from_marketing_name(marketing_name)
- "#{marketing_name.gsub(/\s/, '_').tr('.', '_').downcase}?"
+ "#{marketing_name.gsub(/\s/, "_").tr(".", "_").downcase}?"
end
private_class_method :method_name_from_marketing_name