foreman_openscap 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/controllers/policies_controller.rb +8 -4
- data/app/models/concerns/foreman_openscap/host_extensions.rb +11 -7
- data/app/models/foreman_openscap/policy.rb +11 -9
- data/app/views/job_templates/run_openscap_scans.erb +1 -0
- data/app/views/policy_dashboard/_policy_reports.html.erb +1 -1
- data/lib/foreman_openscap/version.rb +1 -1
- data/locale/de/foreman_openscap.edit.po +1231 -0
- data/locale/de/foreman_openscap.po +3 -0
- data/locale/de/foreman_openscap.po.time_stamp +0 -0
- data/locale/en_GB/foreman_openscap.edit.po +1231 -0
- data/locale/en_GB/foreman_openscap.po +3 -0
- data/locale/en_GB/foreman_openscap.po.time_stamp +0 -0
- data/locale/es/foreman_openscap.edit.po +1231 -0
- data/locale/es/foreman_openscap.po +3 -0
- data/locale/es/foreman_openscap.po.time_stamp +0 -0
- data/locale/foreman_openscap.pot +82 -78
- data/locale/fr/foreman_openscap.edit.po +1231 -0
- data/locale/fr/foreman_openscap.po +3 -0
- data/locale/fr/foreman_openscap.po.time_stamp +0 -0
- data/locale/gl/foreman_openscap.edit.po +1231 -0
- data/locale/gl/foreman_openscap.po +3 -0
- data/locale/gl/foreman_openscap.po.time_stamp +0 -0
- data/locale/it/foreman_openscap.edit.po +1231 -0
- data/locale/it/foreman_openscap.po +3 -0
- data/locale/it/foreman_openscap.po.time_stamp +0 -0
- data/locale/ja/foreman_openscap.edit.po +1231 -0
- data/locale/ja/foreman_openscap.po +3 -0
- data/locale/ja/foreman_openscap.po.time_stamp +0 -0
- data/locale/ko/foreman_openscap.edit.po +1231 -0
- data/locale/ko/foreman_openscap.po +3 -0
- data/locale/ko/foreman_openscap.po.time_stamp +0 -0
- data/locale/pt_BR/foreman_openscap.edit.po +1231 -0
- data/locale/pt_BR/foreman_openscap.po +3 -0
- data/locale/pt_BR/foreman_openscap.po.time_stamp +0 -0
- data/locale/ru/foreman_openscap.edit.po +1232 -0
- data/locale/ru/foreman_openscap.po +3 -0
- data/locale/ru/foreman_openscap.po.time_stamp +0 -0
- data/locale/sv_SE/foreman_openscap.edit.po +1231 -0
- data/locale/sv_SE/foreman_openscap.po +3 -0
- data/locale/sv_SE/foreman_openscap.po.time_stamp +0 -0
- data/locale/zh_CN/foreman_openscap.edit.po +1231 -0
- data/locale/zh_CN/foreman_openscap.po +3 -0
- data/locale/zh_CN/foreman_openscap.po.time_stamp +0 -0
- data/locale/zh_TW/foreman_openscap.edit.po +1231 -0
- data/locale/zh_TW/foreman_openscap.po +3 -0
- data/locale/zh_TW/foreman_openscap.po.time_stamp +0 -0
- data/test/unit/arf_report_test.rb +21 -0
- data/test/unit/concerns/host_extensions_test.rb +8 -0
- data/test/unit/openscap_host_test.rb +14 -2
- data/test/unit/policy_test.rb +8 -0
- metadata +63 -38
@@ -888,6 +888,9 @@ msgstr ""
|
|
888
888
|
msgid "You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy."
|
889
889
|
msgstr ""
|
890
890
|
|
891
|
+
msgid "cannot assign to %s, all assigned policies must be deployed in the same way"
|
892
|
+
msgstr ""
|
893
|
+
|
891
894
|
msgid "documentation"
|
892
895
|
msgstr ""
|
893
896
|
|
File without changes
|
@@ -178,6 +178,27 @@ module ForemanOpenscap
|
|
178
178
|
assert_equal res, report_1
|
179
179
|
end
|
180
180
|
|
181
|
+
test 'should return same latest reports by scope and by association' do
|
182
|
+
reports = []
|
183
|
+
host = FactoryBot.create(:compliance_host)
|
184
|
+
policy = FactoryBot.create(:policy)
|
185
|
+
3.times do
|
186
|
+
reports << FactoryBot.create(:arf_report, :host_id => @host.id, :status => @status)
|
187
|
+
FactoryBot.create(:policy_arf_report, :arf_report_id => reports.last.id, :policy_id => @policy.id)
|
188
|
+
|
189
|
+
reports << FactoryBot.create(:arf_report, :host_id => host.id, :status => @status)
|
190
|
+
FactoryBot.create(:policy_arf_report, :arf_report_id => reports.last.id, :policy_id => @policy.id)
|
191
|
+
|
192
|
+
reports << FactoryBot.create(:arf_report, :host_id => @host.id, :status => @status)
|
193
|
+
FactoryBot.create(:policy_arf_report, :arf_report_id => reports.last.id, :policy_id => policy.id)
|
194
|
+
|
195
|
+
reports << FactoryBot.create(:arf_report, :host_id => host.id, :status => @status)
|
196
|
+
FactoryBot.create(:policy_arf_report, :arf_report_id => reports.last.id, :policy_id => policy.id)
|
197
|
+
end
|
198
|
+
|
199
|
+
assert_equal ForemanOpenscap::ArfReport.of_policy(policy).latest, policy.arf_reports.latest
|
200
|
+
end
|
201
|
+
|
181
202
|
private
|
182
203
|
|
183
204
|
def create_logs_for_report(report, log_params)
|
@@ -156,6 +156,14 @@ class HostExtensionsTest < ActiveSupport::TestCase
|
|
156
156
|
assert_empty not_removed
|
157
157
|
end
|
158
158
|
|
159
|
+
test "should not assign mismatched openscap proxy" do
|
160
|
+
host = FactoryBot.create(:compliance_host, :organization => taxonomies(:organization1), :location => taxonomies(:location1))
|
161
|
+
proxy = FactoryBot.create(:openscap_proxy, :organizations => [taxonomies(:organization2)])
|
162
|
+
host.openscap_proxy = proxy
|
163
|
+
refute host.valid?
|
164
|
+
assert_equal host.errors.full_messages.first, "Openscap proxy with id #{proxy.id} doesn't exist or is not assigned to proper organization and/or location"
|
165
|
+
end
|
166
|
+
|
159
167
|
private
|
160
168
|
|
161
169
|
def setup_hosts_with_policy
|
@@ -10,8 +10,8 @@ class OpenscapHostTest < ActiveSupport::TestCase
|
|
10
10
|
test 'Host has policy' do
|
11
11
|
host = FactoryBot.create(:host)
|
12
12
|
assert_empty(host.policies)
|
13
|
-
|
14
|
-
|
13
|
+
@policy.host_ids = [host.id]
|
14
|
+
@policy.save
|
15
15
|
assert_includes(host.policies, @policy)
|
16
16
|
end
|
17
17
|
|
@@ -44,10 +44,22 @@ class OpenscapHostTest < ActiveSupport::TestCase
|
|
44
44
|
end
|
45
45
|
|
46
46
|
test "reports for policy should return expected reports" do
|
47
|
+
@report_2.created_at += 10.minutes
|
48
|
+
@report_2.save!
|
47
49
|
reports = @host.reports_for_policy(@policy)
|
48
50
|
assert_equal 2, reports.count
|
49
51
|
assert reports.include?(@report_1)
|
50
52
|
assert reports.include?(@report_2)
|
53
|
+
# Ensure the last report list first
|
54
|
+
assert_equal @report_2, reports.first
|
55
|
+
end
|
56
|
+
|
57
|
+
test "last report for policy should return the latest report only" do
|
58
|
+
@report_2.created_at += 10.minutes
|
59
|
+
@report_2.save!
|
60
|
+
reports = @host.last_report_for_policy(@policy)
|
61
|
+
assert_equal 1, reports.count
|
62
|
+
assert_equal @report_2, reports.first
|
51
63
|
end
|
52
64
|
|
53
65
|
test 'scap_status_changed should detect status change' do
|
data/test/unit/policy_test.rb
CHANGED
@@ -244,4 +244,12 @@ class PolicyTest < ActiveSupport::TestCase
|
|
244
244
|
assert_empty ForemanOpenscap::PolicyArfReport.where(:id => policy_arf_report.id)
|
245
245
|
assert_empty ForemanOpenscap::ArfReport.where(:id => arf_report.id)
|
246
246
|
end
|
247
|
+
|
248
|
+
test "should not assign policies with diffrent deploy_by options to asset" do
|
249
|
+
host = FactoryBot.create(:compliance_host, :policies => [FactoryBot.create(:policy)])
|
250
|
+
puppet_policy = FactoryBot.create(:policy, :deploy_by => 'puppet')
|
251
|
+
puppet_policy.host_ids = [host.id]
|
252
|
+
refute puppet_policy.save
|
253
|
+
assert_equal "cannot assign to #{host.name}, all assigned policies must be deployed in the same way", puppet_policy.errors[:base].first
|
254
|
+
end
|
247
255
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_openscap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- slukasik@redhat.com
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -253,33 +253,59 @@ files:
|
|
253
253
|
- locale/Makefile
|
254
254
|
- locale/action_names.rb
|
255
255
|
- locale/de/LC_MESSAGES/foreman_openscap.mo
|
256
|
+
- locale/de/foreman_openscap.edit.po
|
256
257
|
- locale/de/foreman_openscap.po
|
258
|
+
- locale/de/foreman_openscap.po.time_stamp
|
257
259
|
- locale/en_GB/LC_MESSAGES/foreman_openscap.mo
|
260
|
+
- locale/en_GB/foreman_openscap.edit.po
|
258
261
|
- locale/en_GB/foreman_openscap.po
|
262
|
+
- locale/en_GB/foreman_openscap.po.time_stamp
|
259
263
|
- locale/es/LC_MESSAGES/foreman_openscap.mo
|
264
|
+
- locale/es/foreman_openscap.edit.po
|
260
265
|
- locale/es/foreman_openscap.po
|
266
|
+
- locale/es/foreman_openscap.po.time_stamp
|
261
267
|
- locale/foreman_openscap.pot
|
262
268
|
- locale/fr/LC_MESSAGES/foreman_openscap.mo
|
269
|
+
- locale/fr/foreman_openscap.edit.po
|
263
270
|
- locale/fr/foreman_openscap.po
|
271
|
+
- locale/fr/foreman_openscap.po.time_stamp
|
264
272
|
- locale/gl/LC_MESSAGES/foreman_openscap.mo
|
273
|
+
- locale/gl/foreman_openscap.edit.po
|
265
274
|
- locale/gl/foreman_openscap.po
|
275
|
+
- locale/gl/foreman_openscap.po.time_stamp
|
266
276
|
- locale/it/LC_MESSAGES/foreman_openscap.mo
|
277
|
+
- locale/it/foreman_openscap.edit.po
|
267
278
|
- locale/it/foreman_openscap.po
|
279
|
+
- locale/it/foreman_openscap.po.time_stamp
|
268
280
|
- locale/ja/LC_MESSAGES/foreman_openscap.mo
|
281
|
+
- locale/ja/foreman_openscap.edit.po
|
269
282
|
- locale/ja/foreman_openscap.po
|
283
|
+
- locale/ja/foreman_openscap.po.time_stamp
|
270
284
|
- locale/ko/LC_MESSAGES/foreman_openscap.mo
|
285
|
+
- locale/ko/foreman_openscap.edit.po
|
271
286
|
- locale/ko/foreman_openscap.po
|
287
|
+
- locale/ko/foreman_openscap.po.time_stamp
|
272
288
|
- locale/pt_BR/LC_MESSAGES/foreman_openscap.mo
|
289
|
+
- locale/pt_BR/foreman_openscap.edit.po
|
273
290
|
- locale/pt_BR/foreman_openscap.po
|
291
|
+
- locale/pt_BR/foreman_openscap.po.time_stamp
|
274
292
|
- locale/ru/LC_MESSAGES/foreman_openscap.mo
|
293
|
+
- locale/ru/foreman_openscap.edit.po
|
275
294
|
- locale/ru/foreman_openscap.po
|
295
|
+
- locale/ru/foreman_openscap.po.time_stamp
|
276
296
|
- locale/sv_SE/LC_MESSAGES/foreman_openscap.mo
|
297
|
+
- locale/sv_SE/foreman_openscap.edit.po
|
277
298
|
- locale/sv_SE/foreman_openscap.po
|
299
|
+
- locale/sv_SE/foreman_openscap.po.time_stamp
|
278
300
|
- locale/zanata.xml
|
279
301
|
- locale/zh_CN/LC_MESSAGES/foreman_openscap.mo
|
302
|
+
- locale/zh_CN/foreman_openscap.edit.po
|
280
303
|
- locale/zh_CN/foreman_openscap.po
|
304
|
+
- locale/zh_CN/foreman_openscap.po.time_stamp
|
281
305
|
- locale/zh_TW/LC_MESSAGES/foreman_openscap.mo
|
306
|
+
- locale/zh_TW/foreman_openscap.edit.po
|
282
307
|
- locale/zh_TW/foreman_openscap.po
|
308
|
+
- locale/zh_TW/foreman_openscap.po.time_stamp
|
283
309
|
- test/factories/arf_report_factory.rb
|
284
310
|
- test/factories/asset_factory.rb
|
285
311
|
- test/factories/compliance_host_factory.rb
|
@@ -340,50 +366,49 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
340
366
|
- !ruby/object:Gem::Version
|
341
367
|
version: '0'
|
342
368
|
requirements: []
|
343
|
-
|
344
|
-
rubygems_version: 2.6.14
|
369
|
+
rubygems_version: 3.0.3
|
345
370
|
signing_key:
|
346
371
|
specification_version: 4
|
347
372
|
summary: Foreman plug-in for displaying OpenSCAP audit reports
|
348
373
|
test_files:
|
349
|
-
- test/
|
374
|
+
- test/lib/foreman_openscap/bulk_upload_test.rb
|
375
|
+
- test/unit/message_cleaner_test.rb
|
376
|
+
- test/unit/scap_content_test.rb
|
377
|
+
- test/unit/concerns/openscap_proxy_extenstions_test.rb
|
378
|
+
- test/unit/concerns/host_extensions_test.rb
|
379
|
+
- test/unit/openscap_host_test.rb
|
380
|
+
- test/unit/tailoring_file_test.rb
|
381
|
+
- test/unit/policy_test.rb
|
382
|
+
- test/unit/compliance_status_test.rb
|
383
|
+
- test/unit/arf_report_status_calculator_test.rb
|
384
|
+
- test/unit/policy_mailer_test.rb
|
385
|
+
- test/unit/services/tailoring_files_proxy_check_test.rb
|
386
|
+
- test/unit/services/hostgroup_overrider_test.rb
|
387
|
+
- test/unit/services/report_dashboard/data_test.rb
|
388
|
+
- test/unit/services/lookup_key_overrider_test.rb
|
389
|
+
- test/unit/services/config_name_service_test.rb
|
390
|
+
- test/unit/arf_report_test.rb
|
391
|
+
- test/test_plugin_helper.rb
|
392
|
+
- test/functional/arf_reports_controller_test.rb
|
393
|
+
- test/functional/api/v2/hosts_controller_test.rb
|
394
|
+
- test/functional/api/v2/compliance/arf_reports_controller_test.rb
|
395
|
+
- test/functional/api/v2/compliance/scap_contents_controller_test.rb
|
396
|
+
- test/functional/api/v2/compliance/policies_controller_test.rb
|
397
|
+
- test/functional/api/v2/compliance/tailoring_files_controller_test.rb
|
398
|
+
- test/functional/openscap_proxies_controller_test.rb
|
399
|
+
- test/functional/tailoring_files_controller_test.rb
|
350
400
|
- test/factories/asset_factory.rb
|
351
|
-
- test/factories/compliance_host_factory.rb
|
352
401
|
- test/factories/compliance_log_factory.rb
|
402
|
+
- test/factories/arf_report_factory.rb
|
403
|
+
- test/factories/scap_content_related.rb
|
404
|
+
- test/factories/compliance_host_factory.rb
|
353
405
|
- test/factories/policy_arf_report_factory.rb
|
354
406
|
- test/factories/policy_factory.rb
|
355
|
-
- test/factories/scap_content_related.rb
|
356
|
-
- test/files/arf_report/arf_report.bz2
|
357
|
-
- test/files/arf_report/arf_report.html
|
358
|
-
- test/files/arf_report/arf_report.json
|
359
|
-
- test/files/arf_report/arf_report_msg_desc_changed.json
|
360
|
-
- test/files/arf_report/arf_report_msg_value_changed.json
|
361
407
|
- test/files/scap_contents/ssg-fedora-ds.xml
|
362
408
|
- test/files/tailoring_files/ssg-firefox-ds-tailoring-2.xml
|
363
409
|
- test/files/tailoring_files/ssg-firefox-ds-tailoring.xml
|
364
|
-
- test/
|
365
|
-
- test/
|
366
|
-
- test/
|
367
|
-
- test/
|
368
|
-
- test/
|
369
|
-
- test/functional/arf_reports_controller_test.rb
|
370
|
-
- test/functional/openscap_proxies_controller_test.rb
|
371
|
-
- test/functional/tailoring_files_controller_test.rb
|
372
|
-
- test/lib/foreman_openscap/bulk_upload_test.rb
|
373
|
-
- test/test_plugin_helper.rb
|
374
|
-
- test/unit/arf_report_status_calculator_test.rb
|
375
|
-
- test/unit/arf_report_test.rb
|
376
|
-
- test/unit/compliance_status_test.rb
|
377
|
-
- test/unit/concerns/host_extensions_test.rb
|
378
|
-
- test/unit/concerns/openscap_proxy_extenstions_test.rb
|
379
|
-
- test/unit/message_cleaner_test.rb
|
380
|
-
- test/unit/openscap_host_test.rb
|
381
|
-
- test/unit/policy_mailer_test.rb
|
382
|
-
- test/unit/policy_test.rb
|
383
|
-
- test/unit/scap_content_test.rb
|
384
|
-
- test/unit/services/config_name_service_test.rb
|
385
|
-
- test/unit/services/hostgroup_overrider_test.rb
|
386
|
-
- test/unit/services/lookup_key_overrider_test.rb
|
387
|
-
- test/unit/services/report_dashboard/data_test.rb
|
388
|
-
- test/unit/services/tailoring_files_proxy_check_test.rb
|
389
|
-
- test/unit/tailoring_file_test.rb
|
410
|
+
- test/files/arf_report/arf_report_msg_value_changed.json
|
411
|
+
- test/files/arf_report/arf_report.bz2
|
412
|
+
- test/files/arf_report/arf_report_msg_desc_changed.json
|
413
|
+
- test/files/arf_report/arf_report.json
|
414
|
+
- test/files/arf_report/arf_report.html
|