diff options
author | Tim Smith <tsmith84@gmail.com> | 2020-02-18 15:59:16 -0800 |
---|---|---|
committer | Tim Smith <tsmith84@gmail.com> | 2020-02-18 15:59:16 -0800 |
commit | f64cf7ddf79259a71c5adfdcd1ecba9b85122b01 (patch) | |
tree | 6e33ae32feb1e8acec42c8d0f06a1bb85de2233c /lib/chef/data_collector | |
parent | c9414338729decf217c8bfc37b1d405619c44331 (diff) | |
download | chef-f64cf7ddf79259a71c5adfdcd1ecba9b85122b01.tar.gz |
Chefstyle fixes identified with Rubocop 0.80
The new Rubocop detects more unnecessary returns. This fixes these ahead of time so we can roll out the new Rubocop engine without breaking builds later.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/data_collector')
-rw-r--r-- | lib/chef/data_collector/config_validation.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/chef/data_collector/config_validation.rb b/lib/chef/data_collector/config_validation.rb index 8bc409f03c..d3a347c57c 100644 --- a/lib/chef/data_collector/config_validation.rb +++ b/lib/chef/data_collector/config_validation.rb @@ -77,27 +77,27 @@ class Chef case when Chef::Config[:why_run] Chef::Log.trace("data collector is disabled for why run mode") - return false + false when (want_mode != :both) && running_mode != want_mode Chef::Log.trace("data collector is configured to only run in #{Chef::Config[:data_collector][:mode]} modes, disabling it") - return false + false when !(Chef::Config[:data_collector][:server_url] || Chef::Config[:data_collector][:output_locations]) Chef::Log.trace("Neither data collector URL or output locations have been configured, disabling data collector") - return false + false when running_mode == :client && Chef::Config[:data_collector][:token] Chef::Log.warn("Data collector token authentication is not recommended for client-server mode. " \ "Please upgrade #{Chef::Dist::SERVER_PRODUCT} to 12.11 or later and remove the token from your config file " \ "to use key based authentication instead") - return true + true when Chef::Config[:data_collector][:output_locations] && Chef::Config[:data_collector][:output_locations][:files] && !Chef::Config[:data_collector][:output_locations][:files].empty? # we can run fine to a file without a token, even in solo mode. - return true + true when running_mode == :solo && !Chef::Config[:data_collector][:token] # we are in solo mode and are not logging to a file, so must have a token Chef::Log.trace("Data collector token must be configured to use #{Chef::Dist::AUTOMATE} data collector with #{Chef::Dist::SOLO}") - return false + false else - return true + true end end |