mirror of
https://github.com/inspec/inspec
synced 2024-11-15 09:27:20 +00:00
Merge pull request #1792 from chef/dr/platform-info
add platform info to json formatter
This commit is contained in:
commit
ac5eb7a5e0
2 changed files with 19 additions and 0 deletions
|
@ -114,6 +114,10 @@ class InspecRspecJson < InspecRspecMiniJson # rubocop:disable Metrics/ClassLengt
|
|||
|
||||
@output_hash[:other_checks] = examples_without_controls
|
||||
@output_hash[:profiles] = profiles_info
|
||||
@output_hash[:platform] = {
|
||||
name: os(:name),
|
||||
release: os(:release),
|
||||
}
|
||||
|
||||
examples_with_controls.each do |example|
|
||||
control = example2control(example)
|
||||
|
@ -123,6 +127,11 @@ class InspecRspecJson < InspecRspecMiniJson # rubocop:disable Metrics/ClassLengt
|
|||
|
||||
private
|
||||
|
||||
def os(field)
|
||||
return nil if @backend.nil?
|
||||
@backend.os.params[field]
|
||||
end
|
||||
|
||||
def all_unique_controls
|
||||
Array(@all_controls).uniq
|
||||
end
|
||||
|
|
|
@ -11,6 +11,15 @@ module Inspec
|
|||
},
|
||||
}.freeze
|
||||
|
||||
PLATFORM = {
|
||||
'type' => 'object',
|
||||
'additionalProperties' => false,
|
||||
'properties' => {
|
||||
'name' => { 'type' => 'string' },
|
||||
'release' => { 'type' => 'string' },
|
||||
},
|
||||
}.freeze
|
||||
|
||||
# Tags are open right, with simple key-value associations and not restrictions
|
||||
TAGS = { 'type' => 'object' }.freeze
|
||||
|
||||
|
@ -117,6 +126,7 @@ module Inspec
|
|||
'type' => 'object',
|
||||
'additionalProperties' => false,
|
||||
'properties' => {
|
||||
'platform' => PLATFORM,
|
||||
'profiles' => {
|
||||
'type' => 'array',
|
||||
'items' => PROFILE,
|
||||
|
|
Loading…
Reference in a new issue