diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-08-12 10:58:15 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-08-16 18:41:25 -0700 |
commit | 8069ed78dc8ed361f81064bca4da4b63c72559a4 (patch) | |
tree | c6cd54adfa2310eb48810a1e31fbce40dcb60c03 | |
parent | 7fc41c51ef4fcfd68b38971336bfa9b728066a19 (diff) | |
download | chef-8069ed78dc8ed361f81064bca4da4b63c72559a4.tar.gz |
fixing Style/MultilineTernaryOperator cop
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r-- | lib/chef/knife/ssh.rb | 4 | ||||
-rw-r--r-- | lib/chef/mixin/windows_architecture_helper.rb | 7 | ||||
-rw-r--r-- | lib/chef/platform/provider_mapping.rb | 7 | ||||
-rw-r--r-- | lib/chef/provider/cron.rb | 3 | ||||
-rw-r--r-- | lib/chef/provider/service/upstart.rb | 7 | ||||
-rw-r--r-- | lib/chef/provider/windows_script.rb | 7 | ||||
-rw-r--r-- | lib/chef/util/powershell/cmdlet.rb | 7 | ||||
-rw-r--r-- | omnibus/omnibus.rb | 6 |
8 files changed, 29 insertions, 19 deletions
diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb index 005c4007e1..6f266b2719 100644 --- a/lib/chef/knife/ssh.rb +++ b/lib/chef/knife/ssh.rb @@ -164,9 +164,7 @@ class Chef end def configure_session - list = config[:manual] ? - @name_args[0].split(" ") : - search_nodes + list = config[:manual] ? @name_args[0].split(" ") : search_nodes if list.length == 0 if @action_nodes.length == 0 ui.fatal("No nodes returned from search") diff --git a/lib/chef/mixin/windows_architecture_helper.rb b/lib/chef/mixin/windows_architecture_helper.rb index 11e1b5559d..49252af484 100644 --- a/lib/chef/mixin/windows_architecture_helper.rb +++ b/lib/chef/mixin/windows_architecture_helper.rb @@ -74,16 +74,15 @@ class Chef def node_supports_windows_architecture?(node, desired_architecture) assert_valid_windows_architecture!(desired_architecture) - return (node_windows_architecture(node) == :x86_64 || - desired_architecture == :i386) ? true : false + return ( node_windows_architecture(node) == :x86_64 ) || ( desired_architecture == :i386 ) end def valid_windows_architecture?(architecture) - return (architecture == :x86_64) || (architecture == :i386) + return ( architecture == :x86_64 ) || ( architecture == :i386 ) end def assert_valid_windows_architecture!(architecture) - if ! valid_windows_architecture?(architecture) + if !valid_windows_architecture?(architecture) raise Chef::Exceptions::Win32ArchitectureIncorrect, "The specified architecture was not valid. It must be one of :i386 or :x86_64" end diff --git a/lib/chef/platform/provider_mapping.rb b/lib/chef/platform/provider_mapping.rb index 40474242f0..bc565d92ef 100644 --- a/lib/chef/platform/provider_mapping.rb +++ b/lib/chef/platform/provider_mapping.rb @@ -197,8 +197,11 @@ class Chef def resource_matching_provider(platform, version, resource_type) if resource_type.kind_of?(Chef::Resource) - class_name = resource_type.class.name ? resource_type.class.name.split("::").last : - convert_to_class_name(resource_type.resource_name.to_s) + class_name = if resource_type.class.name + resource_type.class.name.split("::").last + else + convert_to_class_name(resource_type.resource_name.to_s) + end if Chef::Provider.const_defined?(class_name, false) Chef::Log.warn("Class Chef::Provider::#{class_name} does not declare 'provides #{convert_to_snake_case(class_name).to_sym.inspect}'.") diff --git a/lib/chef/provider/cron.rb b/lib/chef/provider/cron.rb index c7487cf42f..7baaeec0c5 100644 --- a/lib/chef/provider/cron.rb +++ b/lib/chef/provider/cron.rb @@ -187,8 +187,7 @@ class Chef end crontab << line end - description = cron_found ? "remove #{@new_resource.name} from crontab" : - "save unmodified crontab" + description = cron_found ? "remove #{@new_resource.name} from crontab" : "save unmodified crontab" converge_by(description) do write_crontab crontab Chef::Log.info("#{@new_resource} deleted crontab entry") diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb index 3ac5ff51da..99ffc24653 100644 --- a/lib/chef/provider/service/upstart.rb +++ b/lib/chef/provider/service/upstart.rb @@ -80,8 +80,11 @@ class Chef shared_resource_requirements requirements.assert(:all_actions) do |a| if !@command_success - whyrun_msg = @new_resource.status_command ? "Provided status command #{@new_resource.status_command} failed." : - "Could not determine upstart state for service" + whyrun_msg = if @new_resource.status_command + "Provided status command #{@new_resource.status_command} failed." + else + "Could not determine upstart state for service" + end end a.assertion { @command_success } # no failure here, just document the assumptions made. diff --git a/lib/chef/provider/windows_script.rb b/lib/chef/provider/windows_script.rb index 2de127addf..3b0202790c 100644 --- a/lib/chef/provider/windows_script.rb +++ b/lib/chef/provider/windows_script.rb @@ -33,8 +33,11 @@ class Chef super( new_resource, run_context ) @script_extension = script_extension - target_architecture = new_resource.architecture.nil? ? - node_windows_architecture(run_context.node) : new_resource.architecture + target_architecture = if new_resource.architecture.nil? + node_windows_architecture(run_context.node) + else + new_resource.architecture + end @is_wow64 = wow64_architecture_override_required?(run_context.node, target_architecture) diff --git a/lib/chef/util/powershell/cmdlet.rb b/lib/chef/util/powershell/cmdlet.rb index 6ab380c071..e300266b1e 100644 --- a/lib/chef/util/powershell/cmdlet.rb +++ b/lib/chef/util/powershell/cmdlet.rb @@ -62,8 +62,11 @@ class Chef json_depth = @output_format_options[:depth] end - json_command = @json_format ? " | convertto-json -compress -depth #{json_depth} "\ - "> #{streams[:json].path}" : "" + json_command = if @json_format + " | convertto-json -compress -depth #{json_depth} > #{streams[:json].path}" + else + "" + end redirections = "4> '#{streams[:verbose].path}'" command_string = "powershell.exe -executionpolicy bypass -noprofile -noninteractive "\ "-command \"trap [Exception] {write-error -exception "\ diff --git a/omnibus/omnibus.rb b/omnibus/omnibus.rb index 4eeee4abcb..5d91bb786a 100644 --- a/omnibus/omnibus.rb +++ b/omnibus/omnibus.rb @@ -26,8 +26,10 @@ # Windows architecture defaults - set to x86 unless otherwise specified. # ------------------------------ -windows_arch %w{x86 x64}.include?((ENV["OMNIBUS_WINDOWS_ARCH"] || "").downcase) ? - ENV["OMNIBUS_WINDOWS_ARCH"].downcase.to_sym : :x86 +env_omnibus_windows_arch = (ENV["OMNIBUS_WINDOWS_ARCH"] || "").downcase +env_omnibus_windows_arch = :x86 unless %w{x86 x64}.include?(env_omnibus_windows_arch) + +windows_arch env_omnibus_windows_arch # Disable git caching # ------------------------------ |