foreman_openscap 0.12.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_openscap/policy_dashboard.js +5 -0
  3. data/app/assets/stylesheets/foreman_openscap/policy_dashboard.css +3 -0
  4. data/app/controllers/concerns/foreman_openscap/api/v2/hosts_controller_extensions.rb +26 -0
  5. data/app/controllers/policies_controller.rb +2 -3
  6. data/app/controllers/policy_dashboard_controller.rb +5 -0
  7. data/app/controllers/scap_contents_controller.rb +1 -1
  8. data/app/controllers/tailoring_files_controller.rb +1 -2
  9. data/app/helpers/policy_dashboard_helper.rb +23 -0
  10. data/app/mailers/foreman_openscap/policy_mailer.rb +1 -1
  11. data/app/models/concerns/foreman_openscap/host_extensions.rb +48 -3
  12. data/app/models/foreman_openscap/policy.rb +4 -0
  13. data/app/models/foreman_openscap/scap_content.rb +1 -0
  14. data/app/models/foreman_openscap/tailoring_file.rb +1 -0
  15. data/app/services/foreman_openscap/policy_dashboard/data.rb +3 -4
  16. data/app/views/api/v2/hosts/policies_enc.json.rabl +2 -0
  17. data/app/views/api/v2/hosts/policy_enc.json.rabl +3 -0
  18. data/app/views/arf_reports/_output.html.erb +4 -4
  19. data/app/views/arf_reports/show.html.erb +2 -2
  20. data/app/views/policies/_list.html.erb +9 -7
  21. data/app/views/policies/index.html.erb +2 -2
  22. data/app/views/policy_dashboard/_policy_reports.html.erb +29 -22
  23. data/app/views/policy_dashboard/_policy_status_widget.html.erb +7 -4
  24. data/app/views/policy_dashboard/index.html.erb +1 -1
  25. data/app/views/scap_contents/_list.html.erb +7 -6
  26. data/app/views/scap_contents/index.html.erb +2 -2
  27. data/app/views/tailoring_files/_list.html.erb +6 -5
  28. data/app/views/tailoring_files/index.html.erb +2 -1
  29. data/config/routes.rb +15 -0
  30. data/db/migrate/20190103093409_add_deployment_option_to_policy.foreman_openscap.rb +1 -1
  31. data/lib/foreman_openscap/engine.rb +3 -1
  32. data/lib/foreman_openscap/version.rb +1 -1
  33. data/locale/de/foreman_openscap.edit.po +81 -77
  34. data/locale/de/foreman_openscap.po +26 -23
  35. data/locale/en_GB/foreman_openscap.edit.po +81 -77
  36. data/locale/en_GB/foreman_openscap.po +26 -23
  37. data/locale/es/foreman_openscap.edit.po +81 -77
  38. data/locale/es/foreman_openscap.po +26 -23
  39. data/locale/foreman_openscap.pot +88 -84
  40. data/locale/fr/foreman_openscap.edit.po +81 -77
  41. data/locale/fr/foreman_openscap.po +26 -23
  42. data/locale/gl/foreman_openscap.edit.po +81 -77
  43. data/locale/gl/foreman_openscap.po +26 -23
  44. data/locale/it/foreman_openscap.edit.po +81 -77
  45. data/locale/it/foreman_openscap.po +26 -23
  46. data/locale/ja/foreman_openscap.edit.po +81 -77
  47. data/locale/ja/foreman_openscap.po +26 -23
  48. data/locale/ko/foreman_openscap.edit.po +81 -77
  49. data/locale/ko/foreman_openscap.po +26 -23
  50. data/locale/pt_BR/foreman_openscap.edit.po +81 -77
  51. data/locale/pt_BR/foreman_openscap.po +26 -23
  52. data/locale/ru/foreman_openscap.edit.po +81 -77
  53. data/locale/ru/foreman_openscap.po +26 -23
  54. data/locale/sv_SE/foreman_openscap.edit.po +81 -77
  55. data/locale/sv_SE/foreman_openscap.po +26 -23
  56. data/locale/zh_CN/foreman_openscap.edit.po +81 -77
  57. data/locale/zh_CN/foreman_openscap.po +26 -23
  58. data/locale/zh_TW/foreman_openscap.edit.po +81 -77
  59. data/locale/zh_TW/foreman_openscap.po +26 -23
  60. data/test/functional/api/v2/hosts_controller_test.rb +17 -0
  61. data/test/test_plugin_helper.rb +6 -1
  62. data/test/unit/concerns/host_extensions_test.rb +41 -0
  63. metadata +9 -2
@@ -245,6 +245,14 @@ msgstr ""
245
245
  msgid "Something went wrong while selecting compliance reports - %s"
246
246
  msgstr ""
247
247
 
248
+ #: ../app/controllers/concerns/foreman_openscap/api/v2/hosts_controller_extensions.rb:19
249
+ msgid "Show config information for foreman_scap_client"
250
+ msgstr ""
251
+
252
+ #: ../app/controllers/concerns/foreman_openscap/api/v2/hosts_controller_extensions.rb:20
253
+ msgid "The identifier of the host"
254
+ msgstr ""
255
+
248
256
  #: ../app/controllers/concerns/foreman_openscap/hosts_controller_extensions.rb:26
249
257
  msgid "Updated hosts: Assigned with OpenSCAP Proxy: %s"
250
258
  msgstr ""
@@ -253,39 +261,39 @@ msgstr ""
253
261
  msgid "No OpenSCAP Proxy selected."
254
262
  msgstr ""
255
263
 
256
- #: ../app/controllers/policies_controller.rb:84
264
+ #: ../app/controllers/policies_controller.rb:83
257
265
  msgid "Updated hosts: Assigned with compliance policy: %s"
258
266
  msgstr ""
259
267
 
260
- #: ../app/controllers/policies_controller.rb:88
268
+ #: ../app/controllers/policies_controller.rb:87
261
269
  msgid "No compliance policy selected."
262
270
  msgstr ""
263
271
 
264
- #: ../app/controllers/policies_controller.rb:100
272
+ #: ../app/controllers/policies_controller.rb:99
265
273
  msgid "Updated hosts: Unassigned from compliance policy '%s'"
266
274
  msgstr ""
267
275
 
268
- #: ../app/controllers/policies_controller.rb:102
276
+ #: ../app/controllers/policies_controller.rb:101
269
277
  msgid "No valid policy ID provided"
270
278
  msgstr ""
271
279
 
272
- #: ../app/controllers/policies_controller.rb:122
280
+ #: ../app/controllers/policies_controller.rb:121
273
281
  msgid "No hosts were found."
274
282
  msgstr ""
275
283
 
276
- #: ../app/controllers/policies_controller.rb:126
284
+ #: ../app/controllers/policies_controller.rb:125
277
285
  msgid "No hosts selected"
278
286
  msgstr ""
279
287
 
280
- #: ../app/controllers/policies_controller.rb:131
288
+ #: ../app/controllers/policies_controller.rb:130
281
289
  msgid "Something went wrong while selecting hosts - %s"
282
290
  msgstr ""
283
291
 
284
- #: ../app/helpers/arf_report_dashboard_helper.rb:10 ../app/helpers/compliance_dashboard_helper.rb:8 ../app/helpers/compliance_hosts_helper.rb:5 ../app/helpers/compliance_hosts_helper.rb:22 ../app/views/arf_reports/_list.html.erb:11 ../app/views/foreman_openscap/policy_mailer/_hosts.erb:11 ../app/views/policy_dashboard/_policy_reports.html.erb:6
292
+ #: ../app/helpers/arf_report_dashboard_helper.rb:10 ../app/helpers/compliance_dashboard_helper.rb:8 ../app/helpers/compliance_hosts_helper.rb:5 ../app/helpers/compliance_hosts_helper.rb:22 ../app/views/arf_reports/_list.html.erb:11 ../app/views/foreman_openscap/policy_mailer/_hosts.erb:11 ../app/views/policy_dashboard/_policy_reports.html.erb:10
285
293
  msgid "Failed"
286
294
  msgstr ""
287
295
 
288
- #: ../app/helpers/arf_report_dashboard_helper.rb:11 ../app/helpers/compliance_dashboard_helper.rb:6 ../app/helpers/compliance_hosts_helper.rb:4 ../app/helpers/compliance_hosts_helper.rb:21 ../app/views/arf_reports/_list.html.erb:10 ../app/views/foreman_openscap/policy_mailer/_hosts.erb:8 ../app/views/policy_dashboard/_policy_reports.html.erb:5
296
+ #: ../app/helpers/arf_report_dashboard_helper.rb:11 ../app/helpers/compliance_dashboard_helper.rb:6 ../app/helpers/compliance_hosts_helper.rb:4 ../app/helpers/compliance_hosts_helper.rb:21 ../app/views/arf_reports/_list.html.erb:10 ../app/views/foreman_openscap/policy_mailer/_hosts.erb:8 ../app/views/policy_dashboard/_policy_reports.html.erb:9
289
297
  msgid "Passed"
290
298
  msgstr ""
291
299
 
@@ -372,7 +380,7 @@ msgstr ""
372
380
  msgid "Othered|O"
373
381
  msgstr ""
374
382
 
375
- #: ../app/helpers/compliance_hosts_helper.rb:6 ../app/views/arf_reports/_list.html.erb:12 ../app/views/foreman_openscap/policy_mailer/_hosts.erb:14 ../app/views/policy_dashboard/_policy_reports.html.erb:7
383
+ #: ../app/helpers/compliance_hosts_helper.rb:6 ../app/views/arf_reports/_list.html.erb:12 ../app/views/foreman_openscap/policy_mailer/_hosts.erb:14 ../app/views/policy_dashboard/_policy_reports.html.erb:11
376
384
  msgid "Other"
377
385
  msgstr ""
378
386
 
@@ -392,7 +400,7 @@ msgstr ""
392
400
  msgid "Host is deleted"
393
401
  msgstr ""
394
402
 
395
- #: ../app/helpers/foreman_openscap_helper.rb:2
403
+ #: ../app/helpers/foreman_openscap_helper.rb:4
396
404
  msgid "documentation"
397
405
  msgstr ""
398
406
 
@@ -400,7 +408,7 @@ msgstr ""
400
408
  msgid "Choose existing SCAP Content"
401
409
  msgstr ""
402
410
 
403
- #: ../app/helpers/policies_helper.rb:57 ../app/helpers/policies_helper.rb:62 ../app/models/foreman_openscap/policy.rb:100 ../app/views/policies/_form.html.erb:10 ../app/views/scap_contents/welcome.html.erb:1 ../app/views/scap_contents/welcome.html.erb:6
411
+ #: ../app/helpers/policies_helper.rb:57 ../app/helpers/policies_helper.rb:62 ../app/models/foreman_openscap/policy.rb:104 ../app/views/policies/_form.html.erb:10 ../app/views/scap_contents/welcome.html.erb:1 ../app/views/scap_contents/welcome.html.erb:6
404
412
  msgid "SCAP Content"
405
413
  msgstr ""
406
414
 
@@ -432,11 +440,11 @@ msgstr ""
432
440
  msgid "Submit"
433
441
  msgstr ""
434
442
 
435
- #: ../app/helpers/policies_helper.rb:114 ../app/views/arf_reports/_list.html.erb:52
443
+ #: ../app/helpers/policies_helper.rb:113 ../app/views/arf_reports/_list.html.erb:52
436
444
  msgid "Cancel"
437
445
  msgstr ""
438
446
 
439
- #: ../app/helpers/policies_helper.rb:145 ../lib/foreman_openscap/engine.rb:138
447
+ #: ../app/helpers/policies_helper.rb:145 ../lib/foreman_openscap/engine.rb:139
440
448
  msgid "Policies"
441
449
  msgstr ""
442
450
 
@@ -460,6 +468,22 @@ msgstr ""
460
468
  msgid "Compliance Status"
461
469
  msgstr ""
462
470
 
471
+ #: ../app/helpers/policy_dashboard_helper.rb:41
472
+ msgid "Host is assigned to policy"
473
+ msgstr ""
474
+
475
+ #: ../app/helpers/policy_dashboard_helper.rb:44
476
+ msgid "Host is not assigned to policy but reports were found. You may want to delete the reports or assign the policy again."
477
+ msgstr ""
478
+
479
+ #: ../app/helpers/policy_dashboard_helper.rb:52
480
+ msgid "Hosts no longer assigned: %s"
481
+ msgstr ""
482
+
483
+ #: ../app/helpers/policy_dashboard_helper.rb:56
484
+ msgid "Total hosts with reports where policy is no longer assigned."
485
+ msgstr ""
486
+
463
487
  #: ../app/lib/proxy_api/openscap.rb:21
464
488
  msgid "Request timed out. Please try increasing Settings -> proxy_request_timeout"
465
489
  msgstr ""
@@ -496,7 +520,7 @@ msgstr ""
496
520
  msgid "No OpenSCAP proxy found for %{class} with id %{id}"
497
521
  msgstr ""
498
522
 
499
- #: ../app/models/foreman_openscap/compliance_status.rb:8 ../app/views/compliance_hosts/_compliance_status.erb:2 ../lib/foreman_openscap/engine.rb:137
523
+ #: ../app/models/foreman_openscap/compliance_status.rb:8 ../app/views/compliance_hosts/_compliance_status.erb:2 ../lib/foreman_openscap/engine.rb:138
500
524
  msgid "Compliance"
501
525
  msgstr ""
502
526
 
@@ -512,63 +536,63 @@ msgstr ""
512
536
  msgid "Unknown Compliance status"
513
537
  msgstr ""
514
538
 
515
- #: ../app/models/foreman_openscap/policy.rb:27 ../app/models/foreman_openscap/policy.rb:265
539
+ #: ../app/models/foreman_openscap/policy.rb:31 ../app/models/foreman_openscap/policy.rb:269
516
540
  msgid "is not a valid value"
517
541
  msgstr ""
518
542
 
519
- #: ../app/models/foreman_openscap/policy.rb:51
543
+ #: ../app/models/foreman_openscap/policy.rb:55
520
544
  msgid "Cannot generate HTML guide, scap content is missing."
521
545
  msgstr ""
522
546
 
523
- #: ../app/models/foreman_openscap/policy.rb:57
547
+ #: ../app/models/foreman_openscap/policy.rb:61
524
548
  msgid "Cannot generate HTML guide, no valid OpenSCAP proxy server found."
525
549
  msgstr ""
526
550
 
527
- #: ../app/models/foreman_openscap/policy.rb:100 ../app/views/policies/_form.html.erb:8
551
+ #: ../app/models/foreman_openscap/policy.rb:104 ../app/views/policies/_form.html.erb:8
528
552
  msgid "Deployment Options"
529
553
  msgstr ""
530
554
 
531
- #: ../app/models/foreman_openscap/policy.rb:100
555
+ #: ../app/models/foreman_openscap/policy.rb:104
532
556
  msgid "Policy Attributes"
533
557
  msgstr ""
534
558
 
535
- #: ../app/models/foreman_openscap/policy.rb:100 ../app/views/policies/_form.html.erb:11
559
+ #: ../app/models/foreman_openscap/policy.rb:104 ../app/views/policies/_form.html.erb:11
536
560
  msgid "Schedule"
537
561
  msgstr ""
538
562
 
539
- #: ../app/models/foreman_openscap/policy.rb:101 ../app/views/policies/_form.html.erb:13 ../app/views/scap_contents/_form.html.erb:11 ../app/views/tailoring_files/_form.html.erb:11
563
+ #: ../app/models/foreman_openscap/policy.rb:105 ../app/views/policies/_form.html.erb:13 ../app/views/scap_contents/_form.html.erb:11 ../app/views/tailoring_files/_form.html.erb:11
540
564
  msgid "Locations"
541
565
  msgstr ""
542
566
 
543
- #: ../app/models/foreman_openscap/policy.rb:102 ../app/views/policies/_form.html.erb:16 ../app/views/scap_contents/_form.html.erb:14 ../app/views/tailoring_files/_form.html.erb:14
567
+ #: ../app/models/foreman_openscap/policy.rb:106 ../app/views/policies/_form.html.erb:16 ../app/views/scap_contents/_form.html.erb:14 ../app/views/tailoring_files/_form.html.erb:14
544
568
  msgid "Organizations"
545
569
  msgstr ""
546
570
 
547
- #: ../app/models/foreman_openscap/policy.rb:103
571
+ #: ../app/models/foreman_openscap/policy.rb:107
548
572
  msgid "Hostgroups"
549
573
  msgstr ""
550
574
 
551
- #: ../app/models/foreman_openscap/policy.rb:259
575
+ #: ../app/models/foreman_openscap/policy.rb:263
552
576
  msgid "does not consist of 5 parts separated by space"
553
577
  msgstr ""
554
578
 
555
- #: ../app/models/foreman_openscap/policy.rb:271
579
+ #: ../app/models/foreman_openscap/policy.rb:275
556
580
  msgid "must be between 1 and 31"
557
581
  msgstr ""
558
582
 
559
- #: ../app/models/foreman_openscap/policy.rb:276
583
+ #: ../app/models/foreman_openscap/policy.rb:280
560
584
  msgid "must be present when tailoring file profile present"
561
585
  msgstr ""
562
586
 
563
- #: ../app/models/foreman_openscap/policy.rb:277
587
+ #: ../app/models/foreman_openscap/policy.rb:281
564
588
  msgid "must be present when tailoring file present"
565
589
  msgstr ""
566
590
 
567
- #: ../app/models/foreman_openscap/policy.rb:282
591
+ #: ../app/models/foreman_openscap/policy.rb:286
568
592
  msgid "does not come from selected tailoring file"
569
593
  msgstr ""
570
594
 
571
- #: ../app/models/foreman_openscap/policy.rb:288
595
+ #: ../app/models/foreman_openscap/policy.rb:292
572
596
  msgid "does not have the selected SCAP content profile"
573
597
  msgstr ""
574
598
 
@@ -672,7 +696,7 @@ msgstr ""
672
696
  msgid "Openscap Proxy"
673
697
  msgstr ""
674
698
 
675
- #: ../app/views/arf_reports/_list.html.erb:13 ../app/views/arf_reports/_output.html.erb:8 ../app/views/policies/_list.html.erb:8 ../app/views/policy_dashboard/_policy_reports.html.erb:8 ../app/views/scap_contents/_list.html.erb:6 ../app/views/tailoring_files/_list.html.erb:6
699
+ #: ../app/views/arf_reports/_list.html.erb:13 ../app/views/arf_reports/_output.html.erb:8 ../app/views/policies/_list.html.erb:8 ../app/views/policy_dashboard/_policy_reports.html.erb:12 ../app/views/scap_contents/_list.html.erb:6 ../app/views/tailoring_files/_list.html.erb:6
676
700
  msgid "Actions"
677
701
  msgstr ""
678
702
 
@@ -709,7 +733,7 @@ msgid "Total"
709
733
  msgstr ""
710
734
 
711
735
  #: ../app/views/arf_reports/_output.html.erb:4
712
- msgid "Severity"
736
+ msgid "Result"
713
737
  msgstr ""
714
738
 
715
739
  #: ../app/views/arf_reports/_output.html.erb:5
@@ -721,14 +745,14 @@ msgid "Resource"
721
745
  msgstr ""
722
746
 
723
747
  #: ../app/views/arf_reports/_output.html.erb:7
724
- msgid "Result"
748
+ msgid "Severity"
725
749
  msgstr ""
726
750
 
727
751
  #: ../app/views/arf_reports/_output.html.erb:25
728
752
  msgid "Nothing to show"
729
753
  msgstr ""
730
754
 
731
- #: ../app/views/arf_reports/delete_multiple.html.erb:7 ../app/views/policy_dashboard/_policy_reports.html.erb:3
755
+ #: ../app/views/arf_reports/delete_multiple.html.erb:7 ../app/views/policy_dashboard/_policy_reports.html.erb:6
732
756
  msgid "Host"
733
757
  msgstr ""
734
758
 
@@ -806,7 +830,7 @@ msgstr ""
806
830
  msgid "No report for this policy"
807
831
  msgstr ""
808
832
 
809
- #: ../app/views/dashboard/_compliance_host_reports_widget.html.erb:1 ../lib/foreman_openscap/engine.rb:153
833
+ #: ../app/views/dashboard/_compliance_host_reports_widget.html.erb:1 ../lib/foreman_openscap/engine.rb:154
810
834
  msgid "Latest Compliance Reports"
811
835
  msgstr ""
812
836
 
@@ -822,7 +846,7 @@ msgstr ""
822
846
  msgid "Policy is missing"
823
847
  msgstr ""
824
848
 
825
- #: ../app/views/dashboard/_compliance_reports_breakdown_widget.html.erb:1 ../lib/foreman_openscap/engine.rb:155
849
+ #: ../app/views/dashboard/_compliance_reports_breakdown_widget.html.erb:1 ../lib/foreman_openscap/engine.rb:156
826
850
  msgid "Compliance Reports Breakdown"
827
851
  msgstr ""
828
852
 
@@ -908,18 +932,6 @@ msgstr ""
908
932
  msgid "You can specify custom cron line, e.g. \"0 3 * * *\", separate each of 5 values by space"
909
933
  msgstr ""
910
934
 
911
- #: ../app/views/policies/_list.html.erb:3 ../app/views/tailoring_files/_list.html.erb:3
912
- msgid "Name"
913
- msgstr ""
914
-
915
- #: ../app/views/policies/_list.html.erb:4
916
- msgid "Content"
917
- msgstr ""
918
-
919
- #: ../app/views/policies/_list.html.erb:5
920
- msgid "Profile"
921
- msgstr ""
922
-
923
935
  #: ../app/views/policies/_list.html.erb:7
924
936
  msgid "Effective Profile"
925
937
  msgstr ""
@@ -929,11 +941,11 @@ msgid "None"
929
941
  msgstr ""
930
942
 
931
943
  #: ../app/views/policies/_list.html.erb:36
932
- msgid "Show Guide"
944
+ msgid "Dashboard"
933
945
  msgstr ""
934
946
 
935
- #: ../app/views/policies/_list.html.erb:37 ../app/views/scap_contents/_list.html.erb:17 ../app/views/tailoring_files/_list.html.erb:21
936
- msgid "Edit"
947
+ #: ../app/views/policies/_list.html.erb:37
948
+ msgid "Show Guide"
937
949
  msgstr ""
938
950
 
939
951
  #: ../app/views/policies/_list.html.erb:39
@@ -956,10 +968,6 @@ msgstr ""
956
968
  msgid "Compliance Policies"
957
969
  msgstr ""
958
970
 
959
- #: ../app/views/policies/index.html.erb:6 ../app/views/scap_contents/index.html.erb:4
960
- msgid "Help"
961
- msgstr ""
962
-
963
971
  #: ../app/views/policies/steps/_schedule_form.html.erb:9
964
972
  msgid "Choose day in month"
965
973
  msgstr ""
@@ -988,11 +996,15 @@ msgstr ""
988
996
  msgid "Host Breakdown Chart"
989
997
  msgstr ""
990
998
 
991
- #: ../app/views/policy_dashboard/_policy_reports.html.erb:4
999
+ #: ../app/views/policy_dashboard/_policy_reports.html.erb:7
1000
+ msgid "Policy assigned"
1001
+ msgstr ""
1002
+
1003
+ #: ../app/views/policy_dashboard/_policy_reports.html.erb:8
992
1004
  msgid "Date"
993
1005
  msgstr ""
994
1006
 
995
- #: ../app/views/policy_dashboard/_policy_reports.html.erb:19
1007
+ #: ../app/views/policy_dashboard/_policy_reports.html.erb:24
996
1008
  msgid "View Report"
997
1009
  msgstr ""
998
1010
 
@@ -1017,7 +1029,7 @@ msgid "Never audited"
1017
1029
  msgstr ""
1018
1030
 
1019
1031
  #: ../app/views/policy_dashboard/_policy_status_widget.html.erb:9
1020
- msgid "Total hosts: %s"
1032
+ msgid "Total hosts with policy: %s"
1021
1033
  msgstr ""
1022
1034
 
1023
1035
  #: ../app/views/policy_dashboard/index.html.erb:3
@@ -1044,12 +1056,12 @@ msgstr ""
1044
1056
  msgid "SCAP DataStream file"
1045
1057
  msgstr ""
1046
1058
 
1047
- #: ../app/views/scap_contents/_list.html.erb:18 ../app/views/tailoring_files/_list.html.erb:24
1059
+ #: ../app/views/scap_contents/_list.html.erb:17 ../app/views/tailoring_files/_list.html.erb:23
1048
1060
  msgid "Download"
1049
1061
  msgstr ""
1050
1062
 
1051
- #: ../app/views/scap_contents/_list.html.erb:20
1052
- msgid "Delete compliance policy %s with all the reports?"
1063
+ #: ../app/views/scap_contents/_list.html.erb:19
1064
+ msgid "Delete scap content %s?"
1053
1065
  msgstr ""
1054
1066
 
1055
1067
  #: ../app/views/scap_contents/edit.html.erb:1
@@ -1112,15 +1124,7 @@ msgstr ""
1112
1124
  msgid "DataStream Tailoring file"
1113
1125
  msgstr ""
1114
1126
 
1115
- #: ../app/views/tailoring_files/_list.html.erb:4
1116
- msgid "Filename"
1117
- msgstr ""
1118
-
1119
- #: ../app/views/tailoring_files/_list.html.erb:5
1120
- msgid "Created"
1121
- msgstr ""
1122
-
1123
- #: ../app/views/tailoring_files/_list.html.erb:23
1127
+ #: ../app/views/tailoring_files/_list.html.erb:22
1124
1128
  msgid "Delete tailoring file %s?"
1125
1129
  msgstr ""
1126
1130
 
@@ -1128,7 +1132,7 @@ msgstr ""
1128
1132
  msgid "Edit Tailoring File"
1129
1133
  msgstr ""
1130
1134
 
1131
- #: ../app/views/tailoring_files/edit.html.erb:4 ../app/views/tailoring_files/index.html.erb:1 ../app/views/tailoring_files/welcome.html.erb:1 ../app/views/tailoring_files/welcome.html.erb:6 ../lib/foreman_openscap/engine.rb:147
1135
+ #: ../app/views/tailoring_files/edit.html.erb:4 ../app/views/tailoring_files/index.html.erb:1 ../app/views/tailoring_files/welcome.html.erb:1 ../app/views/tailoring_files/welcome.html.erb:6 ../lib/foreman_openscap/engine.rb:148
1132
1136
  msgid "Tailoring Files"
1133
1137
  msgstr ""
1134
1138
 
@@ -1162,27 +1166,27 @@ msgstr ""
1162
1166
  msgid "A summary of reports for OpenSCAP policies"
1163
1167
  msgstr ""
1164
1168
 
1165
- #: ../lib/foreman_openscap/engine.rb:141
1169
+ #: ../lib/foreman_openscap/engine.rb:142
1166
1170
  msgid "SCAP contents"
1167
1171
  msgstr ""
1168
1172
 
1169
- #: ../lib/foreman_openscap/engine.rb:144
1173
+ #: ../lib/foreman_openscap/engine.rb:145
1170
1174
  msgid "Reports"
1171
1175
  msgstr ""
1172
1176
 
1173
- #: ../lib/foreman_openscap/engine.rb:169
1177
+ #: ../lib/foreman_openscap/engine.rb:170
1174
1178
  msgid "OpenSCAP Proxy to use for fetching SCAP content and uploading ARF reports. Leave blank and override appropriate parameters when using proxy load balancer."
1175
1179
  msgstr ""
1176
1180
 
1177
- #: ../lib/foreman_openscap/engine.rb:173 ../lib/foreman_openscap/engine.rb:178
1181
+ #: ../lib/foreman_openscap/engine.rb:174 ../lib/foreman_openscap/engine.rb:179
1178
1182
  msgid "OpenSCAP Proxy"
1179
1183
  msgstr ""
1180
1184
 
1181
- #: ../lib/foreman_openscap/engine.rb:175 ../lib/foreman_openscap/engine.rb:180
1185
+ #: ../lib/foreman_openscap/engine.rb:176 ../lib/foreman_openscap/engine.rb:181
1182
1186
  msgid "ID of OpenSCAP Proxy"
1183
1187
  msgstr ""
1184
1188
 
1185
- #: ../lib/foreman_openscap/engine.rb:184 ../lib/foreman_openscap/engine.rb:192
1189
+ #: ../lib/foreman_openscap/engine.rb:185 ../lib/foreman_openscap/engine.rb:193
1186
1190
  msgid "Run OpenSCAP scan"
1187
1191
  msgstr ""
1188
1192
 
@@ -151,9 +151,6 @@ msgstr ""
151
151
  msgid "Compliant with the policy"
152
152
  msgstr ""
153
153
 
154
- msgid "Content"
155
- msgstr ""
156
-
157
154
  msgid "Could not find host identified by: %s"
158
155
  msgstr ""
159
156
 
@@ -175,7 +172,7 @@ msgstr ""
175
172
  msgid "Create client"
176
173
  msgstr ""
177
174
 
178
- msgid "Created"
175
+ msgid "Dashboard"
179
176
  msgstr ""
180
177
 
181
178
  msgid "DataStream Tailoring file"
@@ -202,9 +199,6 @@ msgstr ""
202
199
  msgid "Delete compliance policy %s with all of its reports?"
203
200
  msgstr ""
204
201
 
205
- msgid "Delete compliance policy %s with all the reports?"
206
- msgstr ""
207
-
208
202
  msgid "Delete compliance report for %s?"
209
203
  msgstr ""
210
204
 
@@ -214,6 +208,9 @@ msgstr ""
214
208
  msgid "Delete reports"
215
209
  msgstr ""
216
210
 
211
+ msgid "Delete scap content %s?"
212
+ msgstr ""
213
+
217
214
  msgid "Delete tailoring file %s?"
218
215
  msgstr ""
219
216
 
@@ -256,9 +253,6 @@ msgstr ""
256
253
  msgid "Download bzipped ARF report"
257
254
  msgstr ""
258
255
 
259
- msgid "Edit"
260
- msgstr ""
261
-
262
256
  msgid "Edit Compliance Policy"
263
257
  msgstr ""
264
258
 
@@ -308,18 +302,12 @@ msgstr ""
308
302
  msgid "File Upload"
309
303
  msgstr ""
310
304
 
311
- msgid "Filename"
312
- msgstr ""
313
-
314
305
  msgid "Full Report"
315
306
  msgstr ""
316
307
 
317
308
  msgid "General"
318
309
  msgstr ""
319
310
 
320
- msgid "Help"
321
- msgstr ""
322
-
323
311
  msgid "Host"
324
312
  msgstr ""
325
313
 
@@ -338,9 +326,15 @@ msgstr ""
338
326
  msgid "Host does not exist anymore"
339
327
  msgstr ""
340
328
 
329
+ msgid "Host is assigned to policy"
330
+ msgstr ""
331
+
341
332
  msgid "Host is deleted"
342
333
  msgstr ""
343
334
 
335
+ msgid "Host is not assigned to policy but reports were found. You may want to delete the reports or assign the policy again."
336
+ msgstr ""
337
+
344
338
  msgid "Hostgroups"
345
339
  msgstr ""
346
340
 
@@ -353,6 +347,9 @@ msgstr ""
353
347
  msgid "Hosts failing this rule"
354
348
  msgstr ""
355
349
 
350
+ msgid "Hosts no longer assigned: %s"
351
+ msgstr ""
352
+
356
353
  msgid "Hosts othering this rule"
357
354
  msgstr ""
358
355
 
@@ -429,9 +426,6 @@ msgstr ""
429
426
  msgid "More details"
430
427
  msgstr ""
431
428
 
432
- msgid "Name"
433
- msgstr ""
434
-
435
429
  msgid "Never audited"
436
430
  msgstr ""
437
431
 
@@ -587,6 +581,9 @@ msgstr ""
587
581
  msgid "Policy SCAP content profile ID"
588
582
  msgstr ""
589
583
 
584
+ msgid "Policy assigned"
585
+ msgstr ""
586
+
590
587
  msgid "Policy description"
591
588
  msgstr ""
592
589
 
@@ -611,9 +608,6 @@ msgstr ""
611
608
  msgid "Policy with id %s not found."
612
609
  msgstr ""
613
610
 
614
- msgid "Profile"
615
- msgstr ""
616
-
617
611
  msgid "Proxy failed to send a report from spool to Foreman. This indicates a corrupted report format. Report has been moved to directory for storing corrupted files on proxy for later inspection."
618
612
  msgstr ""
619
613
 
@@ -722,6 +716,9 @@ msgstr ""
722
716
  msgid "Show an SCAP content"
723
717
  msgstr ""
724
718
 
719
+ msgid "Show config information for foreman_scap_client"
720
+ msgstr ""
721
+
725
722
  msgid "Show log messages:"
726
723
  msgstr ""
727
724
 
@@ -790,6 +787,9 @@ msgstr ""
790
787
  msgid "The following proxies could not be reached: %s. Please make sure they are available so Foreman can check their versions."
791
788
  msgstr ""
792
789
 
790
+ msgid "The identifier of the host"
791
+ msgstr ""
792
+
793
793
  msgid "This feature is temporarily disabled. "
794
794
  msgstr ""
795
795
 
@@ -799,7 +799,10 @@ msgstr ""
799
799
  msgid "Total"
800
800
  msgstr ""
801
801
 
802
- msgid "Total hosts: %s"
802
+ msgid "Total hosts with policy: %s"
803
+ msgstr ""
804
+
805
+ msgid "Total hosts with reports where policy is no longer assigned."
803
806
  msgstr ""
804
807
 
805
808
  msgid "Total of one host"
@@ -0,0 +1,17 @@
1
+ require 'test_plugin_helper'
2
+
3
+ module Api
4
+ module V2
5
+ class HostsControllerTest < ActionController::TestCase
6
+ test "should get policies enc" do
7
+ policy = FactoryBot.create(:policy)
8
+ host = FactoryBot.create(:compliance_host, :policies => [policy])
9
+
10
+ get :policies_enc, :params => { :id => host.id }, :session => set_session_user
11
+ assert_response :success
12
+ response = ActiveSupport::JSON.decode(@response.body)
13
+ assert_equal policy.id, response.first['id']
14
+ end
15
+ end
16
+ end
17
+ end
@@ -54,7 +54,12 @@ module ScapTestCommon
54
54
 
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
- report = FactoryBot.create(:arf_report, :host_id => host.id)
57
+ metrics = {
58
+ 'passed' => rule_results.select { |result| result == 'pass' }.count,
59
+ 'failed' => rule_results.select { |result| result == 'fail' }.count,
60
+ 'othered' => rule_results.reject { |result| result == 'fail' || result == 'pass' }.count
61
+ }
62
+ report = FactoryBot.create(:arf_report, :host_id => host.id, :metrics => metrics, :status => metrics)
58
63
  rule_names.each_with_index do |item, index|
59
64
  source = FactoryBot.create(:compliance_source, :value => rule_names[index])
60
65
  log = FactoryBot.create(:compliance_log, :source => source, :report => report, :result => rule_results[index])
@@ -117,6 +117,45 @@ class HostExtensionsTest < ActiveSupport::TestCase
117
117
  end
118
118
  end
119
119
 
120
+ test 'should find hosts by compliance with policy using scoped search' do
121
+ rule_names = ['xccdf_org.something', 'xccdf_org.nothing']
122
+ rule_results_1 = ['pass', 'pass']
123
+ rule_results_2 = ['fail', 'pass']
124
+ rule_results_3 = ['notchecked', 'pass']
125
+ host_1 = setup_host_with_reports_and_rules([rule_names, rule_names], [rule_results_2, rule_results_1], @policy)
126
+ host_2 = setup_host_with_reports_and_rules([rule_names, rule_names], [rule_results_1, rule_results_2], @policy)
127
+ host_3 = setup_host_with_reports_and_rules([rule_names, rule_names], [rule_results_1, rule_results_3], @policy)
128
+
129
+ compliant = Host.search_for "comply_with = #{@policy.name}"
130
+ assert_equal [host_1], compliant
131
+
132
+ incompliant = Host.search_for "not_comply_with = #{@policy.name}"
133
+ assert_equal [host_2], incompliant
134
+
135
+ inconclusive = Host.search_for "inconclusive_with = #{@policy.name}"
136
+ assert_equal [host_3], inconclusive
137
+ end
138
+
139
+ test "should find hosts removed from policy" do
140
+ rule_names = ['xccdf_org.something', 'xccdf_org.nothing']
141
+ rule_results = ['pass', 'pass']
142
+ host_1 = setup_host_with_reports_and_rules([rule_names], [rule_results], @policy)
143
+ host_2 = setup_host_with_reports_and_rules([rule_names], [rule_results], @policy)
144
+
145
+ scap_content = FactoryBot.create(:scap_content)
146
+ scap_content_profile = FactoryBot.create(:scap_content_profile, :scap_content => scap_content)
147
+ different_policy = FactoryBot.create(:policy, :scap_content => scap_content, :scap_content_profile => scap_content_profile)
148
+
149
+ report = FactoryBot.create(:arf_report, :host_id => host_2.id)
150
+ FactoryBot.create(:policy_arf_report, :policy_id => different_policy.id, :arf_report_id => report.id)
151
+
152
+ removed = Host.removed_from_policy different_policy
153
+ not_removed = Host.removed_from_policy @policy
154
+
155
+ assert_equal [host_2], removed
156
+ assert_empty not_removed
157
+ end
158
+
120
159
  private
121
160
 
122
161
  def setup_hosts_with_policy
@@ -144,6 +183,8 @@ class HostExtensionsTest < ActiveSupport::TestCase
144
183
  def setup_host_with_reports_and_rules(rule_names_ary, rule_results_ary, policy)
145
184
  raise "rule_names_ary must have the same length as rule_results_ary" if rule_names_ary.size != rule_results_ary.size
146
185
  host = FactoryBot.create(:host)
186
+ asset = FactoryBot.create(:asset, :assetable_id => host.id)
187
+ FactoryBot.create(:asset_policy, :asset_id => asset.id, :policy_id => policy.id)
147
188
  rule_names_ary.each_with_index do |item, index|
148
189
  report = create_report_with_rules host, rule_names_ary[index], rule_results_ary[index]
149
190
  FactoryBot.create(:policy_arf_report, :policy_id => policy.id, :arf_report_id => report.id)