inspec-core 2.2.54 → 2.2.55

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c90f578944eb5f074ecc0d5c8e8f00f1ac97041e8934eab84d891a20cd693707
4
- data.tar.gz: 7dde3fb25a43ac5cc3e78afd619e299dfc2195e91135fa6bf5475db9c844a258
3
+ metadata.gz: 886615c61697bb4428e1a496b349a0ac39a1732142f66cc741d3e6c7339b649f
4
+ data.tar.gz: eb06d665de5738d4cab5719b91e745fc525935af52b3c1023c559ed62d45f063
5
5
  SHA512:
6
- metadata.gz: 274a064b7010424eb43996dcd96a6e480cb71b4f70d36bfcb591f83f030bd2bff8baa234184b5083d9360e485e730f647b6512e922e25936af0bd7932d672673
7
- data.tar.gz: 59b16dbb6935455c531485d442b3e7c723bd5a7bdf9462dcafec98454486ff97bc6e54ab35576bf5b5be80c7435dc136a9e3765c098e9b1b69cf8225c8c043c4
6
+ metadata.gz: 835a4b160e5d33ec1ac6bf2ff31ab895b3c6d1f8837458bb631b8abfaa1b741cb14f6e5688b6c211b152c83efc87c633e3a88d13eb75eb99892bfc61aa1cad80
7
+ data.tar.gz: cbd8f787e418ac09fac7b36312e979c5fedda71aaf1254bd59be2fb5ff091d3168b393a38b2e0ae22215926eff431fbf283c961beeff25e6395685ec55c75344
@@ -1,25 +1,31 @@
1
1
  # Change Log
2
2
  <!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
3
- <!-- latest_release 2.2.54 -->
4
- ## [v2.2.54](https://github.com/inspec/inspec/tree/v2.2.54) (2018-08-02)
3
+ <!-- latest_release 2.2.55 -->
4
+ ## [v2.2.55](https://github.com/inspec/inspec/tree/v2.2.55) (2018-08-03)
5
5
 
6
6
  #### Enhancements
7
- - Escaping package names for windows packages [#3259](https://github.com/inspec/inspec/pull/3259) ([frezbo](https://github.com/frezbo))
7
+ - Add a merged json report for A2 [#3261](https://github.com/inspec/inspec/pull/3261) ([jquick](https://github.com/jquick))
8
8
  <!-- latest_release -->
9
9
 
10
- <!-- release_rollup since=2.2.50 -->
11
- ### Changes since 2.2.50 release
10
+ <!-- release_rollup since=2.2.54 -->
11
+ ### Changes since 2.2.54 release
12
12
 
13
13
  #### Enhancements
14
- - Escaping package names for windows packages [#3259](https://github.com/inspec/inspec/pull/3259) ([frezbo](https://github.com/frezbo)) <!-- 2.2.54 -->
15
- - Populate report code for merged controls [#3264](https://github.com/inspec/inspec/pull/3264) ([jquick](https://github.com/jquick)) <!-- 2.2.53 -->
16
- - Bump the chef client version for tests. [#3260](https://github.com/inspec/inspec/pull/3260) ([jquick](https://github.com/jquick)) <!-- 2.2.52 -->
17
-
18
- #### Merged Pull Requests
19
- - Ability to render contrib resource pack docs on main website [#3184](https://github.com/inspec/inspec/pull/3184) ([clintoncwolfe](https://github.com/clintoncwolfe)) <!-- 2.2.51 -->
14
+ - Add a merged json report for A2 [#3261](https://github.com/inspec/inspec/pull/3261) ([jquick](https://github.com/jquick)) <!-- 2.2.55 -->
20
15
  <!-- release_rollup -->
21
16
 
22
17
  <!-- latest_stable_release -->
18
+ ## [v2.2.54](https://github.com/inspec/inspec/tree/v2.2.54) (2018-08-02)
19
+
20
+ #### Enhancements
21
+ - Bump the chef client version for tests. [#3260](https://github.com/inspec/inspec/pull/3260) ([jquick](https://github.com/jquick))
22
+ - Populate report code for merged controls [#3264](https://github.com/inspec/inspec/pull/3264) ([jquick](https://github.com/jquick))
23
+ - Escaping package names for windows packages [#3259](https://github.com/inspec/inspec/pull/3259) ([frezbo](https://github.com/frezbo))
24
+
25
+ #### Merged Pull Requests
26
+ - Ability to render contrib resource pack docs on main website [#3184](https://github.com/inspec/inspec/pull/3184) ([clintoncwolfe](https://github.com/clintoncwolfe))
27
+ <!-- latest_stable_release -->
28
+
23
29
  ## [v2.2.50](https://github.com/inspec/inspec/tree/v2.2.50) (2018-07-26)
24
30
 
25
31
  #### New Features
@@ -36,7 +42,6 @@
36
42
  - cli: Downcase supermarket tool name to match URL [#3242](https://github.com/inspec/inspec/pull/3242) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
37
43
  - Satisfy RuboCop by adding `x` bit to `bin/inspec` [#3249](https://github.com/inspec/inspec/pull/3249) ([jerryaldrichiii](https://github.com/jerryaldrichiii))
38
44
  - Fix for profile version not being included in the compliance upload c… [#3252](https://github.com/inspec/inspec/pull/3252) ([devoptimist](https://github.com/devoptimist))
39
- <!-- latest_stable_release -->
40
45
 
41
46
  ## [v2.2.41](https://github.com/inspec/inspec/tree/v2.2.41) (2018-07-20)
42
47
 
@@ -1,6 +1,7 @@
1
1
  require 'inspec/reporters/base'
2
2
  require 'inspec/reporters/cli'
3
3
  require 'inspec/reporters/json'
4
+ require 'inspec/reporters/json_merged'
4
5
  require 'inspec/reporters/json_min'
5
6
  require 'inspec/reporters/junit'
6
7
  require 'inspec/reporters/automate'
@@ -4,7 +4,7 @@ require 'json'
4
4
  require 'net/http'
5
5
 
6
6
  module Inspec::Reporters
7
- class Automate < Json
7
+ class Automate < JsonMerged
8
8
  def initialize(config)
9
9
  super(config)
10
10
 
@@ -17,7 +17,7 @@ module Inspec::Reporters
17
17
 
18
18
  def enriched_report
19
19
  # grab the report from the parent class
20
- final_report = report
20
+ final_report = report_merged
21
21
 
22
22
  # Label this content as an inspec_report
23
23
  final_report[:type] = 'inspec_report'
@@ -0,0 +1,73 @@
1
+ # encoding: utf-8
2
+
3
+ require 'json'
4
+
5
+ module Inspec::Reporters
6
+ class JsonMerged < Json
7
+ def initialize(config)
8
+ super(config)
9
+ @profiles = []
10
+ end
11
+
12
+ def render
13
+ output(report_merged.to_json, false)
14
+ end
15
+
16
+ def report_merged
17
+ # grab profiles from the json parent class
18
+ @profiles = report[:profiles]
19
+
20
+ {
21
+ platform: platform,
22
+ profiles: merge_profiles,
23
+ statistics: {
24
+ duration: run_data[:statistics][:duration],
25
+ },
26
+ version: run_data[:version],
27
+ }
28
+ end
29
+
30
+ private
31
+
32
+ def merge_profiles
33
+ @profiles.each do |profile|
34
+ next unless profile.key?(:parent_profile)
35
+ parent_profile = find_master_parent(profile)
36
+ merge_controls(parent_profile, profile)
37
+ merge_depends(parent_profile, profile)
38
+ end
39
+
40
+ # delete child profiles
41
+ @profiles.delete_if { |p| p.key?(:parent_profile) }
42
+
43
+ @profiles
44
+ end
45
+
46
+ def find_master_parent(profile)
47
+ return profile unless profile.key?(:parent_profile)
48
+
49
+ parent_profile = @profiles.select { |parent| parent[:name] == profile[:parent_profile] }.first
50
+ find_master_parent(parent_profile)
51
+ end
52
+
53
+ def merge_controls(parent, child)
54
+ parent[:controls].each do |control|
55
+ child_control = child[:controls].select { |c| c[:id] == control[:id] }.first
56
+ next if child_control.nil?
57
+
58
+ control.each do |name, _value|
59
+ child_value = child_control[name]
60
+ next if child_value.nil? || (child_value.respond_to?(:empty?) && child_value.empty?)
61
+ control[name] = child_value
62
+ end
63
+ end
64
+ end
65
+
66
+ def merge_depends(parent, child)
67
+ return unless child.key?(:depends)
68
+ child[:depends].each do |d|
69
+ parent[:depends] << d
70
+ end
71
+ end
72
+ end
73
+ end
@@ -4,5 +4,5 @@
4
4
  # author: Christoph Hartmann
5
5
 
6
6
  module Inspec
7
- VERSION = '2.2.54'
7
+ VERSION = '2.2.55'
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inspec-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.54
4
+ version: 2.2.55
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Richter
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-02 00:00:00.000000000 Z
11
+ date: 2018-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: train-core
@@ -562,6 +562,7 @@ files:
562
562
  - lib/inspec/reporters/base.rb
563
563
  - lib/inspec/reporters/cli.rb
564
564
  - lib/inspec/reporters/json.rb
565
+ - lib/inspec/reporters/json_merged.rb
565
566
  - lib/inspec/reporters/json_min.rb
566
567
  - lib/inspec/reporters/junit.rb
567
568
  - lib/inspec/reporters/yaml.rb