summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2020-05-06 17:02:00 -0700
committerGitHub <noreply@github.com>2020-05-06 17:02:00 -0700
commit7e06b4eb01dafa3fb867b4d60d0f40b8cf8bf69f (patch)
tree9cb0c8fd6f4bdf274a5d3d07be8d2c07b773e3f4
parentb39cf567a0e39c989c85bfc92b5352a655eeac05 (diff)
parentbed3ecfb36c61ec78b93155ad4ae3f3a01a2f57f (diff)
downloadchef-7e06b4eb01dafa3fb867b4d60d0f40b8cf8bf69f.tar.gz
Merge pull request #9811 from chef/comments
Align all our comments with the code
-rw-r--r--chef-config/lib/chef-config/path_helper.rb2
-rw-r--r--chef-config/spec/unit/config_spec.rb46
-rw-r--r--lib/chef/application/apply.rb2
-rw-r--r--lib/chef/application/exit_code.rb4
-rw-r--r--lib/chef/chef_fs/chef_fs_data_store.rb6
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/policies_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb2
-rw-r--r--lib/chef/chef_fs/file_system/multiplexed_dir.rb2
-rw-r--r--lib/chef/cookbook_version.rb8
-rw-r--r--lib/chef/deprecated.rb2
-rw-r--r--lib/chef/dsl/platform_introspection.rb2
-rw-r--r--lib/chef/knife/bootstrap.rb12
-rw-r--r--lib/chef/mixin/create_path.rb16
-rw-r--r--lib/chef/node/mixin/deep_merge_cache.rb14
-rw-r--r--lib/chef/provider/service/simple.rb6
-rw-r--r--lib/chef/provider/windows_task.rb2
-rw-r--r--lib/chef/resource/launchd.rb8
-rw-r--r--lib/chef/resource/macos_userdefaults.rb6
-rw-r--r--lib/chef/resource/windows_firewall_rule.rb4
-rw-r--r--lib/chef/resource/windows_share.rb4
-rw-r--r--lib/chef/resource/windows_task.rb26
-rw-r--r--lib/chef/util/dsc/lcm_output_parser.rb6
-rw-r--r--lib/chef/win32/api/file.rb36
-rw-r--r--lib/chef/win32/process.rb4
-rw-r--r--spec/functional/resource/user/dscl_spec.rb2
-rw-r--r--spec/functional/resource/user/mac_user_spec.rb2
-rw-r--r--spec/support/shared/functional/file_resource.rb2
-rw-r--r--spec/unit/knife/role_env_run_list_add_spec.rb12
-rw-r--r--spec/unit/knife/role_env_run_list_clear_spec.rb8
-rw-r--r--spec/unit/knife/role_env_run_list_remove_spec.rb8
-rw-r--r--spec/unit/knife/role_env_run_list_replace_spec.rb8
-rw-r--r--spec/unit/knife/role_env_run_list_set_spec.rb8
-rw-r--r--spec/unit/knife/role_run_list_add_spec.rb12
-rw-r--r--spec/unit/knife/role_run_list_clear_spec.rb8
-rw-r--r--spec/unit/knife/role_run_list_remove_spec.rb8
-rw-r--r--spec/unit/knife/role_run_list_replace_spec.rb8
-rw-r--r--spec/unit/knife/role_run_list_set_spec.rb8
-rw-r--r--spec/unit/provider/git_spec.rb6
-rw-r--r--spec/unit/provider/osx_profile_spec.rb4
-rw-r--r--spec/unit/provider/package/msu_spec.rb6
-rw-r--r--spec/unit/provider/service/gentoo_service_spec.rb2
-rw-r--r--spec/unit/provider_resolver_spec.rb18
-rw-r--r--spec/unit/run_context_spec.rb2
43 files changed, 177 insertions, 177 deletions
diff --git a/chef-config/lib/chef-config/path_helper.rb b/chef-config/lib/chef-config/path_helper.rb
index 341f6f583e..bba639245e 100644
--- a/chef-config/lib/chef-config/path_helper.rb
+++ b/chef-config/lib/chef-config/path_helper.rb
@@ -268,7 +268,7 @@ module ChefConfig
# Determine if the given path is protected by macOS System Integrity Protection.
def self.is_sip_path?(path, node)
if ChefUtils.macos?
- # @todo: parse rootless.conf for this?
+ # @todo: parse rootless.conf for this?
sip_paths = [
"/System", "/bin", "/sbin", "/usr"
]
diff --git a/chef-config/spec/unit/config_spec.rb b/chef-config/spec/unit/config_spec.rb
index 874e3a48c4..5cf814e7b3 100644
--- a/chef-config/spec/unit/config_spec.rb
+++ b/chef-config/spec/unit/config_spec.rb
@@ -186,29 +186,29 @@ RSpec.describe ChefConfig::Config do
end
describe "when configuring formatters" do
- # if TTY and not(force-logger)
- # formatter = configured formatter or default formatter
- # formatter goes to STDOUT/ERR
- # if log file is writeable
- # log level is configured level or info
- # log location is file
- # else
- # log level is warn
- # log location is STDERR
- # end
- # elsif not(TTY) and force formatter
- # formatter = configured formatter or default formatter
- # if log_location specified
- # formatter goes to log_location
- # else
- # formatter goes to STDOUT/ERR
- # end
- # else
- # formatter = "null"
- # log_location = configured-value or defualt
- # log_level = info or defualt
- # end
- #
+ # if TTY and not(force-logger)
+ # formatter = configured formatter or default formatter
+ # formatter goes to STDOUT/ERR
+ # if log file is writeable
+ # log level is configured level or info
+ # log location is file
+ # else
+ # log level is warn
+ # log location is STDERR
+ # end
+ # elsif not(TTY) and force formatter
+ # formatter = configured formatter or default formatter
+ # if log_location specified
+ # formatter goes to log_location
+ # else
+ # formatter goes to STDOUT/ERR
+ # end
+ # else
+ # formatter = "null"
+ # log_location = configured-value or defualt
+ # log_level = info or defualt
+ # end
+ #
it "has an empty list of formatters by default" do
expect(ChefConfig::Config.formatters).to eq([])
end
diff --git a/lib/chef/application/apply.rb b/lib/chef/application/apply.rb
index 7267f4ecfa..33a8a97f5b 100644
--- a/lib/chef/application/apply.rb
+++ b/lib/chef/application/apply.rb
@@ -232,7 +232,7 @@ class Chef::Application::Apply < Chef::Application
Chef::Application.fatal!("#{e.class}: #{e.message}", e)
end
- # Get this party started
+ # Get this party started
def run(enforce_license = false)
reconfigure
check_license_acceptance if enforce_license
diff --git a/lib/chef/application/exit_code.rb b/lib/chef/application/exit_code.rb
index fb1519e573..3235bfadeb 100644
--- a/lib/chef/application/exit_code.rb
+++ b/lib/chef/application/exit_code.rb
@@ -139,8 +139,8 @@ class Chef
def notify_on_deprecation(message)
Chef.deprecated(:exit_code, message)
rescue Chef::Exceptions::DeprecatedFeatureError
- # Have to rescue this, otherwise this unhandled error preempts
- # the current exit code assignment.
+ # Have to rescue this, otherwise this unhandled error preempts
+ # the current exit code assignment.
end
def non_standard_exit_code_warning(exit_code)
diff --git a/lib/chef/chef_fs/chef_fs_data_store.rb b/lib/chef/chef_fs/chef_fs_data_store.rb
index 689ae3bf8a..8237729e89 100644
--- a/lib/chef/chef_fs/chef_fs_data_store.rb
+++ b/lib/chef/chef_fs/chef_fs_data_store.rb
@@ -204,7 +204,7 @@ class Chef
@memory_store.create(path, name, data, *options)
elsif path[0] == "cookbooks" && path.length == 2
- # Do nothing. The entry gets created when the cookbook is created.
+ # Do nothing. The entry gets created when the cookbook is created.
# /policy_groups/GROUP/policies/NAME
elsif path[0] == "policy_groups" && path[2] == "policies"
@@ -724,8 +724,8 @@ class Chef
path[-1] = "#{path[-1]}.json"
end
- # /acls/containers|nodes|... do NOT drop into the next elsif, and do
- # not get .json appended
+ # /acls/containers|nodes|... do NOT drop into the next elsif, and do
+ # not get .json appended
# /nodes|clients|.../x.json
elsif path.length == 2
diff --git a/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb b/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb
index e0d4bea665..aa6981f23c 100644
--- a/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/policies_dir.rb
@@ -66,7 +66,7 @@ class Chef
# }
# }
def children
- # Grab the names of the children, append json, and make child entries
+ # Grab the names of the children, append json, and make child entries
@children ||= begin
result = []
data = root.get_json(api_path)
diff --git a/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb b/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb
index b60b84cb68..0a1ee83c36 100644
--- a/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb
+++ b/lib/chef/chef_fs/file_system/chef_server/rest_list_dir.rb
@@ -71,7 +71,7 @@ class Chef
# Children are foo.json and bar.json in this case.
#
def children
- # Grab the names of the children, append json, and make child entries
+ # Grab the names of the children, append json, and make child entries
@children ||= root.get_json(api_path).keys.sort.map do |key|
make_child_entry(key, true)
end
diff --git a/lib/chef/chef_fs/file_system/multiplexed_dir.rb b/lib/chef/chef_fs/file_system/multiplexed_dir.rb
index 2930dd5d8c..82fa146264 100644
--- a/lib/chef/chef_fs/file_system/multiplexed_dir.rb
+++ b/lib/chef/chef_fs/file_system/multiplexed_dir.rb
@@ -19,7 +19,7 @@ class Chef
def children
result = []
seen = {}
- # If multiple things have the same name, the first one wins.
+ # If multiple things have the same name, the first one wins.
multiplexed_dirs.each do |dir|
dir.children.each do |child|
if seen[child.name]
diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb
index a4b0815185..12adb50b4c 100644
--- a/lib/chef/cookbook_version.rb
+++ b/lib/chef/cookbook_version.rb
@@ -358,10 +358,10 @@ class Chef
# extract the preference part from the path.
if manifest_record_path =~ %r{(#{Regexp.escape(segment.to_s)}/[^/]+/#{Regexp.escape(dirname)})/.+$}
- # Note the specificy_dirname includes the segment and
- # dirname argument as above, which is what
- # preferences_for_path returns. It could be
- # "files/ubuntu-9.10/dirname", for example.
+ # Note the specificy_dirname includes the segment and
+ # dirname argument as above, which is what
+ # preferences_for_path returns. It could be
+ # "files/ubuntu-9.10/dirname", for example.
specificity_dirname = $1
# Record the specificity_dirname only if it's in the list of
diff --git a/lib/chef/deprecated.rb b/lib/chef/deprecated.rb
index ecc589d263..9ac08f43ee 100644
--- a/lib/chef/deprecated.rb
+++ b/lib/chef/deprecated.rb
@@ -72,7 +72,7 @@ class Chef
# Just in case someone uses a symbol in the config by mistake.
silence_spec = silence_spec.to_s
end
- # Check for a silence by deprecation name, or by location.
+ # Check for a silence by deprecation name, or by location.
self.class.deprecation_key == silence_spec || self.class.deprecation_id.to_s == silence_spec || "chef-#{self.class.deprecation_id}" == silence_spec.downcase || location.include?(silence_spec)
end
# check if this warning has been silenced by inline comment.
diff --git a/lib/chef/dsl/platform_introspection.rb b/lib/chef/dsl/platform_introspection.rb
index e8fe616084..794f807f23 100644
--- a/lib/chef/dsl/platform_introspection.rb
+++ b/lib/chef/dsl/platform_introspection.rb
@@ -168,7 +168,7 @@ class Chef
has_platform
end
- # Implementation class for determining platform family dependent values
+ # Implementation class for determining platform family dependent values
class PlatformFamilyDependentValue
# Create a platform family dependent value object.
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb
index bb6c5871c6..f9c3b7bb81 100644
--- a/lib/chef/knife/bootstrap.rb
+++ b/lib/chef/knife/bootstrap.rb
@@ -93,12 +93,12 @@ class Chef
description: "For WinRM basic authentication when using the 'ssl' auth method.",
boolean: true
- # This option was provided in knife bootstrap windows winrm,
- # but it is ignored in knife-windows/WinrmSession, and so remains unimplemeneted here.
- # option :kerberos_keytab_file,
- # :short => "-T KEYTAB_FILE",
- # :long => "--keytab-file KEYTAB_FILE",
- # :description => "The Kerberos keytab file used for authentication"
+ # This option was provided in knife bootstrap windows winrm,
+ # but it is ignored in knife-windows/WinrmSession, and so remains unimplemeneted here.
+ # option :kerberos_keytab_file,
+ # :short => "-T KEYTAB_FILE",
+ # :long => "--keytab-file KEYTAB_FILE",
+ # :description => "The Kerberos keytab file used for authentication"
option :kerberos_realm,
short: "-R KERBEROS_REALM",
diff --git a/lib/chef/mixin/create_path.rb b/lib/chef/mixin/create_path.rb
index 6d6f66317e..26988556aa 100644
--- a/lib/chef/mixin/create_path.rb
+++ b/lib/chef/mixin/create_path.rb
@@ -53,14 +53,14 @@ class Chef
private
def create_dir(path)
- # When doing multithreaded downloads into the file cache, the following
- # interleaving raises an error here:
- #
- # thread1 thread2
- # File.directory?(create_path) <- false
- # File.directory?(create_path) <- false
- # Dir.mkdir(create_path)
- # Dir.mkdir(create_path) <- raises Errno::EEXIST
+ # When doing multithreaded downloads into the file cache, the following
+ # interleaving raises an error here:
+ #
+ # thread1 thread2
+ # File.directory?(create_path) <- false
+ # File.directory?(create_path) <- false
+ # Dir.mkdir(create_path)
+ # Dir.mkdir(create_path) <- raises Errno::EEXIST
Chef::Log.trace("Creating directory #{path}")
Dir.mkdir(path)
rescue Errno::EEXIST
diff --git a/lib/chef/node/mixin/deep_merge_cache.rb b/lib/chef/node/mixin/deep_merge_cache.rb
index 8cde5a400a..e88e079895 100644
--- a/lib/chef/node/mixin/deep_merge_cache.rb
+++ b/lib/chef/node/mixin/deep_merge_cache.rb
@@ -19,9 +19,9 @@ class Chef
class Node
module Mixin
module DeepMergeCache
- # Cache of deep merged values by top-level key. This is a simple hash which has keys that are the
- # top-level keys of the node object, and we save the computed deep-merge for that key here. There is
- # no cache of subtrees.
+ # Cache of deep merged values by top-level key. This is a simple hash which has keys that are the
+ # top-level keys of the node object, and we save the computed deep-merge for that key here. There is
+ # no cache of subtrees.
attr_accessor :deep_merge_cache
def initialize
@@ -31,10 +31,10 @@ class Chef
@deep_merge_cache = {}
end
- # Invalidate a key in the deep_merge_cache. If called with nil, or no arg, this will invalidate
- # the entire deep_merge cache. In the case of the user doing node.default['foo']['bar']['baz']=
- # that eventually results in a call to reset_cache('foo') here. A node.default=hash_thing call
- # must invalidate the entire cache and re-deep-merge the entire node object.
+ # Invalidate a key in the deep_merge_cache. If called with nil, or no arg, this will invalidate
+ # the entire deep_merge cache. In the case of the user doing node.default['foo']['bar']['baz']=
+ # that eventually results in a call to reset_cache('foo') here. A node.default=hash_thing call
+ # must invalidate the entire cache and re-deep-merge the entire node object.
def reset_cache(path = nil)
if path.nil?
deep_merge_cache.clear
diff --git a/lib/chef/provider/service/simple.rb b/lib/chef/provider/service/simple.rb
index 754437b4a0..0d1a9ae786 100644
--- a/lib/chef/provider/service/simple.rb
+++ b/lib/chef/provider/service/simple.rb
@@ -117,9 +117,9 @@ class Chef
logger.trace("#{@new_resource} is running")
end
rescue Mixlib::ShellOut::ShellCommandFailed, SystemCallError
- # ShellOut sometimes throws different types of Exceptions than ShellCommandFailed.
- # Temporarily catching different types of exceptions here until we get Shellout fixed.
- # TODO: Remove the line before one we get the ShellOut fix.
+ # ShellOut sometimes throws different types of Exceptions than ShellCommandFailed.
+ # Temporarily catching different types of exceptions here until we get Shellout fixed.
+ # TODO: Remove the line before one we get the ShellOut fix.
@status_load_success = false
@current_resource.running false
nil
diff --git a/lib/chef/provider/windows_task.rb b/lib/chef/provider/windows_task.rb
index 598e6f8e60..ff0d338b48 100644
--- a/lib/chef/provider/windows_task.rb
+++ b/lib/chef/provider/windows_task.rb
@@ -424,7 +424,7 @@ class Chef
when TaskScheduler::AT_LOGON
# TODO: handle option for this trigger
when TaskScheduler::AT_SYSTEMSTART
- # TODO: handle option for this trigger
+ # TODO: handle option for this trigger
end
end
diff --git a/lib/chef/resource/launchd.rb b/lib/chef/resource/launchd.rb
index e116f8c624..f71abd8557 100644
--- a/lib/chef/resource/launchd.rb
+++ b/lib/chef/resource/launchd.rb
@@ -76,20 +76,20 @@ class Chef
property :start_calendar_interval, [Hash, Array],
description: "A Hash (similar to crontab) that defines the calendar frequency at which a job is started or an Array.",
coerce: proc { |type|
- # Coerce into an array of hashes to make validation easier
+ # Coerce into an array of hashes to make validation easier
array = if type.is_a?(Array)
type
else
[type]
end
- # Check to make sure that our array only has hashes
+ # Check to make sure that our array only has hashes
unless array.all? { |obj| obj.is_a?(Hash) }
error_msg = "start_calendar_interval must be a single hash or an array of hashes!"
raise Chef::Exceptions::ValidationFailed, error_msg
end
- # Make sure the hashes don't have any incorrect keys/values
+ # Make sure the hashes don't have any incorrect keys/values
array.each do |entry|
allowed_keys = %w{Minute Hour Day Weekday Month}
unless entry.keys.all? { |key| allowed_keys.include?(key) }
@@ -105,7 +105,7 @@ class Chef
end
end
- # Don't return array if we only have one entry
+ # Don't return array if we only have one entry
if array.size == 1
array.first
else
diff --git a/lib/chef/resource/macos_userdefaults.rb b/lib/chef/resource/macos_userdefaults.rb
index acd783cade..a8158aba5e 100644
--- a/lib/chef/resource/macos_userdefaults.rb
+++ b/lib/chef/resource/macos_userdefaults.rb
@@ -62,9 +62,9 @@ class Chef
desired_state: false,
skip_docs: true
- # coerce various ways of representing a boolean into either 0 (false) or 1 (true)
- # which is what the defaults CLI expects. Why? Well defaults itself accepts a few
- # different formats, but when you do a read command it all comes back as 1 or 0.
+ # coerce various ways of representing a boolean into either 0 (false) or 1 (true)
+ # which is what the defaults CLI expects. Why? Well defaults itself accepts a few
+ # different formats, but when you do a read command it all comes back as 1 or 0.
def coerce_booleans(val)
return 1 if [true, "TRUE", "1", "true", "YES", "yes"].include?(val)
return 0 if [false, "FALSE", "0", "false", "NO", "no"].include?(val)
diff --git a/lib/chef/resource/windows_firewall_rule.rb b/lib/chef/resource/windows_firewall_rule.rb
index f7f22856d6..f1a039267d 100644
--- a/lib/chef/resource/windows_firewall_rule.rb
+++ b/lib/chef/resource/windows_firewall_rule.rb
@@ -93,7 +93,7 @@ class Chef
description: "The local address the firewall rule applies to."
property :local_port, [String, Integer, Array],
- # split various formats of comma separated lists and provide a sorted array of strings to match PS output
+ # split various formats of comma separated lists and provide a sorted array of strings to match PS output
coerce: proc { |d| d.is_a?(String) ? d.split(/\s*,\s*/).sort : Array(d).sort.map(&:to_s) },
description: "The local port the firewall rule applies to."
@@ -101,7 +101,7 @@ class Chef
description: "The remote address the firewall rule applies to."
property :remote_port, [String, Integer, Array],
- # split various formats of comma separated lists and provide a sorted array of strings to match PS output
+ # split various formats of comma separated lists and provide a sorted array of strings to match PS output
coerce: proc { |d| d.is_a?(String) ? d.split(/\s*,\s*/).sort : Array(d).sort.map(&:to_s) },
description: "The remote port the firewall rule applies to."
diff --git a/lib/chef/resource/windows_share.rb b/lib/chef/resource/windows_share.rb
index 1f8586836d..10533382f9 100644
--- a/lib/chef/resource/windows_share.rb
+++ b/lib/chef/resource/windows_share.rb
@@ -187,8 +187,8 @@ class Chef
[f_users, c_users, r_users]
end
-# 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
+ # 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
diff --git a/lib/chef/resource/windows_task.rb b/lib/chef/resource/windows_task.rb
index bd53744f0a..5e2aa70c47 100644
--- a/lib/chef/resource/windows_task.rb
+++ b/lib/chef/resource/windows_task.rb
@@ -272,16 +272,16 @@ class Chef
private
- ## Resource is not idempotent when day, start_day is not provided with frequency :weekly
- ## we set start_day when not given by user as current date based on which we set the day property for current current date day is monday ..
- ## we set the monday as the day so at next run when new_resource.day is nil and current_resource day is monday due to which udpate gets called
+ ## Resource is not idempotent when day, start_day is not provided with frequency :weekly
+ ## we set start_day when not given by user as current date based on which we set the day property for current current date day is monday ..
+ ## we set the monday as the day so at next run when new_resource.day is nil and current_resource day is monday due to which udpate gets called
def idempotency_warning_for_frequency_weekly(day, start_day)
if start_day.nil? && day.nil?
logger.warn "To maintain idempotency for frequency :weekly provide start_day, start_time and day."
end
end
- # Validate the passed value is numeric values only if it is a string
+ # Validate the passed value is numeric values only if it is a string
def numeric_value_in_string?(val)
return true if Integer(val)
rescue ArgumentError
@@ -307,7 +307,7 @@ class Chef
end
end
- # returns true if frequency_modifer has values First, second, third, fourth, last, lastday
+ # returns true if frequency_modifer has values First, second, third, fourth, last, lastday
def frequency_modifier_includes_days_of_weeks?(frequency_modifier)
frequency_modifier = frequency_modifier.to_s.split(",")
frequency_modifier.map! { |value| value.strip.upcase }
@@ -322,7 +322,7 @@ class Chef
raise ArgumentError, "Invalid value passed for `random_delay`. Please pass seconds as an Integer (e.g. 60) or a String with numeric values only (e.g. '60')." unless numeric_value_in_string?(random_delay)
end
- # @todo when we drop ruby 2.3 support this should be converted to .match?() instead of =~f
+ # @todo when we drop ruby 2.3 support this should be converted to .match?() instead of =~f
def validate_start_day(start_day, frequency)
if start_day && frequency == :none
raise ArgumentError, "`start_day` property is not supported with frequency: #{frequency}"
@@ -334,7 +334,7 @@ class Chef
end
end
- # @todo when we drop ruby 2.3 support this should be converted to .match?() instead of =~
+ # @todo when we drop ruby 2.3 support this should be converted to .match?() instead of =~
def validate_start_time(start_time, frequency)
if start_time
raise ArgumentError, "`start_time` property is not supported with `frequency :none`" if frequency == :none
@@ -434,7 +434,7 @@ class Chef
end
end
- # This method returns true if day has values from 1-31 which is a days of moths and used with frequency :monthly
+ # This method returns true if day has values from 1-31 which is a days of moths and used with frequency :monthly
def days_includes_days_of_months?(days)
days.map! { |day| day.to_s.strip.downcase }
(days - VALID_DAYS_OF_MONTH).empty?
@@ -452,11 +452,11 @@ class Chef
end
end
- # Converts the number of seconds to an ISO8601 duration format and returns it.
- # Ref : https://github.com/arnau/ISO8601/blob/master/lib/iso8601/duration.rb#L18-L23
- # e.g.
- # ISO8601::Duration.new(65707200).to_s
- # returns 'PT65707200S'
+ # Converts the number of seconds to an ISO8601 duration format and returns it.
+ # Ref : https://github.com/arnau/ISO8601/blob/master/lib/iso8601/duration.rb#L18-L23
+ # e.g.
+ # ISO8601::Duration.new(65707200).to_s
+ # returns 'PT65707200S'
def sec_to_dur(seconds)
ISO8601::Duration.new(seconds.to_i).to_s
end
diff --git a/lib/chef/util/dsc/lcm_output_parser.rb b/lib/chef/util/dsc/lcm_output_parser.rb
index 2c052396e1..38c202a4bb 100644
--- a/lib/chef/util/dsc/lcm_output_parser.rb
+++ b/lib/chef/util/dsc/lcm_output_parser.rb
@@ -160,9 +160,9 @@ class Chef
def self.parse_line(line)
if match = line.match(/^.*?:.*?:\s*LCM:\s*\[(.*?)\](.*)/)
- # If the line looks like
- # What If: [machinename]: LCM: [op_action op_type] message
- # extract op_action, op_type, and message
+ # If the line looks like
+ # What If: [machinename]: LCM: [op_action op_type] message
+ # extract op_action, op_type, and message
operation, info = match.captures
op_action, op_type = operation.strip.split(" ").map { |m| m.downcase.to_sym }
else
diff --git a/lib/chef/win32/api/file.rb b/lib/chef/win32/api/file.rb
index 7aca1068e0..11a18e26d1 100644
--- a/lib/chef/win32/api/file.rb
+++ b/lib/chef/win32/api/file.rb
@@ -461,22 +461,22 @@ BOOL WINAPI DeviceIoControl(
=end
safe_attach_function :DeviceIoControl, %i{HANDLE DWORD LPVOID DWORD LPVOID DWORD LPDWORD pointer}, :BOOL
-# BOOL WINAPI DeleteVolumeMountPoint(
- # _In_ LPCTSTR lpszVolumeMountPoint
-# );
+ # BOOL WINAPI DeleteVolumeMountPoint(
+ # _In_ LPCTSTR lpszVolumeMountPoint
+ # );
safe_attach_function :DeleteVolumeMountPointW, [:LPCTSTR], :BOOL
-# BOOL WINAPI SetVolumeMountPoint(
- # _In_ LPCTSTR lpszVolumeMountPoint,
- # _In_ LPCTSTR lpszVolumeName
-# );
+ # BOOL WINAPI SetVolumeMountPoint(
+ # _In_ LPCTSTR lpszVolumeMountPoint,
+ # _In_ LPCTSTR lpszVolumeName
+ # );
safe_attach_function :SetVolumeMountPointW, %i{LPCTSTR LPCTSTR}, :BOOL
-# BOOL WINAPI GetVolumeNameForVolumeMountPoint(
- # _In_ LPCTSTR lpszVolumeMountPoint,
- # _Out_ LPTSTR lpszVolumeName,
- # _In_ DWORD cchBufferLength
-# );
+ # BOOL WINAPI GetVolumeNameForVolumeMountPoint(
+ # _In_ LPCTSTR lpszVolumeMountPoint,
+ # _Out_ LPTSTR lpszVolumeName,
+ # _In_ DWORD cchBufferLength
+ # );
safe_attach_function :GetVolumeNameForVolumeMountPointW, %i{LPCTSTR LPTSTR DWORD}, :BOOL
=begin
@@ -538,12 +538,12 @@ BOOL WINAPI VerQueryValue(
# ensures the handle is closed on exit of the block
# FIXME: yard with @yield
def file_search_handle(path)
- # Workaround for CHEF-4419:
- # Make sure paths starting with "/" has a drive letter
- # assigned from the current working diretory.
- # Note: With CHEF-4427 this issue will be fixed with a
- # broader fix to map all the paths starting with "/" to
- # SYSTEM_DRIVE on windows.
+ # Workaround for CHEF-4419:
+ # Make sure paths starting with "/" has a drive letter
+ # assigned from the current working diretory.
+ # Note: With CHEF-4427 this issue will be fixed with a
+ # broader fix to map all the paths starting with "/" to
+ # SYSTEM_DRIVE on windows.
path = ::File.expand_path(path) if path.start_with? "/"
path = canonical_encode_path(path)
find_data = WIN32_FIND_DATA.new
diff --git a/lib/chef/win32/process.rb b/lib/chef/win32/process.rb
index fa3286108c..17621f8518 100644
--- a/lib/chef/win32/process.rb
+++ b/lib/chef/win32/process.rb
@@ -82,8 +82,8 @@ class Chef
(call_succeeded != 0) && (is_64_bit_process_result.get_int(0) != 0)
end
- # Must have PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION rights,
- # AND the PROCESS_VM_READ right
+ # Must have PROCESS_QUERY_INFORMATION or PROCESS_QUERY_LIMITED_INFORMATION rights,
+ # AND the PROCESS_VM_READ right
def self.get_process_memory_info(handle)
memory_info = PROCESS_MEMORY_COUNTERS.new
unless GetProcessMemoryInfo(handle.handle, memory_info, memory_info.size)
diff --git a/spec/functional/resource/user/dscl_spec.rb b/spec/functional/resource/user/dscl_spec.rb
index 6a18e0fd19..462e4aaa0b 100644
--- a/spec/functional/resource/user/dscl_spec.rb
+++ b/spec/functional/resource/user/dscl_spec.rb
@@ -29,7 +29,7 @@ describe "Chef::Resource::User with Chef::Provider::User::Dscl provider", metada
def clean_user
shell_out!("/usr/bin/dscl . -delete '/Users/#{username}'")
rescue Mixlib::ShellOut::ShellCommandFailed
- # Raised when the user is already cleaned
+ # Raised when the user is already cleaned
end
def user_should_exist
diff --git a/spec/functional/resource/user/mac_user_spec.rb b/spec/functional/resource/user/mac_user_spec.rb
index 2a2a4f4eac..f383140d0a 100644
--- a/spec/functional/resource/user/mac_user_spec.rb
+++ b/spec/functional/resource/user/mac_user_spec.rb
@@ -29,7 +29,7 @@ describe "Chef::Resource::User with Chef::Provider::User::MacUser provider", met
def clean_user
shell_out!("/usr/bin/dscl . -delete '/Users/#{username}'")
rescue Mixlib::ShellOut::ShellCommandFailed
- # Raised when the user is already cleaned
+ # Raised when the user is already cleaned
end
def ensure_file_cache_path_exists
diff --git a/spec/support/shared/functional/file_resource.rb b/spec/support/shared/functional/file_resource.rb
index ac37e2c735..7547d119bb 100644
--- a/spec/support/shared/functional/file_resource.rb
+++ b/spec/support/shared/functional/file_resource.rb
@@ -370,7 +370,7 @@ shared_examples_for "a configured file resource" do
Chef::Config[:ssl_verify_mode] = :verify_none
end
- # note the stripping of the drive letter from the tmpdir on windows
+ # note the stripping of the drive letter from the tmpdir on windows
let(:backup_glob) { File.join(CHEF_SPEC_BACKUP_PATH, test_file_dir.sub(/^([A-Za-z]:)/, ""), "#{file_base}*") }
# Most tests update the resource, but a few do not. We need to test that the
diff --git a/spec/unit/knife/role_env_run_list_add_spec.rb b/spec/unit/knife/role_env_run_list_add_spec.rb
index 3696134dd3..13a05db33e 100644
--- a/spec/unit/knife/role_env_run_list_add_spec.rb
+++ b/spec/unit/knife/role_env_run_list_add_spec.rb
@@ -21,8 +21,8 @@ require "spec_helper"
describe Chef::Knife::RoleEnvRunListAdd do
before(:each) do
-# Chef::Config[:role_name] = "websimian"
-# Chef::Config[:env_name] = "QA"
+ # Chef::Config[:role_name] = "websimian"
+ # Chef::Config[:env_name] = "QA"
@knife = Chef::Knife::RoleEnvRunListAdd.new
@knife.config = {
after: nil,
@@ -36,10 +36,10 @@ describe Chef::Knife::RoleEnvRunListAdd do
describe "run" do
-# it "should display all the things" do
-# @knife.run
-# @role.to_json.should == 'show all the things'
-# end
+ # it "should display all the things" do
+ # @knife.run
+ # @role.to_json.should == 'show all the things'
+ # end
it "should have an empty default run list" do
@knife.run
diff --git a/spec/unit/knife/role_env_run_list_clear_spec.rb b/spec/unit/knife/role_env_run_list_clear_spec.rb
index cc608c918b..d4b9625550 100644
--- a/spec/unit/knife/role_env_run_list_clear_spec.rb
+++ b/spec/unit/knife/role_env_run_list_clear_spec.rb
@@ -44,10 +44,10 @@ describe Chef::Knife::RoleEnvRunListClear do
describe "run" do
-# it "should display all the things" do
-# @knife.run
-# @role.to_json.should == 'show all the things'
-# end
+ # it "should display all the things" do
+ # @knife.run
+ # @role.to_json.should == 'show all the things'
+ # end
it "should load the node" do
expect(Chef::Role).to receive(:load).with("will").and_return(@role)
diff --git a/spec/unit/knife/role_env_run_list_remove_spec.rb b/spec/unit/knife/role_env_run_list_remove_spec.rb
index 9bade8fac4..7f9b41475c 100644
--- a/spec/unit/knife/role_env_run_list_remove_spec.rb
+++ b/spec/unit/knife/role_env_run_list_remove_spec.rb
@@ -44,10 +44,10 @@ describe Chef::Knife::RoleEnvRunListRemove do
describe "run" do
-# it "should display all the things" do
-# @knife.run
-# @role.to_json.should == 'show all the things'
-# end
+ # it "should display all the things" do
+ # @knife.run
+ # @role.to_json.should == 'show all the things'
+ # end
it "should load the node" do
expect(Chef::Role).to receive(:load).with("will").and_return(@role)
diff --git a/spec/unit/knife/role_env_run_list_replace_spec.rb b/spec/unit/knife/role_env_run_list_replace_spec.rb
index 5a3365a686..93b233efdc 100644
--- a/spec/unit/knife/role_env_run_list_replace_spec.rb
+++ b/spec/unit/knife/role_env_run_list_replace_spec.rb
@@ -44,10 +44,10 @@ describe Chef::Knife::RoleEnvRunListReplace do
describe "run" do
-# it "should display all the things" do
-# @knife.run
-# @role.to_json.should == 'show all the things'
-# end
+ # it "should display all the things" do
+ # @knife.run
+ # @role.to_json.should == 'show all the things'
+ # end
it "should load the node" do
expect(Chef::Role).to receive(:load).with("will").and_return(@role)
diff --git a/spec/unit/knife/role_env_run_list_set_spec.rb b/spec/unit/knife/role_env_run_list_set_spec.rb
index 52ef1010b7..d35e4dbb17 100644
--- a/spec/unit/knife/role_env_run_list_set_spec.rb
+++ b/spec/unit/knife/role_env_run_list_set_spec.rb
@@ -44,10 +44,10 @@ describe Chef::Knife::RoleEnvRunListSet do
describe "run" do
-# it "should display all the things" do
-# @knife.run
-# @role.to_json.should == 'show all the things'
-# end
+ # it "should display all the things" do
+ # @knife.run
+ # @role.to_json.should == 'show all the things'
+ # end
it "should load the node" do
expect(Chef::Role).to receive(:load).with("will").and_return(@role)
diff --git a/spec/unit/knife/role_run_list_add_spec.rb b/spec/unit/knife/role_run_list_add_spec.rb
index 74235a019c..6f222ee80a 100644
--- a/spec/unit/knife/role_run_list_add_spec.rb
+++ b/spec/unit/knife/role_run_list_add_spec.rb
@@ -21,8 +21,8 @@ require "spec_helper"
describe Chef::Knife::RoleRunListAdd do
before(:each) do
-# Chef::Config[:role_name] = "websimian"
-# Chef::Config[:env_name] = "QA"
+ # Chef::Config[:role_name] = "websimian"
+ # Chef::Config[:env_name] = "QA"
@knife = Chef::Knife::RoleRunListAdd.new
@knife.config = {
after: nil,
@@ -36,10 +36,10 @@ describe Chef::Knife::RoleRunListAdd do
describe "run" do
-# it "should display all the things" do
-# @knife.run
-# @role.to_json.should == 'show all the things'
-# end
+ # it "should display all the things" do
+ # @knife.run
+ # @role.to_json.should == 'show all the things'
+ # end
it "should have a run list with the monkey role" do
@knife.run
diff --git a/spec/unit/knife/role_run_list_clear_spec.rb b/spec/unit/knife/role_run_list_clear_spec.rb
index 58730d42d5..327a9979b0 100644
--- a/spec/unit/knife/role_run_list_clear_spec.rb
+++ b/spec/unit/knife/role_run_list_clear_spec.rb
@@ -43,10 +43,10 @@ describe Chef::Knife::RoleRunListClear do
describe "run" do
-# it "should display all the things" do
-# @knife.run
-# @role.to_json.should == 'show all the things'
-# end
+ # it "should display all the things" do
+ # @knife.run
+ # @role.to_json.should == 'show all the things'
+ # end
it "should load the node" do
expect(Chef::Role).to receive(:load).with("will").and_return(@role)
diff --git a/spec/unit/knife/role_run_list_remove_spec.rb b/spec/unit/knife/role_run_list_remove_spec.rb
index e1786d7bb6..200a559c08 100644
--- a/spec/unit/knife/role_run_list_remove_spec.rb
+++ b/spec/unit/knife/role_run_list_remove_spec.rb
@@ -43,10 +43,10 @@ describe Chef::Knife::RoleRunListRemove do
describe "run" do
-# it "should display all the things" do
-# @knife.run
-# @role.to_json.should == 'show all the things'
-# end
+ # it "should display all the things" do
+ # @knife.run
+ # @role.to_json.should == 'show all the things'
+ # end
it "should load the node" do
expect(Chef::Role).to receive(:load).with("will").and_return(@role)
diff --git a/spec/unit/knife/role_run_list_replace_spec.rb b/spec/unit/knife/role_run_list_replace_spec.rb
index 6335f75a16..1957403fb1 100644
--- a/spec/unit/knife/role_run_list_replace_spec.rb
+++ b/spec/unit/knife/role_run_list_replace_spec.rb
@@ -43,10 +43,10 @@ describe Chef::Knife::RoleRunListReplace do
describe "run" do
-# it "should display all the things" do
-# @knife.run
-# @role.to_json.should == 'show all the things'
-# end
+ # it "should display all the things" do
+ # @knife.run
+ # @role.to_json.should == 'show all the things'
+ # end
it "should load the node" do
expect(Chef::Role).to receive(:load).with("will").and_return(@role)
diff --git a/spec/unit/knife/role_run_list_set_spec.rb b/spec/unit/knife/role_run_list_set_spec.rb
index 7733174870..06098c585e 100644
--- a/spec/unit/knife/role_run_list_set_spec.rb
+++ b/spec/unit/knife/role_run_list_set_spec.rb
@@ -43,10 +43,10 @@ describe Chef::Knife::RoleRunListSet do
describe "run" do
-# it "should display all the things" do
-# @knife.run
-# @role.to_json.should == 'show all the things'
-# end
+ # it "should display all the things" do
+ # @knife.run
+ # @role.to_json.should == 'show all the things'
+ # end
it "should load the node" do
expect(Chef::Role).to receive(:load).with("will").and_return(@role)
diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb
index 2f253358f1..078e6109dc 100644
--- a/spec/unit/provider/git_spec.rb
+++ b/spec/unit/provider/git_spec.rb
@@ -678,7 +678,7 @@ describe Chef::Provider::Git do
expect(@provider).to receive(:enable_submodules)
expect(@provider).to receive(:add_remotes)
@provider.run_action(:checkout)
- # @resource.should be_updated
+ # @resource.should be_updated
end
it "should not checkout if the destination exists or is a non empty directory" do
@@ -716,7 +716,7 @@ describe Chef::Provider::Git do
expect(@provider).to receive(:enable_submodules)
expect(@provider).to receive(:add_remotes)
@provider.run_action(:sync)
- # @resource.should be_updated
+ # @resource.should be_updated
end
it "does not fetch any updates if the remote revision matches the current revision" do
@@ -736,7 +736,7 @@ describe Chef::Provider::Git do
expect(@provider).to receive(:action_checkout)
expect(@provider).not_to receive(:shell_out!)
@provider.run_action(:sync)
- # @resource.should be_updated
+ # @resource.should be_updated
end
it "clones the repo instead of fetching updates if the deploy directory is empty" do
diff --git a/spec/unit/provider/osx_profile_spec.rb b/spec/unit/provider/osx_profile_spec.rb
index 017041bc60..9554f235f3 100644
--- a/spec/unit/provider/osx_profile_spec.rb
+++ b/spec/unit/provider/osx_profile_spec.rb
@@ -61,8 +61,8 @@ describe Chef::Provider::OsxProfile do
"ProfileVersion" => 1 }],
}
end
- # If anything is changed within this profile, be sure to update the
- # ProfileUUID in all_profiles to match the new config specific UUID
+ # If anything is changed within this profile, be sure to update the
+ # ProfileUUID in all_profiles to match the new config specific UUID
let(:test_profile) do
{
"PayloadIdentifier" => "com.testprofile.screensaver",
diff --git a/spec/unit/provider/package/msu_spec.rb b/spec/unit/provider/package/msu_spec.rb
index f71bd9a775..897ae254f0 100644
--- a/spec/unit/provider/package/msu_spec.rb
+++ b/spec/unit/provider/package/msu_spec.rb
@@ -261,9 +261,9 @@ describe Chef::Provider::Package::Msu, :windows_only do
expect(cab_files).to eql(["msu_dir/IE10-Windows6.1-KB2859903-x86.CAB"])
end
-# We couldn't find any msu file with multiple cab files in it.
-# So we are not 100% sure about the structure of XML file in this case
-# The specs below cover 2 possible XML formats
+ # We couldn't find any msu file with multiple cab files in it.
+ # So we are not 100% sure about the structure of XML file in this case
+ # The specs below cover 2 possible XML formats
context "handles different xml formats for multiple cab files in the msu package" do
it "parses xml file with multiple <package> tags" do
xml_file = File.join(CHEF_SPEC_DATA, "sample_msu2.xml")
diff --git a/spec/unit/provider/service/gentoo_service_spec.rb b/spec/unit/provider/service/gentoo_service_spec.rb
index f9da2a828c..99c01b595b 100644
--- a/spec/unit/provider/service/gentoo_service_spec.rb
+++ b/spec/unit/provider/service/gentoo_service_spec.rb
@@ -37,7 +37,7 @@ describe Chef::Provider::Service::Gentoo do
allow(File).to receive(:exists?).with("/etc/runlevels/default/chef").and_return(false)
allow(File).to receive(:readable?).with("/etc/runlevels/default/chef").and_return(false)
end
- # new test: found_enabled state
+ # new test: found_enabled state
#
describe "load_current_resource" do
it "should raise Chef::Exceptions::Service if /sbin/rc-update does not exist" do
diff --git a/spec/unit/provider_resolver_spec.rb b/spec/unit/provider_resolver_spec.rb
index bc58ce6ba5..dc8619a663 100644
--- a/spec/unit/provider_resolver_spec.rb
+++ b/spec/unit/provider_resolver_spec.rb
@@ -593,14 +593,14 @@ describe Chef::ProviderResolver do
"debian" => {
ifconfig: [ Chef::Resource::Ifconfig, Chef::Provider::Ifconfig::Debian ],
package: [ Chef::Resource::AptPackage, Chef::Provider::Package::Apt ],
- # service: [ Chef::Resource::DebianService, Chef::Provider::Service::Debian ],
+ # service: [ Chef::Resource::DebianService, Chef::Provider::Service::Debian ],
"debian" => {
"7.0" => {
},
"6.0" => {
ifconfig: [ Chef::Resource::Ifconfig, Chef::Provider::Ifconfig ],
- # service: [ Chef::Resource::InsservService, Chef::Provider::Service::Insserv ],
+ # service: [ Chef::Resource::InsservService, Chef::Provider::Service::Insserv ],
},
"5.0" => {
ifconfig: [ Chef::Resource::Ifconfig, Chef::Provider::Ifconfig ],
@@ -619,7 +619,7 @@ describe Chef::ProviderResolver do
"linuxmint" => {
"3.1.4" => {
ifconfig: [ Chef::Resource::Ifconfig, Chef::Provider::Ifconfig ],
- # service: [ Chef::Resource::UpstartService, Chef::Provider::Service::Upstart ],
+ # service: [ Chef::Resource::UpstartService, Chef::Provider::Service::Upstart ],
},
},
"raspbian" => {
@@ -667,7 +667,7 @@ describe Chef::ProviderResolver do
# TODO should be Chef::Resource::PortagePackage
package: [ Chef::Resource::Package, Chef::Provider::Package::Portage ],
portage_package: [ Chef::Resource::PortagePackage, Chef::Provider::Package::Portage ],
- # service: [ Chef::Resource::GentooService, Chef::Provider::Service::Gentoo ],
+ # service: [ Chef::Resource::GentooService, Chef::Provider::Service::Gentoo ],
"gentoo" => {
"3.1.4" => {
@@ -676,14 +676,14 @@ describe Chef::ProviderResolver do
},
"rhel" => {
- # service: [ Chef::Resource::SystemdService, Chef::Provider::Service::Systemd ],
+ # service: [ Chef::Resource::SystemdService, Chef::Provider::Service::Systemd ],
package: [ Chef::Resource::DnfPackage, Chef::Provider::Package::Dnf ],
ifconfig: [ Chef::Resource::Ifconfig, Chef::Provider::Ifconfig::Redhat ],
%w{amazon xcp xenserver ibm_powerkvm cloudlinux parallels} => {
"3.1.4" => {
package: [ Chef::Resource::YumPackage, Chef::Provider::Package::Yum ],
- # service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ],
+ # service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ],
},
},
%w{redhat centos scientific oracle} => {
@@ -692,14 +692,14 @@ describe Chef::ProviderResolver do
},
"6.0" => {
package: [ Chef::Resource::YumPackage, Chef::Provider::Package::Yum ],
- # service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ],
+ # service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ],
},
},
"fedora" => {
"15.0" => {
},
"14.0" => {
- # service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ],
+ # service: [ Chef::Resource::RedhatService, Chef::Provider::Service::Redhat ],
},
},
},
@@ -761,7 +761,7 @@ describe Chef::ProviderResolver do
package: [ Chef::Resource::Package, Chef::Provider::Package::Bff ],
rpm_package: [ Chef::Resource::RpmPackage, Chef::Provider::Package::Rpm ],
user: [ Chef::Resource::User::AixUser, Chef::Provider::User::Aix ],
- # service: [ Chef::Resource::AixService, Chef::Provider::Service::Aix ],
+ # service: [ Chef::Resource::AixService, Chef::Provider::Service::Aix ],
"aix" => {
"aix" => {
diff --git a/spec/unit/run_context_spec.rb b/spec/unit/run_context_spec.rb
index 6ccd5d0187..5bd7a360fb 100644
--- a/spec/unit/run_context_spec.rb
+++ b/spec/unit/run_context_spec.rb
@@ -138,7 +138,7 @@ describe Chef::RunContext do
expect(node).to receive(:loaded_recipe).with(:ancient, "aliens")
expect do
run_context.include_recipe("ancient::aliens")
- # In CHEF-5120, this becomes a Chef::Exceptions::MissingCookbookDependency error:
+ # In CHEF-5120, this becomes a Chef::Exceptions::MissingCookbookDependency error:
end.to raise_error(Chef::Exceptions::CookbookNotFound)
end