foreman_openscap 2.0.2 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +5 -5
  2. data/app/controllers/api/v2/compliance/arf_reports_controller.rb +5 -3
  3. data/app/controllers/api/v2/compliance/scap_content_profiles_controller.rb +15 -0
  4. data/app/controllers/api/v2/compliance/scap_contents_controller.rb +1 -1
  5. data/app/controllers/api/v2/compliance/tailoring_files_controller.rb +1 -1
  6. data/app/controllers/scap_contents_controller.rb +1 -1
  7. data/app/controllers/tailoring_files_controller.rb +1 -1
  8. data/app/models/concerns/foreman_openscap/smart_proxy_extensions.rb +1 -1
  9. data/app/models/foreman_openscap/policy.rb +2 -2
  10. data/app/models/foreman_openscap/scap_content_profile.rb +3 -0
  11. data/app/services/foreman_openscap/lookup_key_overrider.rb +3 -2
  12. data/app/views/api/v2/compliance/scap_content_profiles/base.json.rabl +3 -0
  13. data/app/views/api/v2/compliance/scap_content_profiles/index.json.rabl +3 -0
  14. data/app/views/api/v2/compliance/scap_content_profiles/main.json.rabl +9 -0
  15. data/app/views/arf_reports/welcome.html.erb +2 -0
  16. data/config/routes.rb +2 -0
  17. data/db/migrate/20150929152345_move_arf_reports_to_reports_table.rb +0 -2
  18. data/db/migrate/20200117135424_migrate_port_overrides_to_int.rb +24 -0
  19. data/db/migrate/20200803065041_migrate_port_overrides_for_ansible.rb +34 -0
  20. data/lib/foreman_openscap/engine.rb +9 -6
  21. data/lib/foreman_openscap/helper.rb +1 -1
  22. data/lib/foreman_openscap/version.rb +1 -1
  23. data/locale/action_names.rb +2 -7
  24. data/locale/de/LC_MESSAGES/foreman_openscap.mo +0 -0
  25. data/locale/de/foreman_openscap.po +9 -194
  26. data/locale/en_GB/LC_MESSAGES/foreman_openscap.mo +0 -0
  27. data/locale/en_GB/foreman_openscap.po +8 -194
  28. data/locale/es/LC_MESSAGES/foreman_openscap.mo +0 -0
  29. data/locale/es/foreman_openscap.po +5 -191
  30. data/locale/foreman_openscap.pot +91 -336
  31. data/locale/fr/LC_MESSAGES/foreman_openscap.mo +0 -0
  32. data/locale/fr/foreman_openscap.po +5 -191
  33. data/locale/gl/LC_MESSAGES/foreman_openscap.mo +0 -0
  34. data/locale/gl/foreman_openscap.po +4 -190
  35. data/locale/it/LC_MESSAGES/foreman_openscap.mo +0 -0
  36. data/locale/it/foreman_openscap.po +4 -190
  37. data/locale/ja/LC_MESSAGES/foreman_openscap.mo +0 -0
  38. data/locale/ja/foreman_openscap.po +5 -191
  39. data/locale/ko/LC_MESSAGES/foreman_openscap.mo +0 -0
  40. data/locale/ko/foreman_openscap.po +4 -190
  41. data/locale/pt_BR/LC_MESSAGES/foreman_openscap.mo +0 -0
  42. data/locale/pt_BR/foreman_openscap.po +5 -191
  43. data/locale/ru/LC_MESSAGES/foreman_openscap.mo +0 -0
  44. data/locale/ru/foreman_openscap.po +4 -190
  45. data/locale/sv_SE/LC_MESSAGES/foreman_openscap.mo +0 -0
  46. data/locale/sv_SE/foreman_openscap.po +4 -190
  47. data/locale/zh_CN/LC_MESSAGES/foreman_openscap.mo +0 -0
  48. data/locale/zh_CN/foreman_openscap.po +5 -191
  49. data/locale/zh_TW/LC_MESSAGES/foreman_openscap.mo +0 -0
  50. data/locale/zh_TW/foreman_openscap.po +4 -190
  51. data/test/functional/api/v2/compliance/arf_reports_controller_test.rb +0 -3
  52. data/test/functional/api/v2/compliance/scap_content_profiles_controller_test.rb +15 -0
  53. data/test/test_plugin_helper.rb +2 -2
  54. data/test/unit/policy_test.rb +9 -0
  55. metadata +18 -24
  56. data/locale/de/foreman_openscap.edit.po +0 -0
  57. data/locale/en_GB/foreman_openscap.edit.po +0 -0
  58. data/locale/es/foreman_openscap.edit.po +0 -0
  59. data/locale/fr/foreman_openscap.edit.po +0 -0
  60. data/locale/gl/foreman_openscap.edit.po +0 -0
  61. data/locale/it/foreman_openscap.edit.po +0 -0
  62. data/locale/ja/foreman_openscap.edit.po +0 -0
  63. data/locale/ko/foreman_openscap.edit.po +0 -0
  64. data/locale/pt_BR/foreman_openscap.edit.po +0 -0
  65. data/locale/ru/foreman_openscap.edit.po +0 -0
  66. data/locale/sv_SE/foreman_openscap.edit.po +0 -0
  67. data/locale/zh_CN/foreman_openscap.edit.po +0 -0
  68. data/locale/zh_TW/foreman_openscap.edit.po +0 -0
