inspec-core 4.20.10 → 4.22.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -0
  3. data/inspec-core.gemspec +1 -1
  4. data/lib/inspec/base_cli.rb +1 -1
  5. data/lib/inspec/exceptions.rb +1 -0
  6. data/lib/inspec/input_registry.rb +2 -1
  7. data/lib/inspec/metadata.rb +6 -1
  8. data/lib/inspec/plugin/v2/plugin_types/reporter.rb +11 -5
  9. data/lib/inspec/profile.rb +30 -9
  10. data/lib/inspec/reporters/base.rb +11 -5
  11. data/lib/inspec/reporters/cli.rb +1 -0
  12. data/lib/inspec/reporters/json.rb +9 -4
  13. data/lib/inspec/resources/apt.rb +2 -0
  14. data/lib/inspec/resources/interface.rb +55 -0
  15. data/lib/inspec/resources/interfaces.rb +119 -0
  16. data/lib/inspec/resources/mount.rb +1 -1
  17. data/lib/inspec/resources/mysql_session.rb +26 -7
  18. data/lib/inspec/resources/postgres_session.rb +1 -1
  19. data/lib/inspec/resources/service.rb +2 -2
  20. data/lib/inspec/resources/users.rb +1 -1
  21. data/lib/inspec/run_data.rb +1 -1
  22. data/lib/inspec/run_data/profile.rb +4 -4
  23. data/lib/inspec/runner.rb +8 -2
  24. data/lib/inspec/runner_rspec.rb +4 -1
  25. data/lib/inspec/schema.rb +2 -0
  26. data/lib/inspec/schema/exec_json.rb +4 -3
  27. data/lib/inspec/schema/primitives.rb +1 -1
  28. data/lib/inspec/version.rb +1 -1
  29. data/lib/plugins/inspec-reporter-html2/README.md +53 -0
  30. data/lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2.rb +18 -0
  31. data/lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb +24 -0
  32. data/lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/version.rb +8 -0
  33. data/lib/plugins/inspec-reporter-html2/templates/body.html.erb +46 -0
  34. data/lib/plugins/inspec-reporter-html2/templates/control.html.erb +77 -0
  35. data/lib/plugins/inspec-reporter-html2/templates/default.css +107 -0
  36. data/lib/plugins/inspec-reporter-html2/templates/default.js +79 -0
  37. data/lib/plugins/inspec-reporter-html2/templates/profile.html.erb +23 -0
  38. data/lib/plugins/inspec-reporter-html2/templates/result.html.erb +15 -0
  39. data/lib/plugins/inspec-reporter-html2/templates/selector.html.erb +8 -0
  40. metadata +22 -4
