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/application | |
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/application')
-rw-r--r-- | lib/chef/application/apply.rb | 7 | ||||
-rw-r--r-- | lib/chef/application/client.rb | 15 | ||||
-rw-r--r-- | lib/chef/application/knife.rb | 6 | ||||
-rw-r--r-- | lib/chef/application/solo.rb | 11 | ||||
-rw-r--r-- | lib/chef/application/windows_service.rb | 16 | ||||
-rw-r--r-- | lib/chef/application/windows_service_manager.rb | 4 |
6 files changed, 29 insertions, 30 deletions
diff --git a/lib/chef/application/apply.rb b/lib/chef/application/apply.rb index 04dc1dae34..38b00f293c 100644 --- a/lib/chef/application/apply.rb +++ b/lib/chef/application/apply.rb @@ -82,13 +82,12 @@ class Chef::Application::Apply < Chef::Application :show_options => true, :exit => 0 - option :version, :short => "-v", :long => "--version", :description => "Show chef version", :boolean => true, - :proc => lambda {|v| puts "Chef: #{::Chef::VERSION}"}, + :proc => lambda { |v| puts "Chef: #{::Chef::VERSION}" }, :exit => 0 option :why_run, @@ -187,9 +186,9 @@ class Chef::Application::Apply < Chef::Application Chef::Application.exit! "No recipe file provided", 1 end @recipe_filename = ARGV[0] - @recipe_text,@recipe_fh = read_recipe_file @recipe_filename + @recipe_text, @recipe_fh = read_recipe_file @recipe_filename end - recipe,run_context = get_recipe_and_run_context + recipe, run_context = get_recipe_and_run_context recipe.instance_eval(@recipe_text, @recipe_filename, 1) runner = Chef::Runner.new(run_context) begin diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb index ea091276d1..a3cac2782a 100644 --- a/lib/chef/application/client.rb +++ b/lib/chef/application/client.rb @@ -181,7 +181,7 @@ class Chef::Application::Client < Chef::Application :long => "--version", :description => "Show chef version", :boolean => true, - :proc => lambda {|v| puts "Chef: #{::Chef::VERSION}"}, + :proc => lambda { |v| puts "Chef: #{::Chef::VERSION}" }, :exit => 0 option :override_runlist, @@ -402,6 +402,7 @@ class Chef::Application::Client < Chef::Application end private + def interval_run_chef_client if Chef::Config[:daemonize] Chef::Daemon.daemonize("chef-client") @@ -461,16 +462,16 @@ class Chef::Application::Client < Chef::Application def unforked_interval_error_message "Unforked chef-client interval runs are disabled in Chef 12." + - "\nConfiguration settings:" + - "#{"\n interval = #{Chef::Config[:interval]} seconds" if Chef::Config[:interval]}" + - "\nEnable chef-client interval runs by setting `:client_fork = true` in your config file or adding `--fork` to your command line options." + "\nConfiguration settings:" + + "#{"\n interval = #{Chef::Config[:interval]} seconds" if Chef::Config[:interval]}" + + "\nEnable chef-client interval runs by setting `:client_fork = true` in your config file or adding `--fork` to your command line options." end def audit_mode_settings_explanation "\n* To enable audit mode after converge, use command line option `--audit-mode enabled` or set `audit_mode :enabled` in your config file." + - "\n* To disable audit mode, use command line option `--audit-mode disabled` or set `audit_mode :disabled` in your config file." + - "\n* To only run audit mode, use command line option `--audit-mode audit-only` or set `audit_mode :audit_only` in your config file." + - "\nAudit mode is disabled by default." + "\n* To disable audit mode, use command line option `--audit-mode disabled` or set `audit_mode :disabled` in your config file." + + "\n* To only run audit mode, use command line option `--audit-mode audit-only` or set `audit_mode :audit_only` in your config file." + + "\nAudit mode is disabled by default." end def unrecognized_audit_mode(mode) diff --git a/lib/chef/application/knife.rb b/lib/chef/application/knife.rb index bb1e1f7918..849a011ab3 100644 --- a/lib/chef/application/knife.rb +++ b/lib/chef/application/knife.rb @@ -38,7 +38,7 @@ class Chef::Application::Knife < Chef::Application :short => "-V", :long => "--verbose", :description => "More verbose output. Use twice for max verbosity", - :proc => Proc.new { verbosity_level += 1}, + :proc => Proc.new { verbosity_level += 1 }, :default => 0 option :color, @@ -131,7 +131,7 @@ class Chef::Application::Knife < Chef::Application :long => "--version", :description => "Show chef version", :boolean => true, - :proc => lambda {|v| puts "Chef: #{::Chef::VERSION}"}, + :proc => lambda { |v| puts "Chef: #{::Chef::VERSION}" }, :exit => 0 option :fips, @@ -191,7 +191,7 @@ class Chef::Application::Knife < Chef::Application ARGV[0] =~ /^(--version|-v)$/ end - def print_help_and_exit(exitcode=1, fatal_message=nil) + def print_help_and_exit(exitcode = 1, fatal_message = nil) Chef::Log.error(fatal_message) if fatal_message begin diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb index 54d31a5faa..dbf843125e 100644 --- a/lib/chef/application/solo.rb +++ b/lib/chef/application/solo.rb @@ -145,7 +145,7 @@ class Chef::Application::Solo < Chef::Application :long => "--version", :description => "Show chef version", :boolean => true, - :proc => lambda {|v| puts "Chef: #{::Chef::VERSION}"}, + :proc => lambda { |v| puts "Chef: #{::Chef::VERSION}" }, :exit => 0 option :override_runlist, @@ -211,7 +211,7 @@ class Chef::Application::Solo < Chef::Application Chef::Application.fatal!(unforked_interval_error_message) if !Chef::Config[:client_fork] && Chef::Config[:interval] if Chef::Config[:recipe_url] - cookbooks_path = Array(Chef::Config[:cookbook_path]).detect{|e| e =~ /\/cookbooks\/*$/ } + cookbooks_path = Array(Chef::Config[:cookbook_path]).detect { |e| e =~ /\/cookbooks\/*$/ } recipes_path = File.expand_path(File.join(cookbooks_path, "..")) Chef::Log.debug "Cleanup path #{recipes_path} before extract recipes into it" @@ -254,7 +254,6 @@ class Chef::Application::Solo < Chef::Application end end - private def for_ezra @@ -312,8 +311,8 @@ EOH def unforked_interval_error_message "Unforked chef-client interval runs are disabled in Chef 12." + - "\nConfiguration settings:" + - "#{"\n interval = #{Chef::Config[:interval]} seconds" if Chef::Config[:interval]}" + - "\nEnable chef-client interval runs by setting `:client_fork = true` in your config file or adding `--fork` to your command line options." + "\nConfiguration settings:" + + "#{"\n interval = #{Chef::Config[:interval]} seconds" if Chef::Config[:interval]}" + + "\nEnable chef-client interval runs by setting `:client_fork = true` in your config file or adding `--fork` to your command line options." end end diff --git a/lib/chef/application/windows_service.rb b/lib/chef/application/windows_service.rb index 0032114136..b955dd31b8 100644 --- a/lib/chef/application/windows_service.rb +++ b/lib/chef/application/windows_service.rb @@ -187,12 +187,12 @@ class Chef Chef::Log.info "Starting chef-client in a new process" # Pass config params to the new process config_params = " --no-fork" - config_params += " -c #{Chef::Config[:config_file]}" unless Chef::Config[:config_file].nil? + config_params += " -c #{Chef::Config[:config_file]}" unless Chef::Config[:config_file].nil? # log_location might be an event logger and if so we cannot pass as a command argument # but shed no tears! If the logger is an event logger, it must have been configured # as such in the config file and chef-client will use that when no arg is passed here config_params += " -L #{resolve_log_location}" if resolve_log_location.is_a?(String) - + # Starts a new process and waits till the process exits result = shell_out( @@ -204,8 +204,8 @@ class Chef Chef::Log.debug "#{result.stderr}" rescue Mixlib::ShellOut::CommandTimeout => e Chef::Log.error "chef-client timed out\n(#{e})" - Chef::Log.error(<<-EOF) - Your chef-client run timed out. You can increase the time chef-client is given + Chef::Log.error(<<-EOF) + Your chef-client run timed out. You can increase the time chef-client is given to complete by configuring windows_service.watchdog_timeout in your client.rb. EOF rescue Mixlib::ShellOut::ShellCommandFailed => e @@ -225,12 +225,12 @@ class Chef # Lifted from Chef::Application, with addition of optional startup parameters # for playing nicely with Windows Services - def reconfigure(startup_parameters=[]) + def reconfigure(startup_parameters = []) configure_chef startup_parameters configure_logging Chef::Config[:chef_server_url] = config[:chef_server_url] if config.has_key? :chef_server_url - unless Chef::Config[:exception_handlers].any? {|h| Chef::Handler::ErrorReport === h} + unless Chef::Config[:exception_handlers].any? { |h| Chef::Handler::ErrorReport === h } Chef::Config[:exception_handlers] << Chef::Handler::ErrorReport.new end @@ -251,7 +251,7 @@ class Chef def configure_stdout_logger stdout_logger = MonoLogger.new(STDOUT) stdout_logger.formatter = Chef::Log.logger.formatter - Chef::Log.loggers << stdout_logger + Chef::Log.loggers << stdout_logger end # Based on config and whether or not STDOUT is a tty, should we setup a @@ -334,5 +334,5 @@ end # To run this file as a service, it must be called as a script from within # the Windows Service framework. In that case, kick off the main loop! if __FILE__ == $0 - Chef::Application::WindowsService.mainloop + Chef::Application::WindowsService.mainloop end diff --git a/lib/chef/application/windows_service_manager.rb b/lib/chef/application/windows_service_manager.rb index 7a89766cb4..74ee395139 100644 --- a/lib/chef/application/windows_service_manager.rb +++ b/lib/chef/application/windows_service_manager.rb @@ -67,7 +67,7 @@ class Chef :long => "--version", :description => "Show chef version", :boolean => true, - :proc => lambda {|v| puts "Chef: #{::Chef::VERSION}"}, + :proc => lambda { |v| puts "Chef: #{::Chef::VERSION}" }, :exit => 0 def initialize(service_options) @@ -169,7 +169,7 @@ class Chef return ::Win32::Service.exists?(@service_name) end - def take_action(action=nil, desired_state=nil) + def take_action(action = nil, desired_state = nil) if service_exists? if current_state != desired_state ::Win32::Service.send(action, @service_name) |