summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivek Singh <vivek.singh@msystechnologies.com>2020-09-08 12:21:12 +0530
committerVivek Singh <vivek.singh@msystechnologies.com>2020-09-08 12:21:12 +0530
commit53f6d9c1dad7fdf65e74eddf83602dadcb4685c7 (patch)
tree1461fb0946660a97dbdc40f0234434d369b2bbbb
parent4e13105048450f33bb909499dde3619a6c212252 (diff)
downloadchef-53f6d9c1dad7fdf65e74eddf83602dadcb4685c7.tar.gz
Fixes integration specs
Signed-off-by: Vivek Singh <vivek.singh@msystechnologies.com>
-rw-r--r--lib/chef/data_collector.rb5
-rw-r--r--lib/chef/data_collector/config_validation.rb7
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/chef/data_collector.rb b/lib/chef/data_collector.rb
index 85bb6a28df..24daabc02f 100644
--- a/lib/chef/data_collector.rb
+++ b/lib/chef/data_collector.rb
@@ -75,8 +75,6 @@ class Chef
# (see EventDispatch::Base#run_start)
#
def run_start(chef_version, run_status)
- Chef::DataCollector::ConfigValidation.validate_server_url!
- Chef::DataCollector::ConfigValidation.validate_output_locations!
events.unregister(self) unless Chef::DataCollector::ConfigValidation.should_be_enabled?
@run_status = run_status
end
@@ -117,6 +115,9 @@ class Chef
# (see EventDispatch::Base#run_started)
#
def run_started(run_status)
+ Chef::DataCollector::ConfigValidation.validate_server_url!
+ Chef::DataCollector::ConfigValidation.validate_output_locations!
+
send_run_start
end
diff --git a/lib/chef/data_collector/config_validation.rb b/lib/chef/data_collector/config_validation.rb
index 5f8e7d3fe5..07224f565d 100644
--- a/lib/chef/data_collector/config_validation.rb
+++ b/lib/chef/data_collector/config_validation.rb
@@ -89,8 +89,13 @@ class Chef
"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")
true
- when Chef::Config[:data_collector][:output_locations] && Chef::Config[:data_collector][:output_locations][:files] && !Chef::Config[:data_collector][:output_locations][:files].empty?
+ when Chef::Config[:data_collector][:output_locations]
# we can run fine to a file without a token, even in solo mode.
+ unless valid_hash_with_keys?(Chef::Config[:data_collector][:output_locations], :files)
+ raise Chef::Exceptions::ConfigurationError,
+ "Chef::Config[:data_collector][:output_locations] is empty. Please supply an hash of valid URLs and / or local file paths."
+ end
+
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