@@ -0,0 +1,107 @@
1
+ body {
2
+ margin: 20px 10% 20px 10%;
3
+ padding: 0;
4
+ background: #fff;
5
+ }
6
+ h1, h2, h3, h4, h5 {
7
+ font-family: "Lucida Grande", Helvetica, sans-serif;
8
+ }
9
+ h1, h2 {
10
+ padding: 10px;
11
+ text-align: center
12
+ }
13
+ table.info th, table.info th {
14
+ padding: 2px;
15
+ }
16
+ table.info th {
17
+ text-align: right;
18
+ }
19
+ .hidden {
20
+ display: none;
21
+ }
22
+ pre code {
23
+ background-color: #eee;
24
+ border: 1px solid #999;
25
+ display: block;
26
+ padding: 20px;
27
+ }
28
+
29
+ .profile, .control, .profile-metadata {
30
+ border: 1px solid #ccc;
31
+ padding: 10px;
32
+ margin: 5px auto;
33
+ }
34
+
35
+ .resource-title {
36
+ margin-left: 2.5%;
37
+ }
38
+
39
+ .control-title code,
40
+ .resource-title code {
41
+ font-size: larger;
42
+ }
43
+ .control-metadata .status div,
44
+ .result-metadata .status div {
45
+ color: white;
46
+ font-weight: bold;
47
+ width: fit-content;
48
+ padding: 0px 2px;
49
+ }
50
+
51
+ .control-metadata .status-passed div,
52
+ .result-metadata .status-passed div {
53
+ background-color: darkgreen;
54
+ }
55
+ .control-metadata .status-failed div,
56
+ .result-metadata .status-failed div {
57
+ background-color: red;
58
+ }
59
+ .control-metadata .status-skipped div,
60
+ .result-metadata .status-skipped div {
61
+ background-color: grey;
62
+ }
63
+ .result-metadata,
64
+ .control-metadata {
65
+ margin: 0 0 0 5%;
66
+ }
67
+
68
+ .selector-panel {
69
+ position: fixed;
70
+ z-index: 100;
71
+ background-color: #ccc;
72
+ padding: 10px;
73
+ top: 0;
74
+ margin-left: -10%;
75
+ border-bottom-right-radius: 10px;
76
+ }
77
+
78
+ @media print {
79
+ .selector-panel {
80
+ visibility: hidden;
81
+ }
82
+ }
83
+
84
+ .inspec-summary {
85
+ border: 1px solid #ccc;
86
+ padding: 10px;
87
+ margin: 5px auto;
88
+ width: fit-content
89
+ }
90
+
91
+ .inspec-summary h4 {
92
+ margin-bottom: 0px;
93
+ }
94
+
95
+ .inspec-summary #platform, .inspec-summary #statistics {
96
+ display: inline;
97
+ }
98
+
99
+ #statistics .date td {
100
+ width: 100px
101
+ }
102
+
103
+ #inspec-version {
104
+ display: block;
105
+ text-align: center;
106
+ font-style: italic;
107
+ }
@@ -0,0 +1,79 @@
1
+
2
+ /* CSS primitives */
3
+ function addCssClass(id, cls) {
4
+ document.getElementById(id).className += (" " + cls);
5
+ }
6
+
7
+ function removeCssClass(id, cls) {
8
+ var el = document.getElementById(id);
9
+ var classes = el.className.replace(cls,'');
10
+ el.className = classes;
11
+ }
12
+
13
+ function handleShowSource(evt) {
14
+ var control_id = evt.srcElement.id.replace("show-code-", "")
15
+ addCssClass(evt.srcElement.id, "hidden")
16
+ removeCssClass("hide-code-" + control_id, "hidden")
17
+ removeCssClass("source-code-" + control_id, "hidden")
18
+ }
19
+
20
+ function handleHideSource(evt) {
21
+ var control_id = evt.srcElement.id.replace("hide-code-", "")
22
+ addCssClass(evt.srcElement.id, "hidden")
23
+ addCssClass("source-code-" + control_id, "hidden")
24
+ removeCssClass("show-code-" + control_id, "hidden")
25
+ }
26
+
27
+ function handleSelectorChange(evt) {
28
+ var should_show = evt.srcElement.checked
29
+ var which_group = evt.srcElement.id.replace("-checkbox","")
30
+ var controls = document.getElementsByClassName("control-status-" + which_group)
31
+ var i;
32
+ if (should_show) {
33
+ for (i = 0; i < controls.length; i++) {
34
+ removeCssClass(controls[i].id, "hidden")
35
+ }
36
+ } else {
37
+ for (i = 0; i < controls.length; i++) {
38
+ addCssClass(controls[i].id, "hidden")
39
+ }
40
+ }
41
+ }
42
+
43
+ function handleChildProfileChange(evt) {
44
+ var should_show = evt.srcElement.checked
45
+ var child_profiles = document.getElementsByClassName("child-profile")
46
+ var i;
47
+ if (should_show) {
48
+ for (i = 0; i < child_profiles.length; i++) {
49
+ removeCssClass(child_profiles[i].id, "hidden")
50
+ }
51
+ } else {
52
+ for (i = 0; i < child_profiles.length; i++) {
53
+ addCssClass(child_profiles[i].id, "hidden")
54
+ }
55
+ }
56
+ }
57
+
58
+ /* Main entry point */
59
+ function pageLoaded() {
60
+ var i;
61
+
62
+ // wire up show source links
63
+ var show_links = document.getElementsByClassName("show-source-code");
64
+ for (i = 0; i < show_links.length; i++) {
65
+ show_links[i].onclick = handleShowSource;
66
+ }
67
+ // wire up hide source links
68
+ var hide_links = document.getElementsByClassName("hide-source-code");
69
+ for (i = 0; i < hide_links.length; i++) {
70
+ hide_links[i].onclick = handleHideSource;
71
+ }
72
+ // wire up selector checkboxes
73
+ var selectors = document.getElementsByClassName("selector-checkbox");
74
+ for (i = 0; i < selectors.length; i++) {
75
+ selectors[i].onchange = handleSelectorChange;
76
+ }
77
+ // wire up child profile checkbox
78
+ document.getElementById("child-profile-checkbox").onchange = handleChildProfileChange;
79
+ }
@@ -0,0 +1,23 @@
1
+ <div class="profile <%= profile.parent_profile ? "child-profile hidden" : "" %>" id="profile-<%= profile.name %>">
2
+ <% display_name = profile.title || profile.name %>
3
+ <h2 class="profile_title">Profile <%= display_name %> (<%= profile.name %>)</h2>
4
+
5
+ <table class="profile-metadata info" id="profile-metadata-<%= profile.name %>">
6
+ <tr class="profile-version"><th>Version:</th><td><%= profile.version %></td></tr>
7
+ <% if profile.summary %>
8
+ <tr class="profile-summary"><th>Summary:</th><td><%= profile.summary %></td></tr>
9
+ <% end %>
10
+ <% if profile.status != "loaded" %>
11
+ <tr class="profile-status"><th>Status:</th><td><%= profile.status %></td></tr>
12
+ <% end %>
13
+ <% if profile.status_message && !profile.status_message.empty? %>
14
+ <tr class="profile-status-message"><th>Status Message:</th><td><%= profile.status_message %></td></tr>
15
+ <% end %>
16
+ </table>
17
+
18
+ <% if profile.status == "loaded" %>
19
+ <% profile.controls.each do |control| %>
20
+ <%= ERB.new(File.read(template_path + "/control.html.erb"), nil, nil, "_ctl").result(binding) %>
21
+ <% end %>
22
+ <% end %>
23
+ </div>
@@ -0,0 +1,15 @@
1
+ <% slugged_id = result.resource_title.to_s.gsub(/\W/, "_") %>
2
+ <div class="result" id="result-<%= slugged_id %>">
3
+ <h4 class="resource-title">Resource <code><%= result.resource_title.to_s %></code></h4>
4
+ <table class="result-metadata info">
5
+ <tr class="expectation_message"><th>Test:</th><td><code><%= result.expectation_message %></code></td></tr>
6
+ <tr class="status status-<%= result.status %>"><th>Status:</th><td><div><%= result.status.capitalize %></div></td></tr>
7
+ <% if result.status == "failed" %>
8
+ <tr class="fail_message"><th>Failure Message:</th><td><code><%= result.message %></code></td></tr>
9
+ <% end %>
10
+ <% if result.status == "skipped" %>
11
+ <tr class="skip_message"><th>Skip Message:</th><td><%= result.skip_message %></td></tr>
12
+ <% end %>
13
+ <tr class="duration"><th>Duration:</th><td><%= result.run_time %> seconds</td></tr>
14
+ </table>
15
+ </div>
@@ -0,0 +1,8 @@
1
+ <div class="selector-panel">
2
+ <p id="selector-instructions">Display controls that are:</p>
3
+ <input class="selector-checkbox" id="passed-checkbox" type="checkbox" checked="checked"/><label for="passed-checkbox">Passed</label>
4
+ <input class="selector-checkbox" id="skipped-checkbox" type="checkbox" checked="checked"/><label for="skipped-checkbox">Skipped</label>
5
+ <input class="selector-checkbox" id="failed-checkbox" type="checkbox" checked="checked"/><label for="failed-checkbox">Failed</label>
6
+ <p id="selector-instructions">Display profiles that are:</p>
7
+ <input class="profile-selector-checkbox" id="child-profile-checkbox" type="checkbox" /><label for="child-profile-checkbox">Dependent Profiles</label>
8
+ </div>
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: 4.20.10
4
+ version: 4.22.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chef InSpec Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-18 00:00:00.000000000 Z
11
+ date: 2020-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-telemetry
@@ -68,16 +68,22 @@ dependencies:
68
68
  name: json_schemer
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - "~>"
71
+ - - ">="
72
72
  - !ruby/object:Gem::Version
