summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Higgins <pete@peterhiggins.org>2020-12-01 12:37:35 -0800
committerPete Higgins <pete@peterhiggins.org>2020-12-01 16:12:04 -0800
commitaad6f9d85851ad5f76ab8e5ed457858dc7416982 (patch)
tree1e783eba15e474a482cf55b230eeb3aa8b845ad6
parent3615e74f34bb872dadad72aeb0644569b32ed640 (diff)
downloadchef-aad6f9d85851ad5f76ab8e5ed457858dc7416982.tar.gz
Rename audit mode to Compliance Phase.
Signed-off-by: Pete Higgins <pete@peterhiggins.org>
-rw-r--r--lib/chef/client.rb4
-rw-r--r--lib/chef/compliance/default_attributes.rb (renamed from lib/chef/audit/default_attributes.rb)8
-rw-r--r--lib/chef/compliance/fetcher/automate.rb (renamed from lib/chef/audit/fetcher/automate.rb)2
-rw-r--r--lib/chef/compliance/fetcher/chef_server.rb (renamed from lib/chef/audit/fetcher/chef_server.rb)2
-rw-r--r--lib/chef/compliance/reporter/automate.rb (renamed from lib/chef/audit/reporter/automate.rb)4
-rw-r--r--lib/chef/compliance/reporter/chef_server_automate.rb (renamed from lib/chef/audit/reporter/chef_server_automate.rb)4
-rw-r--r--lib/chef/compliance/reporter/compliance_enforcer.rb (renamed from lib/chef/audit/reporter/audit_enforcer.rb)2
-rw-r--r--lib/chef/compliance/reporter/json_file.rb (renamed from lib/chef/audit/reporter/json_file.rb)2
-rw-r--r--lib/chef/compliance/runner.rb (renamed from lib/chef/audit/runner.rb)30
-rw-r--r--spec/integration/compliance/compliance_spec.rb (renamed from spec/integration/audit/audit_spec.rb)0
-rw-r--r--spec/unit/client_spec.rb2
-rw-r--r--spec/unit/compliance/fetcher/automate_spec.rb (renamed from spec/unit/audit/fetcher/automate_spec.rb)46
-rw-r--r--spec/unit/compliance/fetcher/chef_server_spec.rb (renamed from spec/unit/audit/fetcher/chef_server_spec.rb)32
-rw-r--r--spec/unit/compliance/reporter/automate_spec.rb (renamed from spec/unit/audit/reporter/automate_spec.rb)6
-rw-r--r--spec/unit/compliance/reporter/chef_server_automate_spec.rb (renamed from spec/unit/audit/reporter/chef_server_automate_spec.rb)4
-rw-r--r--spec/unit/compliance/reporter/compliance_enforcer_spec.rb (renamed from spec/unit/audit/reporter/audit_enforcer_spec.rb)6
-rw-r--r--spec/unit/compliance/runner_spec.rb (renamed from spec/unit/audit/runner_spec.rb)2
17 files changed, 78 insertions, 78 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index 8b2d3e8a30..094b59fc35 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -57,7 +57,7 @@ require "ohai" unless defined?(Ohai::System)
require "rbconfig" unless defined?(RbConfig)
require "forwardable" unless defined?(Forwardable)
-require_relative "audit/runner"
+require_relative "compliance/runner"
class Chef
# == Chef::Client
@@ -237,7 +237,7 @@ class Chef
events.register(Chef::DataCollector::Reporter.new(events))
events.register(Chef::ActionCollection.new(events))
- events.register(Chef::Audit::Runner.new)
+ events.register(Chef::Compliance::Runner.new)
run_status.run_id = request_id = Chef::RequestID.instance.request_id
diff --git a/lib/chef/audit/default_attributes.rb b/lib/chef/compliance/default_attributes.rb
index a55c0da4e6..d063e6d401 100644
--- a/lib/chef/audit/default_attributes.rb
+++ b/lib/chef/compliance/default_attributes.rb
@@ -17,7 +17,7 @@ require "chef/node/attribute_collections" # for VividMash
require "chef/util/path_helper"
class Chef
- module Audit
+ module Compliance
DEFAULT_ATTRIBUTES = Chef::Node::VividMash.new(
# If enabled, a cache is built for all backend calls. This should only be
# disabled if you are expecting unique results from the same backend call.
@@ -54,11 +54,11 @@ class Chef
"json_file" => {
# The location of the json-file output:
- # <chef_cache_path>/audit_reports/audit-<timestamp>.json
+ # <chef_cache_path>/compliance_reports/compliance-<timestamp>.json
"location" => Chef::Util::PathHelper.join(
Chef::Config[:cache_path],
- "audit_reports",
- Time.now.utc.strftime("audit-%Y%m%d%H%M%S.json")
+ "compliance_reports",
+ Time.now.utc.strftime("compliance-%Y%m%d%H%M%S.json")
),
},
diff --git a/lib/chef/audit/fetcher/automate.rb b/lib/chef/compliance/fetcher/automate.rb
index b68b96b60a..c86da331c2 100644
--- a/lib/chef/audit/fetcher/automate.rb
+++ b/lib/chef/compliance/fetcher/automate.rb
@@ -2,7 +2,7 @@ require "uri" unless defined?(URI)
require "plugins/inspec-compliance/lib/inspec-compliance"
class Chef
- module Audit
+ module Compliance
module Fetcher
class Automate < ::InspecPlugins::Compliance::Fetcher
name "chef-automate"
diff --git a/lib/chef/audit/fetcher/chef_server.rb b/lib/chef/compliance/fetcher/chef_server.rb
index d227634ed9..db56aa82a7 100644
--- a/lib/chef/audit/fetcher/chef_server.rb
+++ b/lib/chef/compliance/fetcher/chef_server.rb
@@ -9,7 +9,7 @@ require "plugins/inspec-compliance/lib/inspec-compliance"
# inside of a chef-client run
class Chef
- module Audit
+ module Compliance
module Fetcher
class ChefServer < ::InspecPlugins::Compliance::Fetcher
name "chef-server"
diff --git a/lib/chef/audit/reporter/automate.rb b/lib/chef/compliance/reporter/automate.rb
index f91bbbf1e5..ed5c4837d0 100644
--- a/lib/chef/audit/reporter/automate.rb
+++ b/lib/chef/compliance/reporter/automate.rb
@@ -1,5 +1,5 @@
class Chef
- module Audit
+ module Compliance
module Reporter
#
# Used to send inspec reports to Chef Automate via the data_collector service
@@ -67,7 +67,7 @@ class Chef
begin
Chef::Log.info "Report to #{ChefUtils::Dist::Automate::PRODUCT}: #{@url}"
- Chef::Log.debug "Audit Report: #{json_report}"
+ Chef::Log.debug "Compliance Report: #{json_report}"
http_client.post(nil, json_report, headers)
true
rescue => e
diff --git a/lib/chef/audit/reporter/chef_server_automate.rb b/lib/chef/compliance/reporter/chef_server_automate.rb
index afd8c617b1..be59a4cf69 100644
--- a/lib/chef/audit/reporter/chef_server_automate.rb
+++ b/lib/chef/compliance/reporter/chef_server_automate.rb
@@ -1,12 +1,12 @@
require_relative "automate"
class Chef
- module Audit
+ module Compliance
module Reporter
#
# Used to send inspec reports to Chef Automate server via Chef Server
#
- class ChefServerAutomate < Chef::Audit::Reporter::Automate
+ class ChefServerAutomate < Chef::Compliance::Reporter::Automate
def initialize(opts)
@entity_uuid = opts[:entity_uuid]
@run_id = opts[:run_id]
diff --git a/lib/chef/audit/reporter/audit_enforcer.rb b/lib/chef/compliance/reporter/compliance_enforcer.rb
index 291e72d236..1c63e43b28 100644
--- a/lib/chef/audit/reporter/audit_enforcer.rb
+++ b/lib/chef/compliance/reporter/compliance_enforcer.rb
@@ -1,5 +1,5 @@
class Chef
- module Audit
+ module Compliance
module Reporter
class AuditEnforcer
class ControlFailure < StandardError; end
diff --git a/lib/chef/audit/reporter/json_file.rb b/lib/chef/compliance/reporter/json_file.rb
index e570189df7..471d9f64b1 100644
--- a/lib/chef/audit/reporter/json_file.rb
+++ b/lib/chef/compliance/reporter/json_file.rb
@@ -1,7 +1,7 @@
require_relative "../../json_compat"
class Chef
- module Audit
+ module Compliance
module Reporter
class JsonFile
def initialize(opts)
diff --git a/lib/chef/audit/runner.rb b/lib/chef/compliance/runner.rb
index 0d5e05d905..677349df3e 100644
--- a/lib/chef/audit/runner.rb
+++ b/lib/chef/compliance/runner.rb
@@ -1,13 +1,13 @@
autoload :Inspec, "inspec"
require_relative "default_attributes"
-require_relative "reporter/audit_enforcer"
require_relative "reporter/automate"
require_relative "reporter/chef_server_automate"
+require_relative "reporter/compliance_enforcer"
require_relative "reporter/json_file"
class Chef
- module Audit
+ module Compliance
class Runner < EventDispatch::Base
extend Forwardable
@@ -26,7 +26,7 @@ class Chef
def node=(node)
@node = node
- node.default["audit"] = Chef::Audit::DEFAULT_ATTRIBUTES.merge(node.default["audit"])
+ node.default["audit"] = Chef::Compliance::DEFAULT_ATTRIBUTES.merge(node.default["audit"])
end
def node_load_completed(node, _expanded_run_list, _config)
@@ -44,7 +44,7 @@ class Chef
def run_completed(_node, _run_status)
return unless enabled?
- logger.info("#{self.class}##{__method__}: enabling audit mode")
+ logger.info("#{self.class}##{__method__}: enabling Compliance Phase")
report
end
@@ -52,7 +52,7 @@ class Chef
def run_failed(_exception, _run_status)
return unless enabled?
- logger.info("#{self.class}##{__method__}: enabling audit mode")
+ logger.info("#{self.class}##{__method__}: enabling Compliance Phase")
report
end
@@ -75,7 +75,7 @@ class Chef
if deprecated_config_values.any?
values = deprecated_config_values.sort.map { |v| "'#{v}'" }.join(", ")
- logger.warn "audit-cookbook config values #{values} are not supported in #{ChefUtils::Dist::Infra::PRODUCT}'s audit mode."
+ logger.warn "audit cookbook config values #{values} are not supported in #{ChefUtils::Dist::Infra::PRODUCT}'s Compliance Phase."
end
end
@@ -83,7 +83,7 @@ class Chef
warn_for_deprecated_config_values!
if report.empty?
- logger.error "Audit report was not generated properly, skipped reporting"
+ logger.error "Compliance report was not generated properly, skipped reporting"
return
end
@@ -128,7 +128,7 @@ class Chef
when nil
# intentionally blank
else
- raise "Invalid value specified for audit mode's fetcher: '#{node["audit"]["fetcher"]}'. Valid values are 'chef-automate', 'chef-server', or nil."
+ raise "Invalid value specified for Compliance Phase's fetcher: '#{node["audit"]["fetcher"]}'. Valid values are 'chef-automate', 'chef-server', or nil."
end
end
@@ -139,7 +139,7 @@ class Chef
runner = ::Inspec::Runner.new(opts)
if profiles.empty?
- failed_report("No audit profiles are defined.")
+ failed_report("No #{Inspec::Dist::PRODUCT_NAME} profiles are defined.")
return
end
@@ -148,7 +148,7 @@ class Chef
logger.info "Running profiles from: #{profiles.inspect}"
runner.run
runner.report.tap do |r|
- logger.debug "Audit Report #{r}"
+ logger.debug "Compliance Report #{r}"
end
rescue Inspec::FetcherFailure => e
failed_report("Cannot fetch all profiles: #{profiles}. Please make sure you're authenticated and the server is reachable. #{e.message}")
@@ -216,7 +216,7 @@ class Chef
run_time_limit: run_time_limit,
control_results_limit: control_results_limit,
}
- Chef::Audit::Reporter::Automate.new(opts).send_report(report)
+ Chef::Compliance::Reporter::Automate.new(opts).send_report(report)
when "chef-server-automate"
chef_url = node["audit"]["server"] || base_chef_server_url
chef_org = Chef::Config[:chef_server_url].split("/").last
@@ -231,16 +231,16 @@ class Chef
run_time_limit: run_time_limit,
control_results_limit: control_results_limit,
}
- Chef::Audit::Reporter::ChefServer.new(opts).send_report(report)
+ Chef::Compliance::Reporter::ChefServer.new(opts).send_report(report)
else
logger.warn "Unable to determine #{ChefUtils::Dist::Server::PRODUCT} url required by #{Inspec::Dist::PRODUCT_NAME} report collector '#{reporter}'. Skipping..."
end
when "json-file"
path = node["audit"]["json_file"]["location"]
- logger.info "Writing report to #{path}"
- Chef::Audit::Reporter::JsonFile.new(file: path).send_report(report)
+ logger.info "Writing compliance report to #{path}"
+ Chef::Compliance::Reporter::JsonFile.new(file: path).send_report(report)
when "audit-enforcer"
- Chef::Audit::Reporter::AuditEnforcer.new.send_report(report)
+ Chef::Compliance::Reporter::ComplianceEnforcer.new.send_report(report)
else
logger.warn "#{reporter} is not a supported #{Inspec::Dist::PRODUCT_NAME} report collector"
end
diff --git a/spec/integration/audit/audit_spec.rb b/spec/integration/compliance/compliance_spec.rb
index 98776308de..98776308de 100644
--- a/spec/integration/audit/audit_spec.rb
+++ b/spec/integration/compliance/compliance_spec.rb
diff --git a/spec/unit/client_spec.rb b/spec/unit/client_spec.rb
index fc52e8fec4..b6a321c8e8 100644
--- a/spec/unit/client_spec.rb
+++ b/spec/unit/client_spec.rb
@@ -129,7 +129,7 @@ shared_context "a client run" do
expect(client.events).to receive(:register).with(instance_of(Chef::DataCollector::Reporter))
expect(client.events).to receive(:register).with(instance_of(Chef::ResourceReporter))
expect(client.events).to receive(:register).with(instance_of(Chef::ActionCollection))
- expect(client.events).to receive(:register).with(instance_of(Chef::Audit::Runner))
+ expect(client.events).to receive(:register).with(instance_of(Chef::Compliance::Runner))
end
def stub_for_node_load
diff --git a/spec/unit/audit/fetcher/automate_spec.rb b/spec/unit/compliance/fetcher/automate_spec.rb
index b4ed3f4f8c..bc2125aaa7 100644
--- a/spec/unit/audit/fetcher/automate_spec.rb
+++ b/spec/unit/compliance/fetcher/automate_spec.rb
@@ -1,7 +1,7 @@
require "spec_helper"
-require "chef/audit/fetcher/automate"
+require "chef/compliance/fetcher/automate"
-describe Chef::Audit::Fetcher::Automate do
+describe Chef::Compliance::Fetcher::Automate do
describe ".resolve" do
before do
Chef::Config[:data_collector] = {
@@ -14,9 +14,9 @@ describe Chef::Audit::Fetcher::Automate do
context "when target is a string" do
it "should resolve a compliance URL" do
- res = Chef::Audit::Fetcher::Automate.resolve("compliance://namespace/profile_name")
+ res = Chef::Compliance::Fetcher::Automate.resolve("compliance://namespace/profile_name")
- expect(res).to be_kind_of(Chef::Audit::Fetcher::Automate)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::Automate)
expected = "https://automate.test/compliance/profiles/namespace/profile_name/tar"
expect(res.target).to eq(expected)
end
@@ -25,25 +25,25 @@ describe Chef::Audit::Fetcher::Automate do
Chef::Config[:data_collector].delete(:token)
expect {
- Chef::Audit::Fetcher::Automate.resolve("compliance://namespace/profile_name")
+ Chef::Compliance::Fetcher::Automate.resolve("compliance://namespace/profile_name")
}.to raise_error(/No data-collector token set/)
end
it "includes the data collector token" do
- expect(Chef::Audit::Fetcher::Automate).to receive(:new).with(
+ expect(Chef::Compliance::Fetcher::Automate).to receive(:new).with(
"https://automate.test/compliance/profiles/namespace/profile_name/tar",
hash_including("token" => token)
).and_call_original
- res = Chef::Audit::Fetcher::Automate.resolve("compliance://namespace/profile_name")
+ res = Chef::Compliance::Fetcher::Automate.resolve("compliance://namespace/profile_name")
- expect(res).to be_kind_of(Chef::Audit::Fetcher::Automate)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::Automate)
expected = "https://automate.test/compliance/profiles/namespace/profile_name/tar"
expect(res.target).to eq(expected)
end
it "returns nil with a non-compliance URL" do
- res = Chef::Audit::Fetcher::Automate.resolve("http://github.com/chef-cookbooks/audit")
+ res = Chef::Compliance::Fetcher::Automate.resolve("http://github.com/chef-cookbooks/audit")
expect(res).to eq(nil)
end
@@ -51,51 +51,51 @@ describe Chef::Audit::Fetcher::Automate do
context "when target is a hash" do
it "should resolve a target with a version" do
- res = Chef::Audit::Fetcher::Automate.resolve(
+ res = Chef::Compliance::Fetcher::Automate.resolve(
compliance: "namespace/profile_name",
version: "1.2.3"
)
- expect(res).to be_kind_of(Chef::Audit::Fetcher::Automate)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::Automate)
expected = "https://automate.test/compliance/profiles/namespace/profile_name/version/1.2.3/tar"
expect(res.target).to eq(expected)
end
it "should resolve a target without a version" do
- res = Chef::Audit::Fetcher::Automate.resolve(
+ res = Chef::Compliance::Fetcher::Automate.resolve(
compliance: "namespace/profile_name"
)
- expect(res).to be_kind_of(Chef::Audit::Fetcher::Automate)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::Automate)
expected = "https://automate.test/compliance/profiles/namespace/profile_name/tar"
expect(res.target).to eq(expected)
end
it "uses url key when present" do
- res = Chef::Audit::Fetcher::Automate.resolve(
+ res = Chef::Compliance::Fetcher::Automate.resolve(
compliance: "namespace/profile_name",
version: "1.2.3",
url: "https://profile.server.test/profiles/profile_name/1.2.3"
)
- expect(res).to be_kind_of(Chef::Audit::Fetcher::Automate)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::Automate)
expected = "https://profile.server.test/profiles/profile_name/1.2.3"
expect(res.target).to eq(expected)
end
it "does not include token in the config when url key is present" do
- expect(Chef::Audit::Fetcher::Automate).to receive(:new).with(
+ expect(Chef::Compliance::Fetcher::Automate).to receive(:new).with(
"https://profile.server.test/profiles/profile_name/1.2.3",
hash_including("token" => nil)
).and_call_original
- res = Chef::Audit::Fetcher::Automate.resolve(
+ res = Chef::Compliance::Fetcher::Automate.resolve(
compliance: "namespace/profile_name",
version: "1.2.3",
url: "https://profile.server.test/profiles/profile_name/1.2.3"
)
- expect(res).to be_kind_of(Chef::Audit::Fetcher::Automate)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::Automate)
expected = "https://profile.server.test/profiles/profile_name/1.2.3"
expect(res.target).to eq(expected)
end
@@ -104,25 +104,25 @@ describe Chef::Audit::Fetcher::Automate do
Chef::Config[:data_collector].delete(:token)
expect {
- Chef::Audit::Fetcher::Automate.resolve(compliance: "namespace/profile_name")
+ Chef::Compliance::Fetcher::Automate.resolve(compliance: "namespace/profile_name")
}.to raise_error(Inspec::FetcherFailure, /No data-collector token set/)
end
it "includes the data collector token" do
- expect(Chef::Audit::Fetcher::Automate).to receive(:new).with(
+ expect(Chef::Compliance::Fetcher::Automate).to receive(:new).with(
"https://automate.test/compliance/profiles/namespace/profile_name/tar",
hash_including("token" => token)
).and_call_original
- res = Chef::Audit::Fetcher::Automate.resolve(compliance: "namespace/profile_name")
+ res = Chef::Compliance::Fetcher::Automate.resolve(compliance: "namespace/profile_name")
- expect(res).to be_kind_of(Chef::Audit::Fetcher::Automate)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::Automate)
expected = "https://automate.test/compliance/profiles/namespace/profile_name/tar"
expect(res.target).to eq(expected)
end
it "returns nil with a non-profile Hash" do
- res = Chef::Audit::Fetcher::Automate.resolve(
+ res = Chef::Compliance::Fetcher::Automate.resolve(
profile: "namespace/profile_name",
version: "1.2.3"
)
diff --git a/spec/unit/audit/fetcher/chef_server_spec.rb b/spec/unit/compliance/fetcher/chef_server_spec.rb
index dd00efd567..fc1c229989 100644
--- a/spec/unit/audit/fetcher/chef_server_spec.rb
+++ b/spec/unit/compliance/fetcher/chef_server_spec.rb
@@ -1,7 +1,7 @@
require "spec_helper"
-require "chef/audit/fetcher/chef_server"
+require "chef/compliance/fetcher/chef_server"
-describe Chef::Audit::Fetcher::ChefServer do
+describe Chef::Compliance::Fetcher::ChefServer do
let(:node) do
Chef::Node.new.tap do |n|
n.default["audit"] = {}
@@ -17,32 +17,32 @@ describe Chef::Audit::Fetcher::ChefServer do
describe ".resolve" do
context "when target is a string" do
it "should resolve a compliance URL" do
- res = Chef::Audit::Fetcher::ChefServer.resolve("compliance://namespace/profile_name")
+ res = Chef::Compliance::Fetcher::ChefServer.resolve("compliance://namespace/profile_name")
- expect(res).to be_kind_of(Chef::Audit::Fetcher::ChefServer)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::ChefServer)
expected = "http://127.0.0.1:8889/organizations/my_org/owners/namespace/compliance/profile_name/tar"
expect(res.target).to eq(expected)
end
it "should add /compliance URL prefix if needed" do
node.default["audit"]["fetcher"] = "chef-server"
- res = Chef::Audit::Fetcher::ChefServer.resolve("compliance://namespace/profile_name")
+ res = Chef::Compliance::Fetcher::ChefServer.resolve("compliance://namespace/profile_name")
- expect(res).to be_kind_of(Chef::Audit::Fetcher::ChefServer)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::ChefServer)
expected = "http://127.0.0.1:8889/compliance/organizations/my_org/owners/namespace/compliance/profile_name/tar"
expect(res.target).to eq(expected)
end
it "includes user in the URL if present" do
- res = Chef::Audit::Fetcher::ChefServer.resolve("compliance://username@namespace/profile_name")
+ res = Chef::Compliance::Fetcher::ChefServer.resolve("compliance://username@namespace/profile_name")
- expect(res).to be_kind_of(Chef::Audit::Fetcher::ChefServer)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::ChefServer)
expected = "http://127.0.0.1:8889/organizations/my_org/owners/username@namespace/compliance/profile_name/tar"
expect(res.target).to eq(expected)
end
it "returns nil with a non-compliance URL" do
- res = Chef::Audit::Fetcher::ChefServer.resolve("http://github.com/chef-cookbooks/audit")
+ res = Chef::Compliance::Fetcher::ChefServer.resolve("http://github.com/chef-cookbooks/audit")
expect(res).to eq(nil)
end
@@ -50,38 +50,38 @@ describe Chef::Audit::Fetcher::ChefServer do
context "when target is a hash" do
it "should resolve a target with a version" do
- res = Chef::Audit::Fetcher::ChefServer.resolve(
+ res = Chef::Compliance::Fetcher::ChefServer.resolve(
compliance: "namespace/profile_name",
version: "1.2.3"
)
- expect(res).to be_kind_of(Chef::Audit::Fetcher::ChefServer)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::ChefServer)
expected = "http://127.0.0.1:8889/organizations/my_org/owners/namespace/compliance/profile_name/version/1.2.3/tar"
expect(res.target).to eq(expected)
end
it "should resolve a target without a version" do
- res = Chef::Audit::Fetcher::ChefServer.resolve(
+ res = Chef::Compliance::Fetcher::ChefServer.resolve(
compliance: "namespace/profile_name"
)
- expect(res).to be_kind_of(Chef::Audit::Fetcher::ChefServer)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::ChefServer)
expected = "http://127.0.0.1:8889/organizations/my_org/owners/namespace/compliance/profile_name/tar"
expect(res.target).to eq(expected)
end
it "includes user in the URL if present" do
- res = Chef::Audit::Fetcher::ChefServer.resolve(
+ res = Chef::Compliance::Fetcher::ChefServer.resolve(
compliance: "username@namespace/profile_name"
)
- expect(res).to be_kind_of(Chef::Audit::Fetcher::ChefServer)
+ expect(res).to be_kind_of(Chef::Compliance::Fetcher::ChefServer)
expected = "http://127.0.0.1:8889/organizations/my_org/owners/username@namespace/compliance/profile_name/tar"
expect(res.target).to eq(expected)
end
it "returns nil with a non-profile Hash" do
- res = Chef::Audit::Fetcher::ChefServer.resolve(
+ res = Chef::Compliance::Fetcher::ChefServer.resolve(
profile: "namespace/profile_name",
version: "1.2.3"
)
diff --git a/spec/unit/audit/reporter/automate_spec.rb b/spec/unit/compliance/reporter/automate_spec.rb
index d55bea282f..e0a33892b0 100644
--- a/spec/unit/audit/reporter/automate_spec.rb
+++ b/spec/unit/compliance/reporter/automate_spec.rb
@@ -1,8 +1,8 @@
require "spec_helper"
require "json" # For .to_json
-describe Chef::Audit::Reporter::Automate do
- let(:reporter) { Chef::Audit::Reporter::Automate.new(opts) }
+describe Chef::Compliance::Reporter::Automate do
+ let(:reporter) { Chef::Compliance::Reporter::Automate.new(opts) }
let(:opts) do
{
@@ -267,7 +267,7 @@ describe Chef::Audit::Reporter::Automate do
it "does not send report when entity_uuid is missing" do
opts.delete(:entity_uuid)
- reporter = Chef::Audit::Reporter::Automate.new(opts)
+ reporter = Chef::Compliance::Reporter::Automate.new(opts)
expect(reporter.send_report(inspec_report)).to eq(false)
end
end
diff --git a/spec/unit/audit/reporter/chef_server_automate_spec.rb b/spec/unit/compliance/reporter/chef_server_automate_spec.rb
index 46dacd812d..e45a7157ee 100644
--- a/spec/unit/audit/reporter/chef_server_automate_spec.rb
+++ b/spec/unit/compliance/reporter/chef_server_automate_spec.rb
@@ -1,6 +1,6 @@
require "spec_helper"
-describe Chef::Audit::Reporter::ChefServerAutomate do
+describe Chef::Compliance::Reporter::ChefServerAutomate do
before do
WebMock.disable_net_connect!
@@ -8,7 +8,7 @@ describe Chef::Audit::Reporter::ChefServerAutomate do
Chef::Config[:node_name] = "spec-node"
end
- let(:reporter) { Chef::Audit::Reporter::ChefServerAutomate.new(opts) }
+ let(:reporter) { Chef::Compliance::Reporter::ChefServerAutomate.new(opts) }
let(:opts) do
{
diff --git a/spec/unit/audit/reporter/audit_enforcer_spec.rb b/spec/unit/compliance/reporter/compliance_enforcer_spec.rb
index c29cb4a946..ae63cf0853 100644
--- a/spec/unit/audit/reporter/audit_enforcer_spec.rb
+++ b/spec/unit/compliance/reporter/compliance_enforcer_spec.rb
@@ -1,7 +1,7 @@
require "spec_helper"
-describe Chef::Audit::Reporter::AuditEnforcer do
- let(:reporter) { Chef::Audit::Reporter::AuditEnforcer.new }
+describe Chef::Compliance::Reporter::AuditEnforcer do
+ let(:reporter) { Chef::Compliance::Reporter::AuditEnforcer.new }
it "does not raise error for a successful InSpec report" do
report = {
@@ -43,6 +43,6 @@ describe Chef::Audit::Reporter::AuditEnforcer do
expect {
reporter.send_report(report)
- }.to raise_error(Chef::Audit::Reporter::AuditEnforcer::ControlFailure, "Audit c2 has failed. Aborting chef-client run.")
+ }.to raise_error(Chef::Compliance::Reporter::AuditEnforcer::ControlFailure, "Audit c2 has failed. Aborting chef-client run.")
end
end
diff --git a/spec/unit/audit/runner_spec.rb b/spec/unit/compliance/runner_spec.rb
index 7e62ffa398..68c8a9553b 100644
--- a/spec/unit/audit/runner_spec.rb
+++ b/spec/unit/compliance/runner_spec.rb
@@ -1,6 +1,6 @@
require "spec_helper"
-describe Chef::Audit::Runner do
+describe Chef::Compliance::Runner do
let(:logger) { double(:logger).as_null_object }
let(:node) { Chef::Node.new(logger: logger) }