@@ -3,9 +3,6 @@ require 'tmpdir'
3
3
 
4
4
  class Api::V2::Compliance::ArfReportsControllerTest < ActionController::TestCase
5
5
  setup do
6
- # required for mysql where database cleaner does not cleanup things properly
7
- # because of arf_create does explicit transaction commit
8
- Message.delete_all
9
6
  # override validation of policy (puppetclass, lookup_key overrides)
10
7
  ForemanOpenscap::Policy.any_instance.stubs(:valid?).returns(true)
11
8
  @host = FactoryBot.create(:compliance_host)
@@ -0,0 +1,15 @@
1
+ require 'test_plugin_helper'
2
+
3
+ class Api::V2::Compliance::ScapContentProfilesControllerTest < ActionController::TestCase
4
+ test "should get index" do
5
+ 2.times do
6
+ FactoryBot.create(:scap_content_profile)
7
+ end
8
+ FactoryBot.create(:scap_content, :scap_content_profiles => [ForemanOpenscap::ScapContentProfile.first])
9
+ FactoryBot.create(:tailoring_file, :scap_content_profiles => [ForemanOpenscap::ScapContentProfile.last])
10
+ get :index, :session => set_session_user
11
+ response = ActiveSupport::JSON.decode(@response.body)
12
+ assert response['results'].any?
13
+ assert_response :success
14
+ end
15
+ end
@@ -55,8 +55,8 @@ module ScapTestCommon
55
55
  def create_report_with_rules(host, rule_names, rule_results)
56
56
  raise "rule_names and rule_results should have the same length!" if rule_names.size != rule_results.size
57
57
  metrics = {
58
- 'passed' => rule_results.select { |result| result == 'pass' }.count,
59
- 'failed' => rule_results.select { |result| result == 'fail' }.count,
58
+ 'passed' => rule_results.count { |result| result == 'pass' },
59
+ 'failed' => rule_results.count { |result| result == 'fail' },
60
60
  'othered' => rule_results.reject { |result| result == 'fail' || result == 'pass' }.count
61
61
  }
62
62
  report = FactoryBot.create(:arf_report, :host_id => host.id, :metrics => metrics, :status => metrics)
@@ -37,6 +37,15 @@ class PolicyTest < ActiveSupport::TestCase
37
37
  assert_equal hostgroup, policy.hostgroups.first
38
38
  end
39
39
 
40
+ test "should not raise when assiging same host by id" do
41
+ host1 = FactoryBot.create(:compliance_host)
42
+ asset = FactoryBot.create(:asset, :assetable_id => host1.id, :assetable_type => 'Host::Base')
43
+ policy = FactoryBot.create(:policy, :assets => [asset], :scap_content => @scap_content, :scap_content_profile => @scap_profile)
44
+ policy.host_ids = [host1, host1].map(&:id)
45
+ policy.save!
46
+ assert_equal 1, policy.hosts.count
47
+ end
48
+
40
49
  test "should remove associated hostgroup" do
41
50
  hg = FactoryBot.create(:hostgroup)
42
51
  asset = FactoryBot.create(:asset, :assetable_id => hg.id, :assetable_type => 'Hostgroup')
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: 2.0.2
4
+ version: 4.0.2
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-15 00:00:00.000000000 Z
11
+ date: 2020-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -46,6 +46,7 @@ files:
46
46
  - app/assets/stylesheets/foreman_openscap/scap_breakdown_chart.css
47
47
  - app/controllers/api/v2/compliance/arf_reports_controller.rb
