diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-05 15:00:00 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-02-05 15:00:00 -0800 |
commit | 686113531d23f30e9973d659c456ae33eb9cff1f (patch) | |
tree | f225de7251a8b49b8d183dd168bab0a0addbe23f /lib/chef/resource | |
parent | d1cf34b059a16a81e0fc48de52ba29863bb41fe6 (diff) | |
download | chef-686113531d23f30e9973d659c456ae33eb9cff1f.tar.gz |
autofixing whitespace cops
4174 Style/SpaceInsideHashLiteralBraces
1860 Style/SpaceAroundOperators
1336 Style/SpaceInsideBlockBraces
1292 Style/AlignHash
997 Style/SpaceAfterComma
860 Style/SpaceAroundEqualsInParameterDefault
310 Style/EmptyLines
294 Style/IndentationConsistency
267 Style/TrailingWhitespace
238 Style/ExtraSpacing
212 Style/SpaceBeforeBlockBraces
166 Style/MultilineOperationIndentation
144 Style/TrailingBlankLines
120 Style/EmptyLineBetweenDefs
101 Style/IndentationWidth
82 Style/SpaceAroundBlockParameters
40 Style/EmptyLinesAroundMethodBody
29 Style/EmptyLinesAroundAccessModifier
1 Style/RescueEnsureAlignment
Diffstat (limited to 'lib/chef/resource')
51 files changed, 306 insertions, 309 deletions
diff --git a/lib/chef/resource/action_class.rb b/lib/chef/resource/action_class.rb index 275680ee2d..3d9f2f3e7c 100644 --- a/lib/chef/resource/action_class.rb +++ b/lib/chef/resource/action_class.rb @@ -36,7 +36,7 @@ class Chef # We clear desired state in the copy, because it is supposed to be actual state. # We keep identity properties and non-desired-state, which are assumed to be # "control" values like `recurse: true` - current_resource.class.properties.each do |name,property| + current_resource.class.properties.each do |name, property| if property.desired_state? && !property.identity? && !property.name_property? property.reset(current_resource) end diff --git a/lib/chef/resource/bash.rb b/lib/chef/resource/bash.rb index 4abaf629cf..1238eedc42 100644 --- a/lib/chef/resource/bash.rb +++ b/lib/chef/resource/bash.rb @@ -23,7 +23,7 @@ class Chef class Resource class Bash < Chef::Resource::Script - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @interpreter = "bash" end diff --git a/lib/chef/resource/batch.rb b/lib/chef/resource/batch.rb index e6eed983f0..10e96839fb 100644 --- a/lib/chef/resource/batch.rb +++ b/lib/chef/resource/batch.rb @@ -24,7 +24,7 @@ class Chef provides :batch, os: "windows" - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super(name, run_context, nil, "cmd.exe") end diff --git a/lib/chef/resource/breakpoint.rb b/lib/chef/resource/breakpoint.rb index 040acc40a3..a5eed0da94 100644 --- a/lib/chef/resource/breakpoint.rb +++ b/lib/chef/resource/breakpoint.rb @@ -16,7 +16,6 @@ # limitations under the License. # - require "chef/resource" class Chef @@ -24,7 +23,7 @@ class Chef class Breakpoint < Chef::Resource default_action :break - def initialize(action="break", *args) + def initialize(action = "break", *args) super(caller.first, *args) end diff --git a/lib/chef/resource/chef_gem.rb b/lib/chef/resource/chef_gem.rb index d2f8f98aff..e08bacc625 100644 --- a/lib/chef/resource/chef_gem.rb +++ b/lib/chef/resource/chef_gem.rb @@ -25,7 +25,7 @@ class Chef resource_name :chef_gem property :gem_binary, default: "#{RbConfig::CONFIG['bindir']}/gem", - callbacks: { + 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" } } property :compile_time, [ true, false, nil ], default: lazy { Chef::Config[:chef_gem_compile_time] }, desired_state: false diff --git a/lib/chef/resource/chocolatey_package.rb b/lib/chef/resource/chocolatey_package.rb index 4b4a537e7f..805d3a3121 100644 --- a/lib/chef/resource/chocolatey_package.rb +++ b/lib/chef/resource/chocolatey_package.rb @@ -26,7 +26,7 @@ class Chef allowed_actions :install, :upgrade, :remove, :uninstall, :purge, :reconfig - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @resource_name = :chocolatey_package end diff --git a/lib/chef/resource/conditional.rb b/lib/chef/resource/conditional.rb index 12fd55d572..cdb9f13c45 100644 --- a/lib/chef/resource/conditional.rb +++ b/lib/chef/resource/conditional.rb @@ -30,11 +30,11 @@ class Chef private :new end - def self.not_if(parent_resource, command=nil, command_opts={}, &block) + def self.not_if(parent_resource, command = nil, command_opts = {}, &block) new(:not_if, parent_resource, command, command_opts, &block) end - def self.only_if(parent_resource, command=nil, command_opts={}, &block) + def self.only_if(parent_resource, command = nil, command_opts = {}, &block) new(:only_if, parent_resource, command, command_opts, &block) end @@ -43,7 +43,7 @@ class Chef attr_reader :command_opts attr_reader :block - def initialize(positivity, parent_resource, command=nil, command_opts={}, &block) + def initialize(positivity, parent_resource, command = nil, command_opts = {}, &block) @positivity = positivity @command, @command_opts = command, command_opts @block = block @@ -55,7 +55,7 @@ class Chef def configure case @command - when String,Array + when String, Array @guard_interpreter = Chef::GuardInterpreter.for_resource(@parent_resource, @command, @command_opts) @block = nil when nil diff --git a/lib/chef/resource/cookbook_file.rb b/lib/chef/resource/cookbook_file.rb index 6f1da0aa01..785cf693be 100644 --- a/lib/chef/resource/cookbook_file.rb +++ b/lib/chef/resource/cookbook_file.rb @@ -29,18 +29,18 @@ class Chef default_action :create - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @provider = Chef::Provider::CookbookFile @source = ::File.basename(name) @cookbook = nil end - def source(source_filename=nil) + def source(source_filename = nil) set_or_return(:source, source_filename, :kind_of => [ String, Array ]) end - def cookbook(cookbook_name=nil) + def cookbook(cookbook_name = nil) set_or_return(:cookbook, cookbook_name, :kind_of => String) end diff --git a/lib/chef/resource/cron.rb b/lib/chef/resource/cron.rb index e105cc94d8..26711fde16 100644 --- a/lib/chef/resource/cron.rb +++ b/lib/chef/resource/cron.rb @@ -30,7 +30,7 @@ class Chef default_action :create allowed_actions :create, :delete - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @minute = "*" @hour = "*" @@ -47,7 +47,7 @@ class Chef @environment = {} end - def minute(arg=nil) + def minute(arg = nil) if arg.is_a?(Integer) converted_arg = arg.to_s else @@ -64,7 +64,7 @@ class Chef ) end - def hour(arg=nil) + def hour(arg = nil) if arg.is_a?(Integer) converted_arg = arg.to_s else @@ -81,7 +81,7 @@ class Chef ) end - def day(arg=nil) + def day(arg = nil) if arg.is_a?(Integer) converted_arg = arg.to_s else @@ -98,7 +98,7 @@ class Chef ) end - def month(arg=nil) + def month(arg = nil) if arg.is_a?(Integer) converted_arg = arg.to_s else @@ -115,7 +115,7 @@ class Chef ) end - def weekday(arg=nil) + def weekday(arg = nil) if arg.is_a?(Integer) converted_arg = arg.to_s else @@ -123,11 +123,11 @@ class Chef end begin error_message = "You provided '#{arg}' as a weekday, acceptable values are " - error_message << Provider::Cron::WEEKDAY_SYMBOLS.map {|sym| ":#{sym}"}.join(", ") + error_message << Provider::Cron::WEEKDAY_SYMBOLS.map { |sym| ":#{sym}" }.join(", ") error_message << " and a string in crontab format" if (arg.is_a?(Symbol) && !Provider::Cron::WEEKDAY_SYMBOLS.include?(arg)) || - (!arg.is_a?(Symbol) && integerize(arg) > 7) || - (!arg.is_a?(Symbol) && integerize(arg) < 0) + (!arg.is_a?(Symbol) && integerize(arg) > 7) || + (!arg.is_a?(Symbol) && integerize(arg) < 0) raise RangeError, error_message end rescue ArgumentError @@ -139,7 +139,7 @@ class Chef ) end - def time(arg=nil) + def time(arg = nil) set_or_return( :time, arg, @@ -147,7 +147,7 @@ class Chef ) end - def mailto(arg=nil) + def mailto(arg = nil) set_or_return( :mailto, arg, @@ -155,7 +155,7 @@ class Chef ) end - def path(arg=nil) + def path(arg = nil) set_or_return( :path, arg, @@ -163,7 +163,7 @@ class Chef ) end - def home(arg=nil) + def home(arg = nil) set_or_return( :home, arg, @@ -171,7 +171,7 @@ class Chef ) end - def shell(arg=nil) + def shell(arg = nil) set_or_return( :shell, arg, @@ -179,7 +179,7 @@ class Chef ) end - def command(arg=nil) + def command(arg = nil) set_or_return( :command, arg, @@ -187,7 +187,7 @@ class Chef ) end - def user(arg=nil) + def user(arg = nil) set_or_return( :user, arg, @@ -195,7 +195,7 @@ class Chef ) end - def environment(arg=nil) + def environment(arg = nil) set_or_return( :environment, arg, diff --git a/lib/chef/resource/csh.rb b/lib/chef/resource/csh.rb index b4bae13399..4e7c22b660 100644 --- a/lib/chef/resource/csh.rb +++ b/lib/chef/resource/csh.rb @@ -23,7 +23,7 @@ class Chef class Resource class Csh < Chef::Resource::Script - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @interpreter = "csh" end diff --git a/lib/chef/resource/deploy.rb b/lib/chef/resource/deploy.rb index 797e2a664a..df301dd024 100644 --- a/lib/chef/resource/deploy.rb +++ b/lib/chef/resource/deploy.rb @@ -59,7 +59,7 @@ class Chef default_action :deploy allowed_actions :force_deploy, :deploy, :rollback - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @deploy_to = name @environment = nil @@ -67,8 +67,8 @@ class Chef @copy_exclude = [] @purge_before_symlink = %w{log tmp/pids public/system} @create_dirs_before_symlink = %w{tmp public config} - @symlink_before_migrate = {"config/database.yml" => "config/database.yml"} - @symlinks = {"system" => "public/system", "pids" => "tmp/pids", "log" => "log"} + @symlink_before_migrate = { "config/database.yml" => "config/database.yml" } + @symlinks = { "system" => "public/system", "pids" => "tmp/pids", "log" => "log" } @revision = "HEAD" @migrate = false @rollback_on_error = false @@ -99,7 +99,7 @@ class Chef @current_path ||= @deploy_to + "/current" end - def depth(arg=@shallow_clone ? 5 : nil) + def depth(arg = @shallow_clone ? 5 : nil) set_or_return( :depth, arg, @@ -108,7 +108,7 @@ class Chef end # note: deploy_to is your application "meta-root." - def deploy_to(arg=nil) + def deploy_to(arg = nil) set_or_return( :deploy_to, arg, @@ -116,7 +116,7 @@ class Chef ) end - def repo(arg=nil) + def repo(arg = nil) set_or_return( :repo, arg, @@ -125,7 +125,7 @@ class Chef end alias :repository :repo - def remote(arg=nil) + def remote(arg = nil) set_or_return( :remote, arg, @@ -133,7 +133,7 @@ class Chef ) end - def role(arg=nil) + def role(arg = nil) set_or_return( :role, arg, @@ -141,7 +141,7 @@ class Chef ) end - def restart_command(arg=nil, &block) + def restart_command(arg = nil, &block) arg ||= block set_or_return( :restart_command, @@ -151,7 +151,7 @@ class Chef end alias :restart :restart_command - def migrate(arg=nil) + def migrate(arg = nil) set_or_return( :migrate, arg, @@ -159,7 +159,7 @@ class Chef ) end - def migration_command(arg=nil) + def migration_command(arg = nil) set_or_return( :migration_command, arg, @@ -167,7 +167,7 @@ class Chef ) end - def rollback_on_error(arg=nil) + def rollback_on_error(arg = nil) set_or_return( :rollback_on_error, arg, @@ -175,7 +175,7 @@ class Chef ) end - def user(arg=nil) + def user(arg = nil) set_or_return( :user, arg, @@ -183,7 +183,7 @@ class Chef ) end - def group(arg=nil) + def group(arg = nil) set_or_return( :group, arg, @@ -191,7 +191,7 @@ class Chef ) end - def enable_submodules(arg=nil) + def enable_submodules(arg = nil) set_or_return( :enable_submodules, arg, @@ -199,7 +199,7 @@ class Chef ) end - def shallow_clone(arg=nil) + def shallow_clone(arg = nil) set_or_return( :shallow_clone, arg, @@ -207,7 +207,7 @@ class Chef ) end - def repository_cache(arg=nil) + def repository_cache(arg = nil) set_or_return( :repository_cache, arg, @@ -215,7 +215,7 @@ class Chef ) end - def copy_exclude(arg=nil) + def copy_exclude(arg = nil) set_or_return( :copy_exclude, arg, @@ -223,7 +223,7 @@ class Chef ) end - def revision(arg=nil) + def revision(arg = nil) set_or_return( :revision, arg, @@ -232,7 +232,7 @@ class Chef end alias :branch :revision - def git_ssh_wrapper(arg=nil) + def git_ssh_wrapper(arg = nil) set_or_return( :git_ssh_wrapper, arg, @@ -241,7 +241,7 @@ class Chef end alias :ssh_wrapper :git_ssh_wrapper - def svn_username(arg=nil) + def svn_username(arg = nil) set_or_return( :svn_username, arg, @@ -249,7 +249,7 @@ class Chef ) end - def svn_password(arg=nil) + def svn_password(arg = nil) set_or_return( :svn_password, arg, @@ -257,7 +257,7 @@ class Chef ) end - def svn_arguments(arg=nil) + def svn_arguments(arg = nil) set_or_return( :svn_arguments, arg, @@ -265,14 +265,14 @@ class Chef ) end - def svn_info_args(arg=nil) + def svn_info_args(arg = nil) set_or_return( :svn_arguments, arg, :kind_of => [ String ]) end - def scm_provider(arg=nil) + def scm_provider(arg = nil) klass = if arg.kind_of?(String) || arg.kind_of?(Symbol) lookup_provider_constant(arg) else @@ -291,7 +291,7 @@ class Chef Chef::Provider::Deploy end - def svn_force_export(arg=nil) + def svn_force_export(arg = nil) set_or_return( :svn_force_export, arg, @@ -299,11 +299,11 @@ class Chef ) end - def environment(arg=nil) + def environment(arg = nil) if arg.is_a?(String) Chef::Log.debug "Setting RAILS_ENV, RACK_ENV, and MERB_ENV to `#{arg}'" Chef::Log.warn "[DEPRECATED] please modify your deploy recipe or attributes to set the environment using a hash" - arg = {"RAILS_ENV"=>arg,"MERB_ENV"=>arg,"RACK_ENV"=>arg} + arg = { "RAILS_ENV" => arg, "MERB_ENV" => arg, "RACK_ENV" => arg } end set_or_return( :environment, @@ -313,7 +313,7 @@ class Chef end # The number of old release directories to keep around after cleanup - def keep_releases(arg=nil) + def keep_releases(arg = nil) [set_or_return( :keep_releases, arg, @@ -324,7 +324,7 @@ class Chef # SCM clone/checkout before symlinking. Use this to get rid of files and # directories you want to be shared between releases. # Default: ["log", "tmp/pids", "public/system"] - def purge_before_symlink(arg=nil) + def purge_before_symlink(arg = nil) set_or_return( :purge_before_symlink, arg, @@ -340,7 +340,7 @@ class Chef # then specify tmp here so that the tmp directory will exist when you # symlink the pids directory in to the current release. # Default: ["tmp", "public", "config"] - def create_dirs_before_symlink(arg=nil) + def create_dirs_before_symlink(arg = nil) set_or_return( :create_dirs_before_symlink, arg, @@ -354,7 +354,7 @@ class Chef # $shared/pids that you would like to symlink as $current_release/tmp/pids # you specify it as "pids" => "tmp/pids" # Default {"system" => "public/system", "pids" => "tmp/pids", "log" => "log"} - def symlinks(arg=nil) + def symlinks(arg = nil) set_or_return( :symlinks, arg, @@ -369,7 +369,7 @@ class Chef # For a rails/merb app, this is used to link in a known good database.yml # (with the production db password) before running migrate. # Default {"config/database.yml" => "config/database.yml"} - def symlink_before_migrate(arg=nil) + def symlink_before_migrate(arg = nil) set_or_return( :symlink_before_migrate, arg, @@ -378,30 +378,30 @@ class Chef end # Callback fires before migration is run. - def before_migrate(arg=nil, &block) + def before_migrate(arg = nil, &block) arg ||= block set_or_return(:before_migrate, arg, :kind_of => [Proc, String]) end # Callback fires before symlinking - def before_symlink(arg=nil, &block) + def before_symlink(arg = nil, &block) arg ||= block set_or_return(:before_symlink, arg, :kind_of => [Proc, String]) end # Callback fires before restart - def before_restart(arg=nil, &block) + def before_restart(arg = nil, &block) arg ||= block set_or_return(:before_restart, arg, :kind_of => [Proc, String]) end # Callback fires after restart - def after_restart(arg=nil, &block) + def after_restart(arg = nil, &block) arg ||= block set_or_return(:after_restart, arg, :kind_of => [Proc, String]) end - def additional_remotes(arg=nil) + def additional_remotes(arg = nil) set_or_return( :additional_remotes, arg, @@ -409,7 +409,7 @@ class Chef ) end - def enable_checkout(arg=nil) + def enable_checkout(arg = nil) set_or_return( :enable_checkout, arg, @@ -417,7 +417,7 @@ class Chef ) end - def checkout_branch(arg=nil) + def checkout_branch(arg = nil) set_or_return( :checkout_branch, arg, @@ -430,7 +430,7 @@ class Chef # timeout for SCM operations. The deploy resource must therefore support # a timeout method, but the timeout it describes is for SCM operations, # not the overall deployment. This is potentially confusing. - def timeout(arg=nil) + def timeout(arg = nil) set_or_return( :timeout, arg, diff --git a/lib/chef/resource/directory.rb b/lib/chef/resource/directory.rb index 1f0c4cdb51..07c29b48a6 100644 --- a/lib/chef/resource/directory.rb +++ b/lib/chef/resource/directory.rb @@ -35,13 +35,13 @@ class Chef default_action :create allowed_actions :create, :delete - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @path = name @recursive = false end - def recursive(arg=nil) + def recursive(arg = nil) set_or_return( :recursive, arg, @@ -49,7 +49,7 @@ class Chef ) end - def path(arg=nil) + def path(arg = nil) set_or_return( :path, arg, diff --git a/lib/chef/resource/dsc_resource.rb b/lib/chef/resource/dsc_resource.rb index d1777e77d9..4a55ce1d70 100644 --- a/lib/chef/resource/dsc_resource.rb +++ b/lib/chef/resource/dsc_resource.rb @@ -52,7 +52,7 @@ class Chef @reboot_action = :nothing end - def resource(value=nil) + def resource(value = nil) if value @resource = value else @@ -60,7 +60,7 @@ class Chef end end - def module_name(value=nil) + def module_name(value = nil) if value @module_name = value else @@ -68,7 +68,7 @@ class Chef end end - def property(property_name, value=nil) + def property(property_name, value = nil) if not property_name.is_a?(Symbol) raise TypeError, "A property name of type Symbol must be specified, '#{property_name}' of type #{property_name.class} was given" end @@ -91,7 +91,7 @@ class Chef # If the set method of the DSC resource indicate that a reboot # is necessary, reboot_action provides the mechanism for a reboot to # be requested. - def reboot_action(value=nil) + def reboot_action(value = nil) if value @reboot_action = value else @@ -99,13 +99,14 @@ class Chef end end - def timeout(arg=nil) + def timeout(arg = nil) set_or_return( :timeout, arg, :kind_of => [ Integer ], ) end + private def value_of(value) diff --git a/lib/chef/resource/dsc_script.rb b/lib/chef/resource/dsc_script.rb index 633a98c456..a8eeeb1d4f 100644 --- a/lib/chef/resource/dsc_script.rb +++ b/lib/chef/resource/dsc_script.rb @@ -28,12 +28,12 @@ class Chef default_action :run - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @imports = {} end - def code(arg=nil) + def code(arg = nil) if arg && command raise ArgumentError, "Only one of 'code' and 'command' attributes may be specified" end @@ -47,7 +47,7 @@ class Chef ) end - def configuration_name(arg=nil) + def configuration_name(arg = nil) if arg && code raise ArgumentError, "Attribute `configuration_name` may not be set if `code` is set" end @@ -58,7 +58,7 @@ class Chef ) end - def command(arg=nil) + def command(arg = nil) if arg && code raise ArgumentError, "The 'code' and 'command' attributes may not be used together" end @@ -69,7 +69,7 @@ class Chef ) end - def configuration_data(arg=nil) + def configuration_data(arg = nil) if arg && configuration_data_script raise ArgumentError, "The 'configuration_data' and 'configuration_data_script' attributes may not be used together" end @@ -80,7 +80,7 @@ class Chef ) end - def configuration_data_script(arg=nil) + def configuration_data_script(arg = nil) if arg && configuration_data raise ArgumentError, "The 'configuration_data' and 'configuration_data_script' attributes may not be used together" end @@ -91,7 +91,7 @@ class Chef ) end - def imports(module_name=nil, *args) + def imports(module_name = nil, *args) if module_name @imports[module_name] ||= [] if args.length == 0 @@ -104,7 +104,7 @@ class Chef end end - def flags(arg=nil) + def flags(arg = nil) set_or_return( :flags, arg, @@ -112,7 +112,7 @@ class Chef ) end - def cwd(arg=nil) + def cwd(arg = nil) set_or_return( :cwd, arg, @@ -120,7 +120,7 @@ class Chef ) end - def environment(arg=nil) + def environment(arg = nil) set_or_return( :environment, arg, @@ -128,7 +128,7 @@ class Chef ) end - def timeout(arg=nil) + def timeout(arg = nil) set_or_return( :timeout, arg, diff --git a/lib/chef/resource/env.rb b/lib/chef/resource/env.rb index a6caa3299a..a483b69ee5 100644 --- a/lib/chef/resource/env.rb +++ b/lib/chef/resource/env.rb @@ -30,14 +30,14 @@ class Chef default_action :create allowed_actions :create, :delete, :modify - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @key_name = name @value = nil @delim = nil end - def key_name(arg=nil) + def key_name(arg = nil) set_or_return( :key_name, arg, @@ -45,7 +45,7 @@ class Chef ) end - def value(arg=nil) + def value(arg = nil) set_or_return( :value, arg, @@ -53,7 +53,7 @@ class Chef ) end - def delim(arg=nil) + def delim(arg = nil) set_or_return( :delim, arg, diff --git a/lib/chef/resource/erl_call.rb b/lib/chef/resource/erl_call.rb index 607bcc0fae..5b5273d31d 100644 --- a/lib/chef/resource/erl_call.rb +++ b/lib/chef/resource/erl_call.rb @@ -30,7 +30,7 @@ class Chef default_action :run - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @code = "q()." # your erlang code goes here @@ -40,7 +40,7 @@ class Chef @node_name = "chef@localhost" # the erlang node hostname end - def code(arg=nil) + def code(arg = nil) set_or_return( :code, arg, @@ -48,7 +48,7 @@ class Chef ) end - def cookie(arg=nil) + def cookie(arg = nil) set_or_return( :cookie, arg, @@ -56,7 +56,7 @@ class Chef ) end - def distributed(arg=nil) + def distributed(arg = nil) set_or_return( :distributed, arg, @@ -64,7 +64,7 @@ class Chef ) end - def name_type(arg=nil) + def name_type(arg = nil) set_or_return( :name_type, arg, @@ -72,7 +72,7 @@ class Chef ) end - def node_name(arg=nil) + def node_name(arg = nil) set_or_return( :node_name, arg, diff --git a/lib/chef/resource/execute.rb b/lib/chef/resource/execute.rb index 167720f09f..b30cc245bd 100644 --- a/lib/chef/resource/execute.rb +++ b/lib/chef/resource/execute.rb @@ -34,7 +34,7 @@ class Chef default_action :run - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @command = name @backup = 5 @@ -52,7 +52,7 @@ class Chef @live_stream = false end - def umask(arg=nil) + def umask(arg = nil) set_or_return( :umask, arg, @@ -60,7 +60,7 @@ class Chef ) end - def command(arg=nil) + def command(arg = nil) set_or_return( :command, arg, @@ -68,7 +68,7 @@ class Chef ) end - def creates(arg=nil) + def creates(arg = nil) set_or_return( :creates, arg, @@ -76,7 +76,7 @@ class Chef ) end - def cwd(arg=nil) + def cwd(arg = nil) set_or_return( :cwd, arg, @@ -84,7 +84,7 @@ class Chef ) end - def environment(arg=nil) + def environment(arg = nil) set_or_return( :environment, arg, @@ -94,7 +94,7 @@ class Chef alias :env :environment - def group(arg=nil) + def group(arg = nil) set_or_return( :group, arg, @@ -102,14 +102,14 @@ class Chef ) end - def live_stream(arg=nil) + def live_stream(arg = nil) set_or_return( :live_stream, arg, :kind_of => [ TrueClass, FalseClass ]) end - def path(arg=nil) + def path(arg = nil) Chef::Log.warn "The 'path' attribute of 'execute' is not used by any provider in Chef 11 or Chef 12. Use 'environment' attribute to configure 'PATH'. This attribute will be removed in Chef 13." set_or_return( @@ -119,7 +119,7 @@ class Chef ) end - def returns(arg=nil) + def returns(arg = nil) set_or_return( :returns, arg, @@ -127,7 +127,7 @@ class Chef ) end - def timeout(arg=nil) + def timeout(arg = nil) set_or_return( :timeout, arg, @@ -135,7 +135,7 @@ class Chef ) end - def user(arg=nil) + def user(arg = nil) set_or_return( :user, arg, diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb index f2606f72f0..ac6dc5fbdb 100644 --- a/lib/chef/resource/file.rb +++ b/lib/chef/resource/file.rb @@ -58,7 +58,7 @@ class Chef property :manage_symlink_source, [ true, false ], desired_state: false property :verifications, Array, default: lazy { [] } - def verify(command=nil, opts={}, &block) + def verify(command = nil, opts = {}, &block) if ! (command.nil? || [String, Symbol].include?(command.class)) raise ArgumentError, "verify requires either a string, symbol, or a block" end diff --git a/lib/chef/resource/file/verification.rb b/lib/chef/resource/file/verification.rb index 1c00797668..e11035d33f 100644 --- a/lib/chef/resource/file/verification.rb +++ b/lib/chef/resource/file/verification.rb @@ -73,7 +73,7 @@ class Chef end def self.lookup(name) - c = descendants.find {|d| d.provides?(name) } + c = descendants.find { |d| d.provides?(name) } if c.nil? raise Chef::Exceptions::VerificationNotFound.new "No file verification for #{name} found." end @@ -86,7 +86,7 @@ class Chef @parent_resource = parent_resource end - def verify(path, opts={}) + def verify(path, opts = {}) Chef::Log.debug("Running verification[#{self}] on #{path}") if @block verify_block(path, opts) @@ -112,7 +112,7 @@ class Chef "%{file} is deprecated in verify command and will not be "\ "supported in Chef 13. Please use %{path} instead." ) if @command.include?("%{file}") - command = @command % {:file => path, :path => path} + command = @command % { :file => path, :path => path } interpreter = Chef::GuardInterpreter.for_resource(@parent_resource, command, @command_opts) interpreter.evaluate end diff --git a/lib/chef/resource/git.rb b/lib/chef/resource/git.rb index 44d4c9b684..0d3b1438bf 100644 --- a/lib/chef/resource/git.rb +++ b/lib/chef/resource/git.rb @@ -22,12 +22,12 @@ class Chef class Resource class Git < Chef::Resource::Scm - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @additional_remotes = Hash[] end - def additional_remotes(arg=nil) + def additional_remotes(arg = nil) set_or_return( :additional_remotes, arg, diff --git a/lib/chef/resource/group.rb b/lib/chef/resource/group.rb index 6a53e0de22..50a70b9e5f 100644 --- a/lib/chef/resource/group.rb +++ b/lib/chef/resource/group.rb @@ -28,7 +28,7 @@ class Chef allowed_actions :create, :remove, :modify, :manage default_action :create - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @group_name = name @gid = nil @@ -38,7 +38,7 @@ class Chef @non_unique = false end - def group_name(arg=nil) + def group_name(arg = nil) set_or_return( :group_name, arg, @@ -46,7 +46,7 @@ class Chef ) end - def gid(arg=nil) + def gid(arg = nil) set_or_return( :gid, arg, @@ -54,7 +54,7 @@ class Chef ) end - def members(arg=nil) + def members(arg = nil) converted_members = arg.is_a?(String) ? [].push(arg) : arg set_or_return( :members, @@ -65,7 +65,7 @@ class Chef alias_method :users, :members - def excluded_members(arg=nil) + def excluded_members(arg = nil) converted_members = arg.is_a?(String) ? [].push(arg) : arg set_or_return( :excluded_members, @@ -74,8 +74,7 @@ class Chef ) end - - def append(arg=nil) + def append(arg = nil) set_or_return( :append, arg, @@ -83,7 +82,7 @@ class Chef ) end - def system(arg=nil) + def system(arg = nil) set_or_return( :system, arg, @@ -91,7 +90,7 @@ class Chef ) end - def non_unique(arg=nil) + def non_unique(arg = nil) set_or_return( :non_unique, arg, diff --git a/lib/chef/resource/http_request.rb b/lib/chef/resource/http_request.rb index a8299a9064..be69e2f1df 100644 --- a/lib/chef/resource/http_request.rb +++ b/lib/chef/resource/http_request.rb @@ -29,14 +29,14 @@ class Chef default_action :get allowed_actions :get, :put, :post, :delete, :head, :options - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @message = name @url = nil @headers = {} end - def url(args=nil) + def url(args = nil) set_or_return( :url, args, @@ -44,7 +44,7 @@ class Chef ) end - def message(args=nil, &block) + def message(args = nil, &block) args = block if block_given? set_or_return( :message, @@ -53,7 +53,7 @@ class Chef ) end - def headers(args=nil) + def headers(args = nil) set_or_return( :headers, args, diff --git a/lib/chef/resource/ifconfig.rb b/lib/chef/resource/ifconfig.rb index c751595380..94362b1c73 100644 --- a/lib/chef/resource/ifconfig.rb +++ b/lib/chef/resource/ifconfig.rb @@ -30,7 +30,7 @@ class Chef default_action :add allowed_actions :add, :delete, :enable, :disable - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @target = name @hwaddr = nil @@ -46,7 +46,7 @@ class Chef @onparent = nil end - def target(arg=nil) + def target(arg = nil) set_or_return( :target, arg, @@ -54,7 +54,7 @@ class Chef ) end - def device(arg=nil) + def device(arg = nil) set_or_return( :device, arg, @@ -62,7 +62,7 @@ class Chef ) end - def hwaddr(arg=nil) + def hwaddr(arg = nil) set_or_return( :hwaddr, arg, @@ -70,7 +70,7 @@ class Chef ) end - def inet_addr(arg=nil) + def inet_addr(arg = nil) set_or_return( :inet_addr, arg, @@ -78,7 +78,7 @@ class Chef ) end - def bcast(arg=nil) + def bcast(arg = nil) set_or_return( :bcast, arg, @@ -86,7 +86,7 @@ class Chef ) end - def mask(arg=nil) + def mask(arg = nil) set_or_return( :mask, arg, @@ -94,7 +94,7 @@ class Chef ) end - def mtu(arg=nil) + def mtu(arg = nil) set_or_return( :mtu, arg, @@ -102,7 +102,7 @@ class Chef ) end - def metric(arg=nil) + def metric(arg = nil) set_or_return( :metric, arg, @@ -110,7 +110,7 @@ class Chef ) end - def onboot(arg=nil) + def onboot(arg = nil) set_or_return( :onboot, arg, @@ -118,7 +118,7 @@ class Chef ) end - def network(arg=nil) + def network(arg = nil) set_or_return( :network, arg, @@ -126,7 +126,7 @@ class Chef ) end - def bootproto(arg=nil) + def bootproto(arg = nil) set_or_return( :bootproto, arg, @@ -134,7 +134,7 @@ class Chef ) end - def onparent(arg=nil) + def onparent(arg = nil) set_or_return( :onparent, arg, diff --git a/lib/chef/resource/ksh.rb b/lib/chef/resource/ksh.rb index 3e54b5e836..3097156329 100644 --- a/lib/chef/resource/ksh.rb +++ b/lib/chef/resource/ksh.rb @@ -22,7 +22,7 @@ class Chef class Resource class Ksh < Chef::Resource::Script - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @interpreter = "ksh" end diff --git a/lib/chef/resource/link.rb b/lib/chef/resource/link.rb index c2d5aa102c..a85e9eb058 100644 --- a/lib/chef/resource/link.rb +++ b/lib/chef/resource/link.rb @@ -32,7 +32,7 @@ class Chef default_action :create allowed_actions :create, :delete - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) verify_links_supported! super @to = nil @@ -40,7 +40,7 @@ class Chef @target_file = name end - def to(arg=nil) + def to(arg = nil) set_or_return( :to, arg, @@ -48,7 +48,7 @@ class Chef ) end - def target_file(arg=nil) + def target_file(arg = nil) set_or_return( :target_file, arg, @@ -56,7 +56,7 @@ class Chef ) end - def link_type(arg=nil) + def link_type(arg = nil) real_arg = arg.kind_of?(String) ? arg.to_sym : arg set_or_return( :link_type, @@ -65,7 +65,7 @@ class Chef ) end - def group(arg=nil) + def group(arg = nil) set_or_return( :group, arg, @@ -73,7 +73,7 @@ class Chef ) end - def owner(arg=nil) + def owner(arg = nil) set_or_return( :owner, arg, @@ -87,6 +87,7 @@ class Chef end private + def verify_links_supported! # On certain versions of windows links are not supported. Make # sure we are not on such a platform. diff --git a/lib/chef/resource/log.rb b/lib/chef/resource/log.rb index 49f821b3f2..a9b288a210 100644 --- a/lib/chef/resource/log.rb +++ b/lib/chef/resource/log.rb @@ -48,13 +48,13 @@ class Chef # name<String>:: Message to log # collection<Array>:: Collection of included recipes # node<Chef::Node>:: Node where resource will be used - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @level = :info @message = name end - def message(arg=nil) + def message(arg = nil) set_or_return( :message, arg, @@ -63,7 +63,7 @@ class Chef end # <Symbol> Log level, one of :debug, :info, :warn, :error or :fatal - def level(arg=nil) + def level(arg = nil) set_or_return( :level, arg, diff --git a/lib/chef/resource/macosx_service.rb b/lib/chef/resource/macosx_service.rb index ad51287253..c2d05e5991 100644 --- a/lib/chef/resource/macosx_service.rb +++ b/lib/chef/resource/macosx_service.rb @@ -29,7 +29,7 @@ class Chef state_attrs :enabled, :running - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @plist = nil @session_type = nil @@ -37,7 +37,7 @@ class Chef # This will enable user to pass a plist in the case # that the filename and label for the service dont match - def plist(arg=nil) + def plist(arg = nil) set_or_return( :plist, arg, @@ -45,7 +45,7 @@ class Chef ) end - def session_type(arg=nil) + def session_type(arg = nil) set_or_return( :session_type, arg, diff --git a/lib/chef/resource/mdadm.rb b/lib/chef/resource/mdadm.rb index 235cd86210..efdd448101 100644 --- a/lib/chef/resource/mdadm.rb +++ b/lib/chef/resource/mdadm.rb @@ -30,7 +30,7 @@ class Chef default_action :create allowed_actions :create, :assemble, :stop - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @chunk = 16 @@ -42,7 +42,7 @@ class Chef @raid_device = name end - def chunk(arg=nil) + def chunk(arg = nil) set_or_return( :chunk, arg, @@ -50,7 +50,7 @@ class Chef ) end - def devices(arg=nil) + def devices(arg = nil) set_or_return( :devices, arg, @@ -58,7 +58,7 @@ class Chef ) end - def exists(arg=nil) + def exists(arg = nil) set_or_return( :exists, arg, @@ -66,7 +66,7 @@ class Chef ) end - def level(arg=nil) + def level(arg = nil) set_or_return( :level, arg, @@ -74,7 +74,7 @@ class Chef ) end - def metadata(arg=nil) + def metadata(arg = nil) set_or_return( :metadata, arg, @@ -82,7 +82,7 @@ class Chef ) end - def bitmap(arg=nil) + def bitmap(arg = nil) set_or_return( :bitmap, arg, @@ -90,7 +90,7 @@ class Chef ) end - def raid_device(arg=nil) + def raid_device(arg = nil) set_or_return( :raid_device, arg, @@ -98,7 +98,6 @@ class Chef ) end - end end end diff --git a/lib/chef/resource/mount.rb b/lib/chef/resource/mount.rb index 9d0c0291f8..7bbff57f50 100644 --- a/lib/chef/resource/mount.rb +++ b/lib/chef/resource/mount.rb @@ -30,7 +30,7 @@ class Chef default_action :mount allowed_actions :mount, :umount, :remount, :enable, :disable - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @mount_point = name @device = nil @@ -48,7 +48,7 @@ class Chef @domain = nil end - def mount_point(arg=nil) + def mount_point(arg = nil) set_or_return( :mount_point, arg, @@ -56,7 +56,7 @@ class Chef ) end - def device(arg=nil) + def device(arg = nil) set_or_return( :device, arg, @@ -64,7 +64,7 @@ class Chef ) end - def device_type(arg=nil) + def device_type(arg = nil) real_arg = arg.kind_of?(String) ? arg.to_sym : arg valid_devices = if RUBY_PLATFORM =~ /solaris/i [ :device ] @@ -78,7 +78,7 @@ class Chef ) end - def fsck_device(arg=nil) + def fsck_device(arg = nil) set_or_return( :fsck_device, arg, @@ -86,7 +86,7 @@ class Chef ) end - def fstype(arg=nil) + def fstype(arg = nil) set_or_return( :fstype, arg, @@ -94,7 +94,7 @@ class Chef ) end - def options(arg=nil) + def options(arg = nil) ret = set_or_return( :options, arg, @@ -108,7 +108,7 @@ class Chef end end - def dump(arg=nil) + def dump(arg = nil) set_or_return( :dump, arg, @@ -116,7 +116,7 @@ class Chef ) end - def pass(arg=nil) + def pass(arg = nil) set_or_return( :pass, arg, @@ -124,7 +124,7 @@ class Chef ) end - def mounted(arg=nil) + def mounted(arg = nil) set_or_return( :mounted, arg, @@ -132,7 +132,7 @@ class Chef ) end - def enabled(arg=nil) + def enabled(arg = nil) set_or_return( :enabled, arg, @@ -140,7 +140,7 @@ class Chef ) end - def supports(args={}) + def supports(args = {}) if args.is_a? Array args.each { |arg| @supports[arg] = true } elsif args.any? @@ -150,7 +150,7 @@ class Chef end end - def username(arg=nil) + def username(arg = nil) set_or_return( :username, arg, @@ -158,7 +158,7 @@ class Chef ) end - def password(arg=nil) + def password(arg = nil) set_or_return( :password, arg, @@ -166,7 +166,7 @@ class Chef ) end - def domain(arg=nil) + def domain(arg = nil) set_or_return( :domain, arg, diff --git a/lib/chef/resource/ohai.rb b/lib/chef/resource/ohai.rb index b36cf32880..5211e2f3bc 100644 --- a/lib/chef/resource/ohai.rb +++ b/lib/chef/resource/ohai.rb @@ -27,13 +27,13 @@ class Chef default_action :reload - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @name = name @plugin = nil end - def plugin(arg=nil) + def plugin(arg = nil) set_or_return( :plugin, arg, @@ -41,7 +41,7 @@ class Chef ) end - def name(arg=nil) + def name(arg = nil) set_or_return( :name, arg, diff --git a/lib/chef/resource/osx_profile.rb b/lib/chef/resource/osx_profile.rb index aa01fa2ac0..920d09a83a 100644 --- a/lib/chef/resource/osx_profile.rb +++ b/lib/chef/resource/osx_profile.rb @@ -29,7 +29,7 @@ class Chef default_action :install allowed_actions :install, :remove - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @profile_name = name @profile = nil @@ -37,7 +37,7 @@ class Chef @path = nil end - def profile_name(arg=nil) + def profile_name(arg = nil) set_or_return( :profile_name, arg, @@ -45,7 +45,7 @@ class Chef ) end - def profile(arg=nil) + def profile(arg = nil) set_or_return( :profile, arg, @@ -53,7 +53,7 @@ class Chef ) end - def identifier(arg=nil) + def identifier(arg = nil) set_or_return( :identifier, arg, @@ -61,7 +61,7 @@ class Chef ) end - def path(arg=nil) + def path(arg = nil) set_or_return( :path, arg, diff --git a/lib/chef/resource/perl.rb b/lib/chef/resource/perl.rb index 783751aca4..60af0e92da 100644 --- a/lib/chef/resource/perl.rb +++ b/lib/chef/resource/perl.rb @@ -22,7 +22,7 @@ require "chef/provider/script" class Chef class Resource class Perl < Chef::Resource::Script - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @interpreter = "perl" end diff --git a/lib/chef/resource/portage_package.rb b/lib/chef/resource/portage_package.rb index 9814ccda56..ad66c7b42b 100644 --- a/lib/chef/resource/portage_package.rb +++ b/lib/chef/resource/portage_package.rb @@ -22,7 +22,7 @@ class Chef class Resource class PortagePackage < Chef::Resource::Package resource_name :portage_package - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @provider = Chef::Provider::Package::Portage end diff --git a/lib/chef/resource/powershell_script.rb b/lib/chef/resource/powershell_script.rb index 891438eb01..e66db9fa55 100644 --- a/lib/chef/resource/powershell_script.rb +++ b/lib/chef/resource/powershell_script.rb @@ -22,12 +22,12 @@ class Chef class PowershellScript < Chef::Resource::WindowsScript provides :powershell_script, os: "windows" - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super(name, run_context, nil, "powershell.exe") @convert_boolean_return = false end - def convert_boolean_return(arg=nil) + def convert_boolean_return(arg = nil) set_or_return( :convert_boolean_return, arg, @@ -43,7 +43,7 @@ class Chef # guard context and recipe resource context will have the # same behavior. def self.get_default_attributes(opts) - {:convert_boolean_return => true} + { :convert_boolean_return => true } end end end diff --git a/lib/chef/resource/python.rb b/lib/chef/resource/python.rb index d2a7a4fc14..bcad3d090b 100644 --- a/lib/chef/resource/python.rb +++ b/lib/chef/resource/python.rb @@ -21,7 +21,7 @@ require "chef/provider/script" class Chef class Resource class Python < Chef::Resource::Script - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @interpreter = "python" end diff --git a/lib/chef/resource/reboot.rb b/lib/chef/resource/reboot.rb index 2941294ff8..24d6e74157 100644 --- a/lib/chef/resource/reboot.rb +++ b/lib/chef/resource/reboot.rb @@ -26,7 +26,7 @@ class Chef class Reboot < Chef::Resource allowed_actions :request_reboot, :reboot_now, :cancel - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @provider = Chef::Provider::Reboot @@ -36,11 +36,11 @@ class Chef # no default action. end - def reason(arg=nil) + def reason(arg = nil) set_or_return(:reason, arg, :kind_of => String) end - def delay_mins(arg=nil) + def delay_mins(arg = nil) set_or_return(:delay_mins, arg, :kind_of => Fixnum) end end diff --git a/lib/chef/resource/registry_key.rb b/lib/chef/resource/registry_key.rb index eaa9a00de5..135e63d959 100644 --- a/lib/chef/resource/registry_key.rb +++ b/lib/chef/resource/registry_key.rb @@ -59,7 +59,7 @@ class Chef # See lib/chef/resource_reporter.rb for more information. attr_reader :unscrubbed_values - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @architecture = :machine @recursive = false @@ -67,7 +67,7 @@ class Chef @values, @unscrubbed_values = [], [] end - def key(arg=nil) + def key(arg = nil) set_or_return( :key, arg, @@ -75,7 +75,7 @@ class Chef ) end - def values(arg=nil) + def values(arg = nil) if not arg.nil? if arg.is_a?(Hash) @values = [ arg ] @@ -90,7 +90,7 @@ class Chef raise ArgumentError, "Missing type key in RegistryKey values hash" unless v.has_key?(:type) raise ArgumentError, "Missing data key in RegistryKey values hash" unless v.has_key?(:data) v.each_key do |key| - raise ArgumentError, "Bad key #{key} in RegistryKey values hash" unless [:name,:type,:data].include?(key) + raise ArgumentError, "Bad key #{key} in RegistryKey values hash" unless [:name, :type, :data].include?(key) end raise ArgumentError, "Type of name => #{v[:name]} should be string" unless v[:name].is_a?(String) raise ArgumentError, "Type of type => #{v[:type]} should be symbol" unless v[:type].is_a?(Symbol) @@ -101,7 +101,7 @@ class Chef end end - def recursive(arg=nil) + def recursive(arg = nil) set_or_return( :recursive, arg, @@ -109,7 +109,7 @@ class Chef ) end - def architecture(arg=nil) + def architecture(arg = nil) set_or_return( :architecture, arg, diff --git a/lib/chef/resource/remote_directory.rb b/lib/chef/resource/remote_directory.rb index b7fbcaf3b3..600ee5138e 100644 --- a/lib/chef/resource/remote_directory.rb +++ b/lib/chef/resource/remote_directory.rb @@ -33,7 +33,7 @@ class Chef default_action :create allowed_actions :create, :create_if_missing, :delete - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @path = name @source = ::File.basename(name) @@ -53,8 +53,7 @@ class Chef rights_attribute(:files_rights) end - - def source(args=nil) + def source(args = nil) set_or_return( :source, args, @@ -62,7 +61,7 @@ class Chef ) end - def files_backup(arg=nil) + def files_backup(arg = nil) set_or_return( :files_backup, arg, @@ -70,7 +69,7 @@ class Chef ) end - def purge(arg=nil) + def purge(arg = nil) set_or_return( :purge, arg, @@ -78,7 +77,7 @@ class Chef ) end - def files_group(arg=nil) + def files_group(arg = nil) set_or_return( :files_group, arg, @@ -86,7 +85,7 @@ class Chef ) end - def files_mode(arg=nil) + def files_mode(arg = nil) set_or_return( :files_mode, arg, @@ -94,7 +93,7 @@ class Chef ) end - def files_owner(arg=nil) + def files_owner(arg = nil) set_or_return( :files_owner, arg, @@ -102,7 +101,7 @@ class Chef ) end - def overwrite(arg=nil) + def overwrite(arg = nil) set_or_return( :overwrite, arg, @@ -110,7 +109,7 @@ class Chef ) end - def cookbook(args=nil) + def cookbook(args = nil) set_or_return( :cookbook, args, diff --git a/lib/chef/resource/remote_file.rb b/lib/chef/resource/remote_file.rb index 5fce1ee89a..36f1c614d1 100644 --- a/lib/chef/resource/remote_file.rb +++ b/lib/chef/resource/remote_file.rb @@ -28,7 +28,7 @@ class Chef class RemoteFile < Chef::Resource::File include Chef::Mixin::Securable - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @source = [] @use_etag = true @@ -52,7 +52,7 @@ class Chef arg, { :callbacks => { :validate_source => method(:validate_source) - }}) + } }) if ret.is_a? String Array(ret) else @@ -65,14 +65,14 @@ class Chef nil elsif args[0].is_a?(Chef::DelayedEvaluator) && args.count == 1 args[0] - elsif args.any? {|a| a.is_a?(Chef::DelayedEvaluator)} && args.count > 1 + elsif args.any? { |a| a.is_a?(Chef::DelayedEvaluator) } && args.count > 1 raise Exceptions::InvalidRemoteFileURI, "Only 1 source argument allowed when using a lazy evaluator" else Array(args).flatten end end - def checksum(args=nil) + def checksum(args = nil) set_or_return( :checksum, args, @@ -88,7 +88,7 @@ class Chef use_last_modified(true_or_false) end - def use_etag(args=nil) + def use_etag(args = nil) set_or_return( :use_etag, args, @@ -98,7 +98,7 @@ class Chef alias :use_etags :use_etag - def use_last_modified(args=nil) + def use_last_modified(args = nil) set_or_return( :use_last_modified, args, @@ -106,7 +106,7 @@ class Chef ) end - def ftp_active_mode(args=nil) + def ftp_active_mode(args = nil) set_or_return( :ftp_active_mode, args, @@ -114,7 +114,7 @@ class Chef ) end - def headers(args=nil) + def headers(args = nil) set_or_return( :headers, args, diff --git a/lib/chef/resource/route.rb b/lib/chef/resource/route.rb index b817ed33e0..bbfbada674 100644 --- a/lib/chef/resource/route.rb +++ b/lib/chef/resource/route.rb @@ -29,7 +29,7 @@ class Chef default_action :add allowed_actions :add, :delete - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @target = name @netmask = nil @@ -44,7 +44,7 @@ class Chef @domain = nil end - def networking(arg=nil) + def networking(arg = nil) set_or_return( :networking, arg, @@ -52,7 +52,7 @@ class Chef ) end - def networking_ipv6(arg=nil) + def networking_ipv6(arg = nil) set_or_return( :networking_ipv6, arg, @@ -60,7 +60,7 @@ class Chef ) end - def hostname(arg=nil) + def hostname(arg = nil) set_or_return( :hostname, arg, @@ -68,7 +68,7 @@ class Chef ) end - def domainname(arg=nil) + def domainname(arg = nil) set_or_return( :domainname, arg, @@ -76,7 +76,7 @@ class Chef ) end - def domain(arg=nil) + def domain(arg = nil) set_or_return( :domain, arg, @@ -84,7 +84,7 @@ class Chef ) end - def target(arg=nil) + def target(arg = nil) set_or_return( :target, arg, @@ -92,7 +92,7 @@ class Chef ) end - def netmask(arg=nil) + def netmask(arg = nil) set_or_return( :netmask, arg, @@ -100,7 +100,7 @@ class Chef ) end - def gateway(arg=nil) + def gateway(arg = nil) set_or_return( :gateway, arg, @@ -108,7 +108,7 @@ class Chef ) end - def metric(arg=nil) + def metric(arg = nil) set_or_return( :metric, arg, @@ -116,7 +116,7 @@ class Chef ) end - def device(arg=nil) + def device(arg = nil) set_or_return( :device, arg, @@ -124,7 +124,7 @@ class Chef ) end - def route_type(arg=nil) + def route_type(arg = nil) real_arg = arg.kind_of?(String) ? arg.to_sym : arg set_or_return( :route_type, diff --git a/lib/chef/resource/ruby.rb b/lib/chef/resource/ruby.rb index 0a7bec90a2..91805a1db6 100644 --- a/lib/chef/resource/ruby.rb +++ b/lib/chef/resource/ruby.rb @@ -22,7 +22,7 @@ require "chef/provider/script" class Chef class Resource class Ruby < Chef::Resource::Script - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @interpreter = "ruby" end diff --git a/lib/chef/resource/ruby_block.rb b/lib/chef/resource/ruby_block.rb index 48f297e6ec..7bb433b330 100644 --- a/lib/chef/resource/ruby_block.rb +++ b/lib/chef/resource/ruby_block.rb @@ -28,7 +28,7 @@ class Chef identity_attr :block_name - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @block_name = name end @@ -41,7 +41,7 @@ class Chef end end - def block_name(arg=nil) + def block_name(arg = nil) set_or_return( :block_name, arg, diff --git a/lib/chef/resource/scm.rb b/lib/chef/resource/scm.rb index 9f5c66378b..4ba31cd31b 100644 --- a/lib/chef/resource/scm.rb +++ b/lib/chef/resource/scm.rb @@ -16,7 +16,6 @@ # limitations under the License. # - require "chef/resource" class Chef @@ -29,7 +28,7 @@ class Chef default_action :sync allowed_actions :checkout, :export, :sync, :diff, :log - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @destination = name @enable_submodules = false @@ -42,7 +41,7 @@ class Chef @environment = nil end - def destination(arg=nil) + def destination(arg = nil) set_or_return( :destination, arg, @@ -50,7 +49,7 @@ class Chef ) end - def repository(arg=nil) + def repository(arg = nil) set_or_return( :repository, arg, @@ -58,7 +57,7 @@ class Chef ) end - def revision(arg=nil) + def revision(arg = nil) set_or_return( :revision, arg, @@ -66,7 +65,7 @@ class Chef ) end - def user(arg=nil) + def user(arg = nil) set_or_return( :user, arg, @@ -74,7 +73,7 @@ class Chef ) end - def group(arg=nil) + def group(arg = nil) set_or_return( :group, arg, @@ -82,7 +81,7 @@ class Chef ) end - def svn_username(arg=nil) + def svn_username(arg = nil) set_or_return( :svn_username, arg, @@ -90,7 +89,7 @@ class Chef ) end - def svn_password(arg=nil) + def svn_password(arg = nil) set_or_return( :svn_password, arg, @@ -98,7 +97,7 @@ class Chef ) end - def svn_arguments(arg=nil) + def svn_arguments(arg = nil) @svn_arguments, arg = nil, nil if arg == false set_or_return( :svn_arguments, @@ -107,7 +106,7 @@ class Chef ) end - def svn_info_args(arg=nil) + def svn_info_args(arg = nil) @svn_info_args, arg = nil, nil if arg == false set_or_return( :svn_info_args, @@ -116,7 +115,7 @@ class Chef end # Capistrano and git-deploy use ``shallow clone'' - def depth(arg=nil) + def depth(arg = nil) set_or_return( :depth, arg, @@ -124,7 +123,7 @@ class Chef ) end - def enable_submodules(arg=nil) + def enable_submodules(arg = nil) set_or_return( :enable_submodules, arg, @@ -132,7 +131,7 @@ class Chef ) end - def enable_checkout(arg=nil) + def enable_checkout(arg = nil) set_or_return( :enable_checkout, arg, @@ -140,7 +139,7 @@ class Chef ) end - def remote(arg=nil) + def remote(arg = nil) set_or_return( :remote, arg, @@ -148,7 +147,7 @@ class Chef ) end - def ssh_wrapper(arg=nil) + def ssh_wrapper(arg = nil) set_or_return( :ssh_wrapper, arg, @@ -156,7 +155,7 @@ class Chef ) end - def timeout(arg=nil) + def timeout(arg = nil) set_or_return( :timeout, arg, @@ -164,7 +163,7 @@ class Chef ) end - def checkout_branch(arg=nil) + def checkout_branch(arg = nil) set_or_return( :checkout_branch, arg, @@ -172,7 +171,7 @@ class Chef ) end - def environment(arg=nil) + def environment(arg = nil) set_or_return( :environment, arg, diff --git a/lib/chef/resource/script.rb b/lib/chef/resource/script.rb index c7748a7eb8..d80effbf67 100644 --- a/lib/chef/resource/script.rb +++ b/lib/chef/resource/script.rb @@ -26,7 +26,7 @@ class Chef # Chef-13: go back to using :name as the identity attr identity_attr :command - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super # Chef-13: the command variable should be initialized to nil @command = name @@ -36,7 +36,7 @@ class Chef @default_guard_interpreter = :default end - def command(arg=nil) + def command(arg = nil) unless arg.nil? # Chef-13: change this to raise if the user is trying to set a value here Chef::Log.warn "Specifying command attribute on a script resource is a coding error, use the 'code' attribute, or the execute resource" @@ -45,7 +45,7 @@ class Chef super end - def code(arg=nil) + def code(arg = nil) set_or_return( :code, arg, @@ -53,7 +53,7 @@ class Chef ) end - def interpreter(arg=nil) + def interpreter(arg = nil) set_or_return( :interpreter, arg, @@ -61,7 +61,7 @@ class Chef ) end - def flags(arg=nil) + def flags(arg = nil) set_or_return( :flags, arg, diff --git a/lib/chef/resource/service.rb b/lib/chef/resource/service.rb index 504fdac104..5288e1b2be 100644 --- a/lib/chef/resource/service.rb +++ b/lib/chef/resource/service.rb @@ -29,7 +29,7 @@ class Chef default_action :nothing allowed_actions :enable, :disable, :start, :stop, :restart, :reload - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @service_name = name @enabled = nil @@ -48,7 +48,7 @@ class Chef @supports = { :restart => nil, :reload => nil, :status => nil } end - def service_name(arg=nil) + def service_name(arg = nil) set_or_return( :service_name, arg, @@ -57,7 +57,7 @@ class Chef end # regex for match against ps -ef when !supports[:has_status] && status == nil - def pattern(arg=nil) + def pattern(arg = nil) set_or_return( :pattern, arg, @@ -66,7 +66,7 @@ class Chef end # command to call to start service - def start_command(arg=nil) + def start_command(arg = nil) set_or_return( :start_command, arg, @@ -75,7 +75,7 @@ class Chef end # command to call to stop service - def stop_command(arg=nil) + def stop_command(arg = nil) set_or_return( :stop_command, arg, @@ -84,7 +84,7 @@ class Chef end # command to call to get status of service - def status_command(arg=nil) + def status_command(arg = nil) set_or_return( :status_command, arg, @@ -93,7 +93,7 @@ class Chef end # command to call to restart service - def restart_command(arg=nil) + def restart_command(arg = nil) set_or_return( :restart_command, arg, @@ -101,7 +101,7 @@ class Chef ) end - def reload_command(arg=nil) + def reload_command(arg = nil) set_or_return( :reload_command, arg, @@ -114,7 +114,7 @@ class Chef # non-standard configurations setting this value will save having to # specify overrides for the start_command, stop_command and # restart_command attributes. - def init_command(arg=nil) + def init_command(arg = nil) set_or_return( :init_command, arg, @@ -123,7 +123,7 @@ class Chef end # if the service is enabled or not - def enabled(arg=nil) + def enabled(arg = nil) set_or_return( :enabled, arg, @@ -132,7 +132,7 @@ class Chef end # if the service is running or not - def running(arg=nil) + def running(arg = nil) set_or_return( :running, arg, @@ -150,7 +150,7 @@ class Chef # runlevel 2, stopped in 3 with priority 55 and no symlinks or # similar for other runlevels # - def priority(arg=nil) + def priority(arg = nil) set_or_return( :priority, arg, @@ -159,7 +159,7 @@ class Chef end # timeout only applies to the windows service manager - def timeout(arg=nil) + def timeout(arg = nil) set_or_return( :timeout, arg, @@ -167,7 +167,7 @@ class Chef ) end - def parameters(arg=nil) + def parameters(arg = nil) set_or_return( :parameters, arg, @@ -175,14 +175,14 @@ class Chef ) end - def run_levels(arg=nil) + def run_levels(arg = nil) set_or_return( :run_levels, arg, :kind_of => [ Array ] ) end - def supports(args={}) + def supports(args = {}) if args.is_a? Array args.each { |arg| @supports[arg] = true } elsif args.any? diff --git a/lib/chef/resource/subversion.rb b/lib/chef/resource/subversion.rb index c391fdfd0f..9966614eeb 100644 --- a/lib/chef/resource/subversion.rb +++ b/lib/chef/resource/subversion.rb @@ -24,7 +24,7 @@ class Chef class Subversion < Chef::Resource::Scm allowed_actions :force_export - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @svn_arguments = "--no-auth-cache" @svn_info_args = "--no-auth-cache" @@ -36,7 +36,7 @@ class Chef "#{self} (#{defined_at}) had an error: #{e.class.name}: #{svn_password ? e.message.gsub(svn_password, "[hidden_password]") : e.message}" end - def svn_binary(arg=nil) + def svn_binary(arg = nil) set_or_return(:svn_binary, arg, :kind_of => [String]) end end diff --git a/lib/chef/resource/template.rb b/lib/chef/resource/template.rb index 9a1a69120d..1570af2812 100644 --- a/lib/chef/resource/template.rb +++ b/lib/chef/resource/template.rb @@ -30,7 +30,7 @@ class Chef attr_reader :inline_helper_blocks attr_reader :inline_helper_modules - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @source = "#{::File.basename(name)}.erb" @cookbook = nil @@ -41,7 +41,7 @@ class Chef @helper_modules = [] end - def source(file=nil) + def source(file = nil) set_or_return( :source, file, @@ -49,7 +49,7 @@ class Chef ) end - def variables(args=nil) + def variables(args = nil) set_or_return( :variables, args, @@ -57,7 +57,7 @@ class Chef ) end - def cookbook(args=nil) + def cookbook(args = nil) set_or_return( :cookbook, args, @@ -65,7 +65,7 @@ class Chef ) end - def local(args=nil) + def local(args = nil) set_or_return( :local, args, @@ -160,7 +160,7 @@ class Chef # And in the template resource: # helpers(MyTemplateHelper) # The template code in the above example will work unmodified. - def helpers(module_name=nil,&block) + def helpers(module_name = nil, &block) if block_given? and !module_name.nil? raise Exceptions::ValidationFailed, "Passing both a module and block to #helpers is not supported. Call #helpers multiple times instead" @@ -171,8 +171,8 @@ class Chef elsif module_name.nil? raise Exceptions::ValidationFailed, "#helpers requires either a module name or inline module code as a block.\n" + - "e.g.: helpers do; helper_code; end;\n" + - "OR: helpers(MyHelpersModule)" + "e.g.: helpers do; helper_code; end;\n" + + "OR: helpers(MyHelpersModule)" else raise Exceptions::ValidationFailed, "Argument to #helpers must be a module. You gave #{module_name.inspect} (#{module_name.class})" diff --git a/lib/chef/resource/user.rb b/lib/chef/resource/user.rb index 4f11975d50..5aa94ae49e 100644 --- a/lib/chef/resource/user.rb +++ b/lib/chef/resource/user.rb @@ -28,7 +28,7 @@ class Chef default_action :create allowed_actions :create, :remove, :modify, :manage, :lock, :unlock - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @username = name @comment = nil @@ -49,7 +49,7 @@ class Chef @salt = nil end - def username(arg=nil) + def username(arg = nil) set_or_return( :username, arg, @@ -57,7 +57,7 @@ class Chef ) end - def comment(arg=nil) + def comment(arg = nil) set_or_return( :comment, arg, @@ -65,7 +65,7 @@ class Chef ) end - def uid(arg=nil) + def uid(arg = nil) set_or_return( :uid, arg, @@ -73,7 +73,7 @@ class Chef ) end - def gid(arg=nil) + def gid(arg = nil) set_or_return( :gid, arg, @@ -83,7 +83,7 @@ class Chef alias_method :group, :gid - def home(arg=nil) + def home(arg = nil) set_or_return( :home, arg, @@ -91,7 +91,7 @@ class Chef ) end - def shell(arg=nil) + def shell(arg = nil) set_or_return( :shell, arg, @@ -99,7 +99,7 @@ class Chef ) end - def password(arg=nil) + def password(arg = nil) set_or_return( :password, arg, @@ -107,7 +107,7 @@ class Chef ) end - def salt(arg=nil) + def salt(arg = nil) set_or_return( :salt, arg, @@ -115,7 +115,7 @@ class Chef ) end - def iterations(arg=nil) + def iterations(arg = nil) set_or_return( :iterations, arg, @@ -123,7 +123,7 @@ class Chef ) end - def system(arg=nil) + def system(arg = nil) set_or_return( :system, arg, @@ -131,7 +131,7 @@ class Chef ) end - def manage_home(arg=nil) + def manage_home(arg = nil) set_or_return( :manage_home, arg, @@ -139,7 +139,7 @@ class Chef ) end - def force(arg=nil) + def force(arg = nil) set_or_return( :force, arg, @@ -147,7 +147,7 @@ class Chef ) end - def non_unique(arg=nil) + def non_unique(arg = nil) set_or_return( :non_unique, arg, diff --git a/lib/chef/resource/windows_package.rb b/lib/chef/resource/windows_package.rb index c718708e79..0e8dd39672 100644 --- a/lib/chef/resource/windows_package.rb +++ b/lib/chef/resource/windows_package.rb @@ -32,7 +32,7 @@ class Chef allowed_actions :install, :remove - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @source ||= source(@package_name) if @package_name.downcase.end_with?(".msi") end diff --git a/lib/chef/resource/windows_script.rb b/lib/chef/resource/windows_script.rb index 13905fc4ba..44f1d8d652 100644 --- a/lib/chef/resource/windows_script.rb +++ b/lib/chef/resource/windows_script.rb @@ -40,7 +40,7 @@ class Chef public - def architecture(arg=nil) + def architecture(arg = nil) assert_architecture_compatible!(arg) if ! arg.nil? result = set_or_return( :architecture, diff --git a/lib/chef/resource/windows_service.rb b/lib/chef/resource/windows_service.rb index ab49abc2c3..635edbb389 100644 --- a/lib/chef/resource/windows_service.rb +++ b/lib/chef/resource/windows_service.rb @@ -34,14 +34,14 @@ class Chef state_attrs :enabled, :running - def initialize(name, run_context=nil) + def initialize(name, run_context = nil) super @startup_type = :automatic @run_as_user = "" @run_as_password = "" end - def startup_type(arg=nil) + def startup_type(arg = nil) # Set-Service arguments are automatic and manual # Win32::Service returns 'auto start' or 'demand start' respectively, which the provider currently uses set_or_return( @@ -51,7 +51,7 @@ class Chef ) end - def run_as_user(arg=nil) + def run_as_user(arg = nil) set_or_return( :run_as_user, arg, @@ -59,7 +59,7 @@ class Chef ) end - def run_as_password(arg=nil) + def run_as_password(arg = nil) set_or_return( :run_as_password, arg, |