73
73
  version: 0.2.1
74
+ - - "<"
75
+ - !ruby/object:Gem::Version
76
+ version: 0.2.12
74
77
  type: :runtime
75
78
  prerelease: false
76
79
  version_requirements: !ruby/object:Gem::Requirement
77
80
  requirements:
78
- - - "~>"
81
+ - - ">="
79
82
  - !ruby/object:Gem::Version
80
83
  version: 0.2.1
84
+ - - "<"
85
+ - !ruby/object:Gem::Version
86
+ version: 0.2.12
81
87
  - !ruby/object:Gem::Dependency
82
88
  name: method_source
83
89
  requirement: !ruby/object:Gem::Requirement
@@ -536,6 +542,7 @@ files:
536
542
  - lib/inspec/resources/inetd_conf.rb
537
543
  - lib/inspec/resources/ini.rb
538
544
  - lib/inspec/resources/interface.rb
545
+ - lib/inspec/resources/interfaces.rb
539
546
  - lib/inspec/resources/ip6tables.rb
540
547
  - lib/inspec/resources/iptables.rb
541
548
  - lib/inspec/resources/json.rb
@@ -724,6 +731,17 @@ files:
724
731
  - lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli.rb
725
732
  - lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb
726
733
  - lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/plugin.rb
734
+ - lib/plugins/inspec-reporter-html2/README.md
735
+ - lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2.rb
736
+ - lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/reporter.rb
737
+ - lib/plugins/inspec-reporter-html2/lib/inspec-reporter-html2/version.rb
738
+ - lib/plugins/inspec-reporter-html2/templates/body.html.erb
739
+ - lib/plugins/inspec-reporter-html2/templates/control.html.erb
740
+ - lib/plugins/inspec-reporter-html2/templates/default.css
741
+ - lib/plugins/inspec-reporter-html2/templates/default.js
742
+ - lib/plugins/inspec-reporter-html2/templates/profile.html.erb
743
+ - lib/plugins/inspec-reporter-html2/templates/result.html.erb
744
+ - lib/plugins/inspec-reporter-html2/templates/selector.html.erb
727
745
  - lib/plugins/inspec-reporter-json-min/README.md
728
746
  - lib/plugins/inspec-reporter-json-min/lib/inspec-reporter-json-min.rb
729
747
  - lib/plugins/inspec-reporter-json-min/lib/inspec-reporter-json-min/reporter.rb