48
48
  - app/controllers/api/v2/compliance/policies_controller.rb
49
+ - app/controllers/api/v2/compliance/scap_content_profiles_controller.rb
49
50
  - app/controllers/api/v2/compliance/scap_contents_controller.rb
50
51
  - app/controllers/api/v2/compliance/tailoring_files_controller.rb
51
52
  - app/controllers/arf_reports_controller.rb
@@ -125,6 +126,9 @@ files:
125
126
  - app/views/api/v2/compliance/policies/index.json.rabl
126
127
  - app/views/api/v2/compliance/policies/main.json.rabl
127
128
  - app/views/api/v2/compliance/policies/show.json.rabl
129
+ - app/views/api/v2/compliance/scap_content_profiles/base.json.rabl
130
+ - app/views/api/v2/compliance/scap_content_profiles/index.json.rabl
131
+ - app/views/api/v2/compliance/scap_content_profiles/main.json.rabl
128
132
  - app/views/api/v2/compliance/scap_contents/base.json.rabl
129
133
  - app/views/api/v2/compliance/scap_contents/create.json.rabl
130
134
  - app/views/api/v2/compliance/scap_contents/index.json.rabl
@@ -239,6 +243,8 @@ files:
239
243
  - db/migrate/20171011134112_remove_arf_reports_without_policy.rb
240
244
  - db/migrate/20171016125613_add_content_title_unique_constraint.foreman_openscap.rb
241
245
  - db/migrate/20190103093409_add_deployment_option_to_policy.foreman_openscap.rb
246
+ - db/migrate/20200117135424_migrate_port_overrides_to_int.rb
247
+ - db/migrate/20200803065041_migrate_port_overrides_for_ansible.rb
242
248
  - db/seeds.d/75-job_templates.rb
243
249
  - db/seeds.d/openscap_feature.rb
244
250
  - db/seeds.d/openscap_policy_notification.rb
@@ -253,45 +259,32 @@ files:
253
259
  - locale/Makefile
254
260
  - locale/action_names.rb
255
261
  - locale/de/LC_MESSAGES/foreman_openscap.mo
256
- - locale/de/foreman_openscap.edit.po
257
262
  - locale/de/foreman_openscap.po
258
263
  - locale/en_GB/LC_MESSAGES/foreman_openscap.mo
259
- - locale/en_GB/foreman_openscap.edit.po
260
264
  - locale/en_GB/foreman_openscap.po
261
265
  - locale/es/LC_MESSAGES/foreman_openscap.mo
262
- - locale/es/foreman_openscap.edit.po
263
266
  - locale/es/foreman_openscap.po
264
267
  - locale/foreman_openscap.pot
265
268
  - locale/fr/LC_MESSAGES/foreman_openscap.mo
266
- - locale/fr/foreman_openscap.edit.po
267
269
  - locale/fr/foreman_openscap.po
268
270
  - locale/gl/LC_MESSAGES/foreman_openscap.mo
269
- - locale/gl/foreman_openscap.edit.po
270
271
  - locale/gl/foreman_openscap.po
271
272
  - locale/it/LC_MESSAGES/foreman_openscap.mo
272
- - locale/it/foreman_openscap.edit.po
273
273
  - locale/it/foreman_openscap.po
274
274
  - locale/ja/LC_MESSAGES/foreman_openscap.mo
275
- - locale/ja/foreman_openscap.edit.po
276
275
  - locale/ja/foreman_openscap.po
277
276
  - locale/ko/LC_MESSAGES/foreman_openscap.mo
278
- - locale/ko/foreman_openscap.edit.po
279
277
  - locale/ko/foreman_openscap.po
280
278
  - locale/pt_BR/LC_MESSAGES/foreman_openscap.mo
281
- - locale/pt_BR/foreman_openscap.edit.po
282
279
  - locale/pt_BR/foreman_openscap.po
283
280
  - locale/ru/LC_MESSAGES/foreman_openscap.mo
284
- - locale/ru/foreman_openscap.edit.po
285
281
  - locale/ru/foreman_openscap.po
286
282
  - locale/sv_SE/LC_MESSAGES/foreman_openscap.mo
287
- - locale/sv_SE/foreman_openscap.edit.po
288
283
  - locale/sv_SE/foreman_openscap.po
289
284
  - locale/zanata.xml
290
285
  - locale/zh_CN/LC_MESSAGES/foreman_openscap.mo
