summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Higgins <pete@peterhiggins.org>2020-12-11 12:26:30 -0800
committerPete Higgins <pete@peterhiggins.org>2020-12-11 12:44:08 -0800
commitf920d6d951bd368b3b365c17114ac09f68925c17 (patch)
tree5e0845036f61dd4558567bcf837c22e0667b49b0
parentce2d4b36cc532732d2631c905f8c7206b496458c (diff)
downloadchef-f920d6d951bd368b3b365c17114ac09f68925c17.tar.gz
Remove gate on impossible case.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
-rw-r--r--lib/chef/compliance/runner.rb26
-rw-r--r--spec/unit/compliance/runner_spec.rb5
2 files changed, 10 insertions, 21 deletions
diff --git a/lib/chef/compliance/runner.rb b/lib/chef/compliance/runner.rb
index 789ff74419..fc7a1210b8 100644
--- a/lib/chef/compliance/runner.rb
+++ b/lib/chef/compliance/runner.rb
@@ -226,22 +226,16 @@ class Chef
}
Chef::Compliance::Reporter::Automate.new(opts)
when "chef-server-automate"
- url = chef_server_automate_url
- if url
- opts = {
- entity_uuid: node["chef_guid"],
- run_id: run_id,
- node_info: node_info,
- insecure: insecure,
- url: url,
- run_time_limit: run_time_limit,
- control_results_limit: control_results_limit,
- }
- Chef::Compliance::Reporter::ChefServerAutomate.new(opts)
- else
- logger.warn "Unable to determine #{ChefUtils::Dist::Server::PRODUCT} url required by #{Inspec::Dist::PRODUCT_NAME} report collector 'chef-server-automate'. Skipping..."
- nil
- end
+ opts = {
+ entity_uuid: node["chef_guid"],
+ run_id: run_id,
+ node_info: node_info,
+ insecure: insecure,
+ url: chef_server_automate_url,
+ run_time_limit: run_time_limit,
+ control_results_limit: control_results_limit,
+ }
+ Chef::Compliance::Reporter::ChefServerAutomate.new(opts)
when "json-file"
path = node["audit"]["json_file"]["location"]
logger.info "Writing compliance report to #{path}"
diff --git a/spec/unit/compliance/runner_spec.rb b/spec/unit/compliance/runner_spec.rb
index fbd57f6be9..d9472e8b08 100644
--- a/spec/unit/compliance/runner_spec.rb
+++ b/spec/unit/compliance/runner_spec.rb
@@ -131,11 +131,6 @@ describe Chef::Compliance::Runner do
expect(reporter).to be_kind_of(Chef::Compliance::Reporter::ChefServerAutomate)
expect(reporter.url).to eq(URI("https://chef_config_url.example.com/organizations/my_org/data-collector"))
end
-
- xit "returns nil with no 'server' attribute or chef_server_url configured" do
- Chef::Config[:chef_server_url] = nil
- expect(runner.reporter("chef-server-automate")).to be_nil
- end
end
it "returns nil for unexpected reporter value" do