diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-11-15 15:03:32 -0800 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-12-06 13:08:26 -0800 |
commit | db85ca494a484024404f1090c493613cc9521662 (patch) | |
tree | cc655fce7e3bfaa450a697889f2e8f2e5c80d38d /lib/chef | |
parent | d218f942628da9a7302f1cc166abec0ea4fdeba2 (diff) | |
download | chef-db85ca494a484024404f1090c493613cc9521662.tar.gz |
fix Style/MultilineIfModifier
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef')
-rw-r--r-- | lib/chef/application.rb | 7 | ||||
-rw-r--r-- | lib/chef/application/windows_service_manager.rb | 10 | ||||
-rw-r--r-- | lib/chef/data_collector.rb | 12 | ||||
-rw-r--r-- | lib/chef/data_collector/messages.rb | 14 | ||||
-rw-r--r-- | lib/chef/provider/osx_profile.rb | 6 | ||||
-rw-r--r-- | lib/chef/resource/file/verification.rb | 10 |
6 files changed, 36 insertions, 23 deletions
diff --git a/lib/chef/application.rb b/lib/chef/application.rb index e917a4eaf7..cdea2544a3 100644 --- a/lib/chef/application.rb +++ b/lib/chef/application.rb @@ -120,9 +120,10 @@ class Chef end def set_specific_recipes - Chef::Config[:specific_recipes] = - cli_arguments.map { |file| File.expand_path(file) } if - cli_arguments.respond_to?(:map) + if cli_arguments.respond_to?(:map) + Chef::Config[:specific_recipes] = + cli_arguments.map { |file| File.expand_path(file) } + end end # Initialize and configure the logger. diff --git a/lib/chef/application/windows_service_manager.rb b/lib/chef/application/windows_service_manager.rb index 6f81dccc67..fd0ce0b174 100644 --- a/lib/chef/application/windows_service_manager.rb +++ b/lib/chef/application/windows_service_manager.rb @@ -126,10 +126,12 @@ class Chef :password => @password, :dependencies => @dependencies ) - ::Win32::Service.configure( - :service_name => @service_name, - :delayed_start => @delayed_start - ) unless @delayed_start.nil? + unless @delayed_start.nil? + ::Win32::Service.configure( + :service_name => @service_name, + :delayed_start => @delayed_start + ) + end puts "Service '#{@service_name}' has successfully been installed." end when "status" diff --git a/lib/chef/data_collector.rb b/lib/chef/data_collector.rb index 0e676145eb..df3bce6167 100644 --- a/lib/chef/data_collector.rb +++ b/lib/chef/data_collector.rb @@ -462,8 +462,10 @@ class Chef end def validate_data_collector_server_url! - raise Chef::Exceptions::ConfigurationError, - "Chef::Config[:data_collector][:server_url] is empty. Please supply a valid URL." if data_collector_server_url.empty? + if data_collector_server_url.empty? + raise Chef::Exceptions::ConfigurationError, + "Chef::Config[:data_collector][:server_url] is empty. Please supply a valid URL." + end begin uri = URI(data_collector_server_url) @@ -471,8 +473,10 @@ class Chef raise Chef::Exceptions::ConfigurationError, "Chef::Config[:data_collector][:server_url] (#{data_collector_server_url}) is not a valid URI." end - raise Chef::Exceptions::ConfigurationError, - "Chef::Config[:data_collector][:server_url] (#{data_collector_server_url}) is a URI with no host. Please supply a valid URL." if uri.host.nil? + if uri.host.nil? + raise Chef::Exceptions::ConfigurationError, + "Chef::Config[:data_collector][:server_url] (#{data_collector_server_url}) is a URI with no host. Please supply a valid URL." + end end end end diff --git a/lib/chef/data_collector/messages.rb b/lib/chef/data_collector/messages.rb index f63242f85e..c0683534a9 100644 --- a/lib/chef/data_collector/messages.rb +++ b/lib/chef/data_collector/messages.rb @@ -82,12 +82,14 @@ class Chef "deprecations" => reporter_data[:deprecations], } - message["error"] = { - "class" => run_status.exception.class, - "message" => run_status.exception.message, - "backtrace" => run_status.exception.backtrace, - "description" => reporter_data[:error_descriptions], - } if run_status.exception + if run_status.exception + message["error"] = { + "class" => run_status.exception.class, + "message" => run_status.exception.message, + "backtrace" => run_status.exception.backtrace, + "description" => reporter_data[:error_descriptions], + } + end message end diff --git a/lib/chef/provider/osx_profile.rb b/lib/chef/provider/osx_profile.rb index 69ecf2ddb9..a25ac9539f 100644 --- a/lib/chef/provider/osx_profile.rb +++ b/lib/chef/provider/osx_profile.rb @@ -44,8 +44,10 @@ class Chef ) @new_profile_hash = get_profile_hash(@new_resource.profile) - @new_profile_hash["PayloadUUID"] = - config_uuid(@new_profile_hash) if @new_profile_hash + if @new_profile_hash + @new_profile_hash["PayloadUUID"] = + config_uuid(@new_profile_hash) + end if @new_profile_hash @new_profile_identifier = @new_profile_hash["PayloadIdentifier"] diff --git a/lib/chef/resource/file/verification.rb b/lib/chef/resource/file/verification.rb index cf5585e5cf..3400684bc5 100644 --- a/lib/chef/resource/file/verification.rb +++ b/lib/chef/resource/file/verification.rb @@ -108,10 +108,12 @@ class Chef def verify_command(path, opts) # First implementation interpolated `file`; docs & RFC claim `path` # is interpolated. Until `file` can be deprecated, interpolate both. - Chef.deprecated(:verify_file, - "%{file} is deprecated in verify command and will not be "\ - "supported in Chef 13. Please use %{path} instead." - ) if @command.include?("%{file}") + if @command.include?("%{file}") + Chef.deprecated(:verify_file, + "%{file} is deprecated in verify command and will not be "\ + "supported in Chef 13. Please use %{path} instead." + ) + end command = @command % { :file => path, :path => path } interpreter = Chef::GuardInterpreter.for_resource(@parent_resource, command, @command_opts) interpreter.evaluate |