291
- - locale/zh_CN/foreman_openscap.edit.po
292
286
  - locale/zh_CN/foreman_openscap.po
293
287
  - locale/zh_TW/LC_MESSAGES/foreman_openscap.mo
294
- - locale/zh_TW/foreman_openscap.edit.po
295
288
  - locale/zh_TW/foreman_openscap.po
296
289
  - test/factories/arf_report_factory.rb
297
290
  - test/factories/asset_factory.rb
@@ -310,6 +303,7 @@ files:
310
303
  - test/files/tailoring_files/ssg-firefox-ds-tailoring.xml
311
304
  - test/functional/api/v2/compliance/arf_reports_controller_test.rb
312
305
  - test/functional/api/v2/compliance/policies_controller_test.rb
306
+ - test/functional/api/v2/compliance/scap_content_profiles_controller_test.rb
313
307
  - test/functional/api/v2/compliance/scap_contents_controller_test.rb
314
308
  - test/functional/api/v2/compliance/tailoring_files_controller_test.rb
315
309
  - test/functional/api/v2/hosts_controller_test.rb
@@ -355,19 +349,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
355
349
  - !ruby/object:Gem::Version
356
350
  version: '0'
357
351
  requirements: []
358
- rubyforge_project:
359
- rubygems_version: 2.6.14
352
+ rubygems_version: 3.1.2
360
353
  signing_key:
361
354
  specification_version: 4
362
355
  summary: Foreman plug-in for displaying OpenSCAP audit reports
363
356
  test_files:
364
357
  - test/factories/arf_report_factory.rb
365
358
  - test/factories/asset_factory.rb
359
+ - test/factories/compliance_host_factory.rb
366
360
  - test/factories/compliance_log_factory.rb
367
361
  - test/factories/policy_arf_report_factory.rb
368
362
  - test/factories/policy_factory.rb
369
363
  - test/factories/scap_content_related.rb
370
- - test/factories/compliance_host_factory.rb
371
364
  - test/files/arf_report/arf_report.bz2
372
365
  - test/files/arf_report/arf_report.html
373
366
  - test/files/arf_report/arf_report.json
@@ -378,19 +371,23 @@ test_files:
378
371
  - test/files/tailoring_files/ssg-firefox-ds-tailoring.xml
379
372
  - test/functional/api/v2/compliance/arf_reports_controller_test.rb
380
373
  - test/functional/api/v2/compliance/policies_controller_test.rb
374
+ - test/functional/api/v2/compliance/scap_content_profiles_controller_test.rb
381
375
  - test/functional/api/v2/compliance/scap_contents_controller_test.rb
382
376
  - test/functional/api/v2/compliance/tailoring_files_controller_test.rb
383
377
  - test/functional/api/v2/hosts_controller_test.rb
384
378
  - test/functional/arf_reports_controller_test.rb
385
379
  - test/functional/openscap_proxies_controller_test.rb
386
380
  - test/functional/tailoring_files_controller_test.rb
381
+ - test/helpers/arf_report_dashboard_helper_test.rb
382
+ - test/helpers/policy_dashboard_helper_test.rb
387
383
  - test/lib/foreman_openscap/bulk_upload_test.rb
388
- - test/test_plugin_helper.rb
389
384
  - test/unit/arf_report_status_calculator_test.rb
385
+ - test/unit/arf_report_test.rb
390
386
  - test/unit/compliance_status_test.rb
391
- - test/unit/concerns/openscap_proxy_extenstions_test.rb
392
387
  - test/unit/concerns/host_extensions_test.rb
388
+ - test/unit/concerns/openscap_proxy_extenstions_test.rb
393
389
  - test/unit/message_cleaner_test.rb
390
+ - test/unit/openscap_host_test.rb
394
391
  - test/unit/policy_mailer_test.rb
395
392
  - test/unit/scap_content_test.rb
396
393
  - test/unit/services/config_name_service_test.rb
@@ -399,8 +396,5 @@ test_files:
399
396
  - test/unit/services/report_dashboard/data_test.rb
400
397
  - test/unit/services/tailoring_files_proxy_check_test.rb
401
398
  - test/unit/tailoring_file_test.rb
402
- - test/unit/arf_report_test.rb
403
- - test/unit/openscap_host_test.rb
404
399
  - test/unit/policy_test.rb
405
- - test/helpers/arf_report_dashboard_helper_test.rb
406
- - test/helpers/policy_dashboard_helper_test.rb
400
+ - test/test_plugin_helper.rb
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes