mirror of
https://github.com/inspec/inspec
synced 2024-11-23 05:03:07 +00:00
Modify inspec json
to use check_mode
(#2435)
This modifies `inspec json` to make it not evaluate code inside of `only_if` blocks. Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
This commit is contained in:
parent
c4d678a1df
commit
972f3a6486
2 changed files with 8 additions and 0 deletions
|
@ -36,6 +36,7 @@ class Inspec::InspecCLI < Inspec::BaseCLI
|
|||
o = opts.dup
|
||||
o[:ignore_supports] = true
|
||||
o[:backend] = Inspec::Backend.create(target: 'mock://')
|
||||
o[:check_mode] = true
|
||||
|
||||
profile = Inspec::Profile.for_target(target, o)
|
||||
dst = o[:output].to_s
|
||||
|
|
|
@ -121,4 +121,11 @@ describe 'inspec json' do
|
|||
out.exit_status.must_equal 0
|
||||
end
|
||||
end
|
||||
|
||||
describe 'inspec json with a profile containing only_if' do
|
||||
it 'ignores the `only_if`' do
|
||||
out = inspec('json ' + File.join(profile_path, 'only-if-os-nope'))
|
||||
out.exit_status.must_equal 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue