mirror of
https://github.com/inspec/inspec
synced 2024-11-23 13:13:22 +00:00
Build fix
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
This commit is contained in:
parent
8e755063c5
commit
aeed833f2f
1 changed files with 5 additions and 7 deletions
|
@ -63,11 +63,11 @@ module Inspec
|
|||
|
||||
def control_tags(&block)
|
||||
tag_source = block.source.split("\n").select { |src| src.split.first.eql?("tag") }
|
||||
tag_source = tag_source.map { |src| src.sub("tag", "").strip }.map { |src| src.split(",").map { |final_src| final_src.gsub(/([^:]*):/, "") } }.flatten
|
||||
output = tag_source.map { |src| src.gsub(/\[|\]/, "") }.map { |src| instance_eval(src) }
|
||||
tag_source = tag_source.map { |src| src.sub("tag", "").strip }.map { |src| src.split(",").map { |final_src| final_src.sub(/([^:]*):/, "") } }.flatten
|
||||
output = tag_source.map { |src| src.sub(/\[|\]/, "") }.map { |src| instance_eval(src) }
|
||||
output.compact.uniq
|
||||
rescue => e
|
||||
raise "Unable to fetch control tags: #{e.class} -- #{e.message}"
|
||||
rescue
|
||||
[]
|
||||
end
|
||||
|
||||
# Describe allows users to write rspec-like bare describe
|
||||
|
@ -85,9 +85,7 @@ module Inspec
|
|||
res = describe(*args, &block)
|
||||
end
|
||||
|
||||
tag_ids = control_tags(&block)
|
||||
|
||||
if (controls_list_empty? && tags_list_empty?) || control_exist_in_controls_list?(id) || tag_exist_in_control_tags?(tag_ids)
|
||||
if controls_list_empty? || control_exist_in_controls_list?(id)
|
||||
register_control(rule, &block)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue