summaryrefslogtreecommitdiff
path: root/lib/chef/data_collector.rb
diff options
context:
space:
mode:
authordanielsdeleo <dan@chef.io>2016-10-28 13:49:46 -0700
committerdanielsdeleo <dan@chef.io>2016-11-02 08:06:38 -0700
commitc9739381fc9956b7e94b9687c14be6742afb3b93 (patch)
tree4e529d746af08ad4e09a3e280a98b5c56d620e96 /lib/chef/data_collector.rb
parent274fffd1a7f6a2e3e4b9867ac7481a686c9c7fc4 (diff)
downloadchef-c9739381fc9956b7e94b9687c14be6742afb3b93.tar.gz
Update default data collector URL to correct value
Additionally, add info and debug logging for the auto-detection of whether to enable the data collector. Signed-off-by: Daniel DeLeo <dan@chef.io>
Diffstat (limited to 'lib/chef/data_collector.rb')
-rw-r--r--lib/chef/data_collector.rb28
1 files changed, 22 insertions, 6 deletions
diff --git a/lib/chef/data_collector.rb b/lib/chef/data_collector.rb
index e377e4ae12..4365497bab 100644
--- a/lib/chef/data_collector.rb
+++ b/lib/chef/data_collector.rb
@@ -41,13 +41,29 @@ class Chef
# * disabled if `Chef::Config[:data_collector][:server_url]` is set to a
# falsey value
def self.register_reporter?
- return false if why_run?
- return false unless reporter_enabled_for_current_mode?
- if solo?
- data_collector_url_configured? && token_auth_configured?
- else
- data_collector_url_configured?
+ if why_run?
+ Chef::Log.debug("data collector is disabled for why run mode")
+ return false
+ end
+ unless reporter_enabled_for_current_mode?
+ Chef::Log.debug("data collector is configured to only run in " \
+ "#{Chef::Config[:data_collector][:mode].inspect} modes, disabling it")
+ return false
+ end
+ unless data_collector_url_configured?
+ Chef::Log.debug("data collector URL is not configured, disabling data collector")
+ return false
+ end
+ if solo? && !token_auth_configured?
+ Chef::Log.debug("Data collector token must be configured in solo mode, disabling data collector")
+ return false
+ end
+ if !solo? && token_auth_configured?
+ Chef::Log.warn("Data collector token authentication is not recommended for client-server mode" \
+ "Please upgrade Chef Server to 12.9.2+ and remove the token from your config file " \
+ "to use key based authentication instead")
end
+ true
end
def self.data_collector_url_configured?