summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2021-09-23 15:11:46 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2021-09-23 15:11:46 -0700
commit50709721e8e8c9e3a9912c69e9a1666595878453 (patch)
tree5f7fdad34d027f645edeeb8c61122a1fb1ef3c29
parent067aa3e69154922da54a485499bc4ff55f53dd46 (diff)
downloadchef-50709721e8e8c9e3a9912c69e9a1666595878453.tar.gz
change to inspec_data
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--lib/chef/compliance/input.rb2
-rw-r--r--lib/chef/compliance/input_collection.rb4
-rw-r--r--lib/chef/compliance/profile.rb2
-rw-r--r--lib/chef/compliance/profile_collection.rb4
-rw-r--r--lib/chef/compliance/runner.rb6
-rw-r--r--lib/chef/compliance/waiver.rb2
-rw-r--r--lib/chef/compliance/waiver_collection.rb4
-rw-r--r--spec/unit/compliance/input_spec.rb4
-rw-r--r--spec/unit/compliance/profile_spec.rb4
-rw-r--r--spec/unit/compliance/waiver_spec.rb4
10 files changed, 18 insertions, 18 deletions
diff --git a/lib/chef/compliance/input.rb b/lib/chef/compliance/input.rb
index bf0176dfe6..686b516b2e 100644
--- a/lib/chef/compliance/input.rb
+++ b/lib/chef/compliance/input.rb
@@ -75,7 +75,7 @@ class Chef
# Render the input in a way that it can be consumed by inspec
#
- def for_inspec
+ def inspec_data
data
end
diff --git a/lib/chef/compliance/input_collection.rb b/lib/chef/compliance/input_collection.rb
index 66cb78c643..6c08466990 100644
--- a/lib/chef/compliance/input_collection.rb
+++ b/lib/chef/compliance/input_collection.rb
@@ -56,8 +56,8 @@ class Chef
# @return [Array<Input>] inspec inputs which are enabled in a form suitable to pass to inspec
#
- def for_inspec
- select(&:enabled?).each_with_object({}) { |input, hash| hash.merge(input.for_inspec) }
+ def inspec_data
+ select(&:enabled?).each_with_object({}) { |input, hash| hash.merge(input.inspec_data) }
end
# DSL method to enable input files. This matches on the filename of the input file.
diff --git a/lib/chef/compliance/profile.rb b/lib/chef/compliance/profile.rb
index f818f244df..ec9d61895c 100644
--- a/lib/chef/compliance/profile.rb
+++ b/lib/chef/compliance/profile.rb
@@ -82,7 +82,7 @@ class Chef
# Render the profile in a way that it can be consumed by inspec
#
- def for_inspec
+ def inspec_data
{ name: name, path: File.dirname(path) }
end
diff --git a/lib/chef/compliance/profile_collection.rb b/lib/chef/compliance/profile_collection.rb
index 302bae07ec..d85d04e825 100644
--- a/lib/chef/compliance/profile_collection.rb
+++ b/lib/chef/compliance/profile_collection.rb
@@ -52,8 +52,8 @@ class Chef
# @return [Array<Profile>] inspec profiles which are enabled in a form suitable to pass to inspec
#
- def for_inspec
- select(&:enabled?).each_with_object([]) { |profile, arry| arry << profile.for_inspec }
+ def inspec_data
+ select(&:enabled?).each_with_object([]) { |profile, arry| arry << profile.inspec_data }
end
# DSL method to enable profile files. This matches on the name of the profile being included it
diff --git a/lib/chef/compliance/runner.rb b/lib/chef/compliance/runner.rb
index 0d22133daf..b00008fa51 100644
--- a/lib/chef/compliance/runner.rb
+++ b/lib/chef/compliance/runner.rb
@@ -134,11 +134,11 @@ class Chef
end
def inputs_from_collection
- safe_input_collection&.for_inspec || {}
+ safe_input_collection&.inspec_data || {}
end
def waivers_from_collection
- safe_waiver_collection&.for_inspec || {}
+ safe_waiver_collection&.inspec_data || {}
end
def inspec_opts
@@ -178,7 +178,7 @@ class Chef
profile.transform_keys(&:to_sym).update(name: name)
end || []
- from_cookbooks = safe_profile_collection&.for_inspec || []
+ from_cookbooks = safe_profile_collection&.inspec_data || []
from_attributes + from_cookbooks
end
diff --git a/lib/chef/compliance/waiver.rb b/lib/chef/compliance/waiver.rb
index d01d4fc7d6..0062a7d5d9 100644
--- a/lib/chef/compliance/waiver.rb
+++ b/lib/chef/compliance/waiver.rb
@@ -75,7 +75,7 @@ class Chef
# Render the waiver in a way that it can be consumed by inspec
#
- def for_inspec
+ def inspec_data
data
end
diff --git a/lib/chef/compliance/waiver_collection.rb b/lib/chef/compliance/waiver_collection.rb
index 0fed87fd93..b8feb2da87 100644
--- a/lib/chef/compliance/waiver_collection.rb
+++ b/lib/chef/compliance/waiver_collection.rb
@@ -56,8 +56,8 @@ class Chef
# @return [Array<Waiver>] inspec waivers which are enabled in a form suitable to pass to inspec
#
- def for_inspec
- select(&:enabled?).each_with_object({}) { |waiver, hash| hash.merge(waiver.for_inspec) }
+ def inspec_data
+ select(&:enabled?).each_with_object({}) { |waiver, hash| hash.merge(waiver.inspec_data) }
end
# DSL method to enable waiver files. This matches on the filename of the waiver file.
diff --git a/spec/unit/compliance/input_spec.rb b/spec/unit/compliance/input_spec.rb
index 67c5e071e0..a65adfb284 100644
--- a/spec/unit/compliance/input_spec.rb
+++ b/spec/unit/compliance/input_spec.rb
@@ -64,8 +64,8 @@ describe Chef::Compliance::Input do
expect(input.enabled?).to eql(false)
end
- it "has a #for_inspec method that renders the data" do
- expect(input.for_inspec).to eql(data)
+ it "has a #inspec_data method that renders the data" do
+ expect(input.inspec_data).to eql(data)
end
it "doesn't render the events in the inspect output" do
diff --git a/spec/unit/compliance/profile_spec.rb b/spec/unit/compliance/profile_spec.rb
index 53b7168279..8487b26691 100644
--- a/spec/unit/compliance/profile_spec.rb
+++ b/spec/unit/compliance/profile_spec.rb
@@ -68,8 +68,8 @@ describe Chef::Compliance::Profile do
expect(profile.enabled?).to eql(false)
end
- it "has a #for_inspec method that renders the path" do
- expect(profile.for_inspec).to eql( { name: "ssh-baseline", path: "/var/chef/cache/cookbooks/acme_compliance/compliance/profiles/thisdirectoryisnotthename" } )
+ it "has a #inspec_data method that renders the path" do
+ expect(profile.inspec_data).to eql( { name: "ssh-baseline", path: "/var/chef/cache/cookbooks/acme_compliance/compliance/profiles/thisdirectoryisnotthename" } )
end
it "doesn't render the events in the inspect output" do
diff --git a/spec/unit/compliance/waiver_spec.rb b/spec/unit/compliance/waiver_spec.rb
index bbd2365fe1..e001e3a97d 100644
--- a/spec/unit/compliance/waiver_spec.rb
+++ b/spec/unit/compliance/waiver_spec.rb
@@ -64,8 +64,8 @@ describe Chef::Compliance::Waiver do
expect(waiver.enabled?).to eql(false)
end
- it "has a #for_inspec method that renders the data" do
- expect(waiver.for_inspec).to eql(data)
+ it "has a #inspec_data method that renders the data" do
+ expect(waiver.inspec_data).to eql(data)
end
it "doesn't render the events in the inspect output" do