mirror of
https://github.com/inspec/inspec
synced 2024-11-10 07:04:15 +00:00
feature: only_if for profiles added
Signed-off-by: Dominik Richter <dominik@vulcanosec.com>
This commit is contained in:
parent
cceefa54cf
commit
5d5b945933
1 changed files with 6 additions and 0 deletions
|
@ -27,6 +27,7 @@ end
|
|||
|
||||
module Vulcano::DSL
|
||||
def rule id, opts = {}, &block
|
||||
return if @skip_profile
|
||||
__register_rule Vulcano::Rule.new(id, opts, &block)
|
||||
end
|
||||
|
||||
|
@ -34,6 +35,11 @@ module Vulcano::DSL
|
|||
__unregister_rule id
|
||||
end
|
||||
|
||||
def only_if &block
|
||||
return unless block_given?
|
||||
@skip_profile = !block.()
|
||||
end
|
||||
|
||||
def require_rules id, &block
|
||||
::Vulcano::DSL.load_spec_files_for_profile self, id, false, &block
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue