foreman_openscap 2.0.1 → 4.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +5 -5
  2. data/app/controllers/api/v2/compliance/arf_reports_controller.rb +11 -3
  3. data/app/controllers/api/v2/compliance/policies_controller.rb +1 -8
  4. data/app/controllers/api/v2/compliance/scap_content_profiles_controller.rb +15 -0
  5. data/app/controllers/api/v2/compliance/scap_contents_controller.rb +3 -9
  6. data/app/controllers/api/v2/compliance/tailoring_files_controller.rb +3 -9
  7. data/app/controllers/concerns/foreman_openscap/api/v2/scap_api_controller_extensions.rb +9 -0
  8. data/app/controllers/scap_contents_controller.rb +1 -1
  9. data/app/controllers/tailoring_files_controller.rb +1 -1
  10. data/app/models/concerns/foreman_openscap/smart_proxy_extensions.rb +1 -1
  11. data/app/models/foreman_openscap/policy.rb +1 -1
  12. data/app/models/foreman_openscap/scap_content_profile.rb +3 -0
  13. data/app/services/foreman_openscap/lookup_key_overrider.rb +3 -2
  14. data/app/views/api/v2/compliance/scap_content_profiles/base.json.rabl +3 -0
  15. data/app/views/api/v2/compliance/scap_content_profiles/index.json.rabl +3 -0
  16. data/app/views/api/v2/compliance/scap_content_profiles/main.json.rabl +9 -0
  17. data/app/views/arf_reports/_list.html.erb +1 -1
  18. data/app/views/arf_reports/welcome.html.erb +2 -0
  19. data/app/views/hosts/select_multiple_openscap_proxy.html.erb +1 -1
  20. data/app/views/policies/disassociate_multiple_hosts.html.erb +1 -1
  21. data/app/views/policies/select_multiple_hosts.html.erb +1 -1
  22. data/config/routes.rb +2 -0
  23. data/db/migrate/20150929152345_move_arf_reports_to_reports_table.rb +0 -2
  24. data/db/migrate/20200117135424_migrate_port_overrides_to_int.rb +24 -0
  25. data/lib/foreman_openscap/engine.rb +9 -6
  26. data/lib/foreman_openscap/helper.rb +1 -1
  27. data/lib/foreman_openscap/version.rb +1 -1
  28. data/locale/action_names.rb +2 -7
  29. data/locale/de/LC_MESSAGES/foreman_openscap.mo +0 -0
  30. data/locale/de/foreman_openscap.po +9 -194
  31. data/locale/en_GB/LC_MESSAGES/foreman_openscap.mo +0 -0
  32. data/locale/en_GB/foreman_openscap.po +8 -194
  33. data/locale/es/LC_MESSAGES/foreman_openscap.mo +0 -0
  34. data/locale/es/foreman_openscap.po +5 -191
  35. data/locale/foreman_openscap.pot +91 -336
  36. data/locale/fr/LC_MESSAGES/foreman_openscap.mo +0 -0
  37. data/locale/fr/foreman_openscap.po +5 -191
  38. data/locale/gl/LC_MESSAGES/foreman_openscap.mo +0 -0
  39. data/locale/gl/foreman_openscap.po +4 -190
  40. data/locale/it/LC_MESSAGES/foreman_openscap.mo +0 -0
  41. data/locale/it/foreman_openscap.po +4 -190
  42. data/locale/ja/LC_MESSAGES/foreman_openscap.mo +0 -0
  43. data/locale/ja/foreman_openscap.po +5 -191
  44. data/locale/ko/LC_MESSAGES/foreman_openscap.mo +0 -0
  45. data/locale/ko/foreman_openscap.po +4 -190
  46. data/locale/pt_BR/LC_MESSAGES/foreman_openscap.mo +0 -0
  47. data/locale/pt_BR/foreman_openscap.po +5 -191
  48. data/locale/ru/LC_MESSAGES/foreman_openscap.mo +0 -0
  49. data/locale/ru/foreman_openscap.po +4 -190
  50. data/locale/sv_SE/LC_MESSAGES/foreman_openscap.mo +0 -0
  51. data/locale/sv_SE/foreman_openscap.po +4 -190
  52. data/locale/zh_CN/LC_MESSAGES/foreman_openscap.mo +0 -0
  53. data/locale/zh_CN/foreman_openscap.po +5 -191
  54. data/locale/zh_TW/LC_MESSAGES/foreman_openscap.mo +0 -0
  55. data/locale/zh_TW/foreman_openscap.po +4 -190
  56. data/test/functional/api/v2/compliance/arf_reports_controller_test.rb +0 -3
  57. data/test/functional/api/v2/compliance/scap_content_profiles_controller_test.rb +15 -0
  58. data/test/test_plugin_helper.rb +2 -2
  59. metadata +18 -11
@@ -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)
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.1
4
+ version: 4.0.1
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-12 00:00:00.000000000 Z
11
+ date: 2020-07-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
@@ -56,6 +57,7 @@ files:
56
57
  - app/controllers/concerns/foreman/controller/parameters/scap_content.rb
57
58
  - app/controllers/concerns/foreman/controller/parameters/tailoring_file.rb
58
59
  - app/controllers/concerns/foreman_openscap/api/v2/hosts_controller_extensions.rb
60
+ - app/controllers/concerns/foreman_openscap/api/v2/scap_api_controller_extensions.rb
59
61
  - app/controllers/concerns/foreman_openscap/arf_reports_controller_common_extensions.rb
60
62
  - app/controllers/concerns/foreman_openscap/body_log_extensions.rb
61
63
  - app/controllers/concerns/foreman_openscap/hosts_and_hostgroups_controller_extensions.rb
@@ -124,6 +126,9 @@ files:
124
126
  - app/views/api/v2/compliance/policies/index.json.rabl
125
127
  - app/views/api/v2/compliance/policies/main.json.rabl
126
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
127
132
  - app/views/api/v2/compliance/scap_contents/base.json.rabl
128
133
  - app/views/api/v2/compliance/scap_contents/create.json.rabl
129
134
  - app/views/api/v2/compliance/scap_contents/index.json.rabl
@@ -238,6 +243,7 @@ files:
238
243
  - db/migrate/20171011134112_remove_arf_reports_without_policy.rb
239
244
  - db/migrate/20171016125613_add_content_title_unique_constraint.foreman_openscap.rb
240
245
  - db/migrate/20190103093409_add_deployment_option_to_policy.foreman_openscap.rb
246
+ - db/migrate/20200117135424_migrate_port_overrides_to_int.rb
241
247
  - db/seeds.d/75-job_templates.rb
242
248
  - db/seeds.d/openscap_feature.rb
243
249
  - db/seeds.d/openscap_policy_notification.rb
@@ -296,6 +302,7 @@ files:
296
302
  - test/files/tailoring_files/ssg-firefox-ds-tailoring.xml
297
303
  - test/functional/api/v2/compliance/arf_reports_controller_test.rb
298
304
  - test/functional/api/v2/compliance/policies_controller_test.rb
305
+ - test/functional/api/v2/compliance/scap_content_profiles_controller_test.rb
299
306
  - test/functional/api/v2/compliance/scap_contents_controller_test.rb
300
307
  - test/functional/api/v2/compliance/tailoring_files_controller_test.rb
301
308
  - test/functional/api/v2/hosts_controller_test.rb
@@ -341,19 +348,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
341
348
  - !ruby/object:Gem::Version
342
349
  version: '0'
343
350
  requirements: []
344
- rubyforge_project:
345
- rubygems_version: 2.6.14
351
+ rubygems_version: 3.1.2
346
352
  signing_key:
347
353
  specification_version: 4
348
354
  summary: Foreman plug-in for displaying OpenSCAP audit reports
349
355
  test_files:
350
356
  - test/factories/arf_report_factory.rb
351
357
  - test/factories/asset_factory.rb
358
+ - test/factories/compliance_host_factory.rb
352
359
  - test/factories/compliance_log_factory.rb
353
360
  - test/factories/policy_arf_report_factory.rb
354
361
  - test/factories/policy_factory.rb
355
362
  - test/factories/scap_content_related.rb
356
- - test/factories/compliance_host_factory.rb
357
363
  - test/files/arf_report/arf_report.bz2
358
364
  - test/files/arf_report/arf_report.html
359
365
  - test/files/arf_report/arf_report.json
@@ -364,19 +370,23 @@ test_files:
364
370
  - test/files/tailoring_files/ssg-firefox-ds-tailoring.xml
365
371
  - test/functional/api/v2/compliance/arf_reports_controller_test.rb
366
372
  - test/functional/api/v2/compliance/policies_controller_test.rb
373
+ - test/functional/api/v2/compliance/scap_content_profiles_controller_test.rb
367
374
  - test/functional/api/v2/compliance/scap_contents_controller_test.rb
368
375
  - test/functional/api/v2/compliance/tailoring_files_controller_test.rb
369
376
  - test/functional/api/v2/hosts_controller_test.rb
370
377
  - test/functional/arf_reports_controller_test.rb
371
378
  - test/functional/openscap_proxies_controller_test.rb
372
379
  - test/functional/tailoring_files_controller_test.rb
380
+ - test/helpers/arf_report_dashboard_helper_test.rb
381
+ - test/helpers/policy_dashboard_helper_test.rb
373
382
  - test/lib/foreman_openscap/bulk_upload_test.rb
374
- - test/test_plugin_helper.rb
375
383
  - test/unit/arf_report_status_calculator_test.rb
384
+ - test/unit/arf_report_test.rb
376
385
  - test/unit/compliance_status_test.rb
377
- - test/unit/concerns/openscap_proxy_extenstions_test.rb
378
386
  - test/unit/concerns/host_extensions_test.rb
387
+ - test/unit/concerns/openscap_proxy_extenstions_test.rb
379
388
  - test/unit/message_cleaner_test.rb
389
+ - test/unit/openscap_host_test.rb
380
390
  - test/unit/policy_mailer_test.rb
381
391
  - test/unit/scap_content_test.rb
382
392
  - test/unit/services/config_name_service_test.rb
@@ -385,8 +395,5 @@ test_files:
385
395
  - test/unit/services/report_dashboard/data_test.rb
386
396
  - test/unit/services/tailoring_files_proxy_check_test.rb
387
397
  - test/unit/tailoring_file_test.rb
388
- - test/unit/arf_report_test.rb
389
- - test/unit/openscap_host_test.rb
390
398
  - test/unit/policy_test.rb
391
- - test/helpers/arf_report_dashboard_helper_test.rb
392
- - test/helpers/policy_dashboard_helper_test.rb
399
+ - test/test_plugin_helper.rb