foreman_openscap 13.1.2 → 13.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_openscap/locale/de/foreman_openscap.js +5 -5
  3. data/app/assets/javascripts/foreman_openscap/locale/en/foreman_openscap.js +1 -1
  4. data/app/assets/javascripts/foreman_openscap/locale/en_GB/foreman_openscap.js +1 -1
  5. data/app/assets/javascripts/foreman_openscap/locale/es/foreman_openscap.js +1 -1
  6. data/app/assets/javascripts/foreman_openscap/locale/fr/foreman_openscap.js +26 -24
  7. data/app/assets/javascripts/foreman_openscap/locale/gl/foreman_openscap.js +1 -1
  8. data/app/assets/javascripts/foreman_openscap/locale/it/foreman_openscap.js +1 -1
  9. data/app/assets/javascripts/foreman_openscap/locale/ja/foreman_openscap.js +26 -28
  10. data/app/assets/javascripts/foreman_openscap/locale/ka/foreman_openscap.js +5 -5
  11. data/app/assets/javascripts/foreman_openscap/locale/ko/foreman_openscap.js +26 -28
  12. data/app/assets/javascripts/foreman_openscap/locale/pt_BR/foreman_openscap.js +1 -1
  13. data/app/assets/javascripts/foreman_openscap/locale/ru/foreman_openscap.js +1 -1
  14. data/app/assets/javascripts/foreman_openscap/locale/sv_SE/foreman_openscap.js +1 -1
  15. data/app/assets/javascripts/foreman_openscap/locale/zh_CN/foreman_openscap.js +22 -24
  16. data/app/assets/javascripts/foreman_openscap/locale/zh_TW/foreman_openscap.js +1 -1
  17. data/app/controllers/api/v2/compliance/hosts_bulk_actions_controller.rb +38 -1
  18. data/app/controllers/policies_controller.rb +1 -1
  19. data/app/models/concerns/foreman_openscap/host_extensions.rb +10 -4
  20. data/app/models/concerns/foreman_openscap/hostgroup_extensions.rb +7 -0
  21. data/app/models/foreman_openscap/asset.rb +21 -1
  22. data/app/models/foreman_openscap/compliance_status.rb +19 -7
  23. data/app/models/foreman_openscap/policy.rb +43 -3
  24. data/app/services/foreman_openscap/compliance_status_resetter.rb +26 -0
  25. data/config/routes.rb +2 -0
  26. data/lib/foreman_openscap/engine.rb +3 -1
  27. data/lib/foreman_openscap/version.rb +1 -1
  28. data/locale/de/LC_MESSAGES/foreman_openscap.mo +0 -0
  29. data/locale/de/foreman_openscap.po +5 -5
  30. data/locale/en/LC_MESSAGES/foreman_openscap.mo +0 -0
  31. data/locale/en/foreman_openscap.po +1 -1
  32. data/locale/en_GB/LC_MESSAGES/foreman_openscap.mo +0 -0
  33. data/locale/en_GB/foreman_openscap.po +1 -1
  34. data/locale/es/LC_MESSAGES/foreman_openscap.mo +0 -0
  35. data/locale/es/foreman_openscap.po +1 -1
  36. data/locale/foreman_openscap.pot +2 -2
  37. data/locale/fr/LC_MESSAGES/foreman_openscap.mo +0 -0
  38. data/locale/fr/foreman_openscap.po +26 -24
  39. data/locale/gl/LC_MESSAGES/foreman_openscap.mo +0 -0
  40. data/locale/gl/foreman_openscap.po +1 -1
  41. data/locale/it/LC_MESSAGES/foreman_openscap.mo +0 -0
  42. data/locale/it/foreman_openscap.po +1 -1
  43. data/locale/ja/LC_MESSAGES/foreman_openscap.mo +0 -0
  44. data/locale/ja/foreman_openscap.po +26 -28
  45. data/locale/ka/LC_MESSAGES/foreman_openscap.mo +0 -0
  46. data/locale/ka/foreman_openscap.po +5 -5
  47. data/locale/ko/LC_MESSAGES/foreman_openscap.mo +0 -0
  48. data/locale/ko/foreman_openscap.po +26 -28
  49. data/locale/pt_BR/LC_MESSAGES/foreman_openscap.mo +0 -0
  50. data/locale/pt_BR/foreman_openscap.po +1 -1
  51. data/locale/ru/LC_MESSAGES/foreman_openscap.mo +0 -0
  52. data/locale/ru/foreman_openscap.po +1 -1
  53. data/locale/sv_SE/LC_MESSAGES/foreman_openscap.mo +0 -0
  54. data/locale/sv_SE/foreman_openscap.po +1 -1
  55. data/locale/zh_CN/LC_MESSAGES/foreman_openscap.mo +0 -0
  56. data/locale/zh_CN/foreman_openscap.po +22 -24
  57. data/locale/zh_TW/LC_MESSAGES/foreman_openscap.mo +0 -0
  58. data/locale/zh_TW/foreman_openscap.po +1 -1
  59. data/test/functional/api/v2/compliance/hosts_bulk_actions_controller_test.rb +175 -1
  60. data/test/test_plugin_helper.rb +7 -0
  61. data/test/unit/compliance_status_resetter_test.rb +48 -0
  62. data/test/unit/compliance_status_test.rb +53 -4
  63. data/test/unit/concerns/host_extensions_test.rb +55 -0
  64. data/test/unit/concerns/hostgroup_extensions_test.rb +64 -0
  65. data/test/unit/policy_test.rb +90 -0
  66. data/webpack/components/BulkActions/compliancePolicy/BulkCompliancePolicyMenuItems.js +49 -0
  67. data/webpack/components/BulkActions/compliancePolicy/BulkCompliancePolicyModal.js +304 -0
  68. data/webpack/components/BulkActions/compliancePolicy/BulkCompliancePolicyModalScene.js +65 -0
  69. data/webpack/components/BulkActions/compliancePolicy/__tests__/actions.test.js +121 -0
  70. data/webpack/components/BulkActions/compliancePolicy/actions.js +32 -0
  71. data/webpack/components/BulkActions/compliancePolicy/constants.js +8 -0
  72. data/webpack/global_index.js +27 -1
  73. metadata +10 -1
@@ -47,7 +47,7 @@ msgid "%s reports over time"
47
47
  msgstr "기간별 %s 보고서"
48
48
 
49
49
  msgid "%s selected hosts."
50
- msgstr ""
50
+ msgstr "%s개 호스트가 선택되었습니다."
51
51
 
52
52
  msgid "%s spool errors detected, inspect the appropriate file directly on proxy"
53
53
  msgstr "%s spool 오류가 감지되었습니다. 프록시에서 직접 해당 파일을 검사하세요."
@@ -68,7 +68,7 @@ msgid "A summary of reports for OpenSCAP policies"
68
68
  msgstr "OpenSCAP 정책에 대한 보고서 요약"
69
69
 
70
70
  msgid "ALL selected hosts."
71
- msgstr ""
71
+ msgstr "선택한 모든 호스트"
72
72
 
73
73
  msgid "Actions"
74
74
  msgstr "동작 "
@@ -89,19 +89,19 @@ msgid "Apply policy to hosts"
89
89
  msgstr "호스트에 정책 적용"
90
90
 
91
91
  msgid "Assign"
92
- msgstr ""
92
+ msgstr "할당"
93
93
 
94
94
  msgid "Assign Compliance Policy"
95
95
  msgstr "컴플라이언스 정책 할당"
96
96
 
97
97
  msgid "Assign OpenSCAP Proxy"
98
- msgstr ""
98
+ msgstr "OpenSCAP 프록시 할당"
99
99
 
100
100
  msgid "Assign OpenSCAP Proxy for "
101
- msgstr ""
101
+ msgstr "OpenSCAP 프록시 할당 대상"
102
102
 
103
103
  msgid "Assign OpenSCAP Proxy to multiple hosts"
104
- msgstr ""
104
+ msgstr "여러 호스트에 OpenSCAP 프록시 할당"
105
105
 
106
106
  msgid "Back"
107
107
  msgstr "뒤로 "
@@ -293,7 +293,7 @@ msgid "Download bzipped ARF report"
293
293
  msgstr "bzipped ARF 보고서 다운로드"
294
294
 
295
295
  msgid "Edit %s"
296
- msgstr "%s 편집 "
296
+ msgstr "%s 편집"
297
297
 
298
298
  msgid "Effective Profile"
299
299
  msgstr "효과적인 프로필"
@@ -321,8 +321,7 @@ msgstr "%s 저장에 실패했습니다:"
321
321
 
322
322
  msgid "Failed to assign OpenSCAP Proxy to %{failed} of %{total} host."
323
323
  msgid_plural "Failed to assign OpenSCAP Proxy to %{failed} of %{total} hosts."
324
- msgstr[0] ""
325
- msgstr[1] ""
324
+ msgstr[0] "%{total}개 호스트 중 %{failed}개 호스트에 OpenSCAP 프록시를 할당하지 못했습니다."
326
325
 
327
326
  msgid "Failed to delete %s compliance reports"
328
327
  msgstr "%s 컴플라이언스 보고서를 삭제하지 못했습니다."
@@ -413,10 +412,10 @@ msgid "Hosts passing this rule"
413
412
  msgstr "이 규칙을 통과하는 호스트"
414
413
 
415
414
  msgid "Hosts to explicitly exclude in the action. All other hosts will be included in the action, unless an included parameter is passed as well."
416
- msgstr ""
415
+ msgstr "작업에서 명시적으로 제외할 호스트. 포함된 매개변수가 전달되지 않는 한 다른 모든 호스트는 작업에 포함됩니다."
417
416
 
418
417
  msgid "Hosts to include in the action"
419
- msgstr ""
418
+ msgstr "작업에 포함할 호스트"
420
419
 
421
420
  msgid "How the policy should be deployed"
422
421
  msgstr "정책이 어떻게 배포되어야 하는가"
@@ -425,7 +424,7 @@ msgid "ID of OpenSCAP Proxy"
425
424
  msgstr "OpenSCAP 프록시 ID"
426
425
 
427
426
  msgid "ID of the OpenSCAP Proxy to assign to the hosts"
428
- msgstr ""
427
+ msgstr "호스트에 할당할 OpenSCAP 프록시의 ID"
429
428
 
430
429
  msgid "In Foreman, a compliance policy checklist is defined via %s."
431
430
  msgstr "Foreman에서는 컴플라이언스 정책 체크리스트는 %s을/를 통해 정의됩니다."
@@ -465,7 +464,7 @@ msgid "Latest reports for policy: %s"
465
464
  msgstr "정책에 대한 최신 보고서: %s"
466
465
 
467
466
  msgid "Line chart"
468
- msgstr ""
467
+ msgstr "선 그래프"
469
468
 
470
469
  msgid "List ARF reports"
471
470
  msgstr "ARF 보고서 목록"
@@ -483,16 +482,16 @@ msgid "List Tailoring files"
483
482
  msgstr "맞춤형 파일 목록"
484
483
 
485
484
  msgid "List of host ids to exclude and not perform the action on"
486
- msgstr ""
485
+ msgstr "제외하고 작업을 수행하지 않을 호스트 ID 목록"
487
486
 
488
487
  msgid "List of host ids to perform the action on"
489
- msgstr ""
488
+ msgstr "작업을 수행할 호스트 ID 목록"
490
489
 
491
490
  msgid "Loading"
492
- msgstr ""
491
+ msgstr "로딩 중"
493
492
 
494
493
  msgid "Loading..."
495
- msgstr "로딩..."
494
+ msgstr "로딩 중..."
496
495
 
497
496
  msgid "Locations"
498
497
  msgstr "위치"
@@ -537,7 +536,7 @@ msgid "No ARF reports for this policy"
537
536
  msgstr "이 정책에 대한 ARF 보고서가 없습니다."
538
537
 
539
538
  msgid "No OpenSCAP Proxies available. Please configure a Smart Proxy with the OpenSCAP feature."
540
- msgstr ""
539
+ msgstr "사용 가능한 OpenSCAP 프록시가 없습니다. OpenSCAP 기능을 갖춘 Smart Proxy를 구성하십시오."
541
540
 
542
541
  msgid "No OpenSCAP Proxy selected."
543
542
  msgstr "OpenSCAP 프록시가 선택되지 않았습니다."
@@ -561,7 +560,7 @@ msgid "No compliance reports were found."
561
560
  msgstr "컴플라이언트 보고서를 찾을 수 없습니다."
562
561
 
563
562
  msgid "No data available"
564
- msgstr ""
563
+ msgstr "사용 가능한 데이터가 없음"
565
564
 
566
565
  msgid "No hosts selected"
567
566
  msgstr "선택된 호스트가 없음"
@@ -627,13 +626,13 @@ msgid "OpenSCAP Proxy"
627
626
  msgstr "OpenSCAP Proxy"
628
627
 
629
628
  msgid "OpenSCAP Proxy is set to %s"
630
- msgstr ""
629
+ msgstr "OpenSCAP 프록시가 %s(으)로 설정되었습니다."
631
630
 
632
631
  msgid "OpenSCAP Proxy to use for fetching SCAP content and uploading ARF reports. Leave blank and override appropriate parameters when using proxy load balancer."
633
632
  msgstr "SCAP 콘텐츠를 가져오고 ARF 보고서를 업로드하는 데 사용할 OpenSCAP 프록시입니다. 프록시 로드 밸런서를 사용할 때는 공백으로 두고 적절한 매개변수를 재정의합니다."
634
633
 
635
634
  msgid "OpenSCAP Proxy with id %s not found"
636
- msgstr ""
635
+ msgstr "ID가 %s인 OpenSCAP 프록시를 찾을 수 없습니다."
637
636
 
638
637
  msgid "Openscap Proxy"
639
638
  msgstr "Openscap 프록시"
@@ -773,7 +772,7 @@ msgid "Request timed out. Please try increasing Settings -> proxy_request_timeou
773
772
  msgstr "요청 시간이 초과되었습니다. 설정 -> proxy_request_timeout을 늘려보세요."
774
773
 
775
774
  msgid "Required %{msg_name} %{class} was not found, please ensure it is imported first."
776
- msgstr "필수의 %{msg_name} %{class} 을/를 찾을 수 없습니다. 먼저 가져왔는지 확인하세요."
775
+ msgstr "필수의 %{msg_name} %{class}을/를 찾을 수 없습니다. 먼저 가져왔는지 확인하세요."
777
776
 
778
777
  msgid "Requires %s Puppet class. This will assign the class to the hosts or selected hostgroups."
779
778
  msgstr "%s Puppet 클래스가 필요합니다. 이는 클래스를 호스트 또는 선택된 호스트그룹에 할당합니다."
@@ -839,7 +838,7 @@ msgid "Schedule"
839
838
  msgstr "스케줄 "
840
839
 
841
840
  msgid "Search string describing which hosts to perform the action on"
842
- msgstr ""
841
+ msgstr "작업을 수행할 호스트를 설명하는 검색 문자열"
843
842
 
844
843
  msgid "Select Action"
845
844
  msgstr "작업 선택"
@@ -893,7 +892,7 @@ msgid "Smart Class Parameters"
893
892
  msgstr "스마트 클래스 매개변수"
894
893
 
895
894
  msgid "Snippet"
896
- msgstr "조각 모음 "
895
+ msgstr "스니펫"
897
896
 
898
897
  msgid "Something went wrong while selecting compliance reports - %s"
899
898
  msgstr "컴플라이언스 보고서를 선택하는 도중 문제가 발생했습니다 - %s"
@@ -924,8 +923,7 @@ msgstr "ARF 보고서를 성공적으로 삭제했습니다."
924
923
 
925
924
  msgid "Successfully updated %{success} host."
926
925
  msgid_plural "Successfully updated %{success} hosts."
927
- msgstr[0] ""
928
- msgstr[1] ""
926
+ msgstr[0] "%{success}개 호스트를 성공적으로 업데이트했습니다."
929
927
 
930
928
  msgid "Summary from %{time} ago to now"
931
929
  msgstr "%{time} 전에서 현재까지의 요약"
@@ -972,7 +970,7 @@ msgid "The job has started on selected host(s), you can check the status on the
972
970
  msgstr "선택한 호스트에서 작업이 시작되었습니다. 작업 세부 정보 페이지에서 상태를 확인할 수 있습니다."
973
971
 
974
972
  msgid "The selected OpenSCAP Proxy does not have the OpenSCAP feature enabled."
975
- msgstr ""
973
+ msgstr "선택한 OpenSCAP 프록시에 OpenSCAP 기능이 활성화되어 있지 않습니다."
976
974
 
977
975
  msgid "There are significant differences in deployment options."
978
976
  msgstr "배포 옵션에는 상당한 차이가 있습니다."
@@ -990,7 +988,7 @@ msgid "This profile will be used to override the one from scap content"
990
988
  msgstr "이 프로필은 scap 콘텐츠의 프로필을 재정의하는 데 사용됩니다."
991
989
 
992
990
  msgid "This will change previous proxy assignments on the selected hosts."
993
- msgstr ""
991
+ msgstr "이렇게 하면 선택한 호스트에 대한 기존 프록시 할당이 변경됩니다."
994
992
 
995
993
  msgid "Title"
996
994
  msgstr "제목"
@@ -496,7 +496,7 @@ msgid "List of host ids to perform the action on"
496
496
  msgstr ""
497
497
 
498
498
  msgid "Loading"
499
- msgstr ""
499
+ msgstr "Carregando"
500
500
 
501
501
  msgid "Loading..."
502
502
  msgstr "Carregando..."
@@ -493,7 +493,7 @@ msgid "List of host ids to perform the action on"
493
493
  msgstr ""
494
494
 
495
495
  msgid "Loading"
496
- msgstr ""
496
+ msgstr "Загружается"
497
497
 
498
498
  msgid "Loading..."
499
499
  msgstr "Загрузка..."
@@ -489,7 +489,7 @@ msgid "List of host ids to perform the action on"
489
489
  msgstr ""
490
490
 
491
491
  msgid "Loading"
492
- msgstr ""
492
+ msgstr "Laddar"
493
493
 
494
494
  msgid "Loading..."
495
495
  msgstr ""
@@ -47,7 +47,7 @@ msgid "%s reports over time"
47
47
  msgstr "一直以來的 %s 报告"
48
48
 
49
49
  msgid "%s selected hosts."
50
- msgstr ""
50
+ msgstr "%{failed} 所选的主机"
51
51
 
52
52
  msgid "%s spool errors detected, inspect the appropriate file directly on proxy"
53
53
  msgstr "发现了 %s 个 spool 错误,在代理上直接检查相关的文件"
@@ -68,7 +68,7 @@ msgid "A summary of reports for OpenSCAP policies"
68
68
  msgstr "OpenSCAP 策略报告摘要"
69
69
 
70
70
  msgid "ALL selected hosts."
71
- msgstr ""
71
+ msgstr "所有选定的主机。"
72
72
 
73
73
  msgid "Actions"
74
74
  msgstr "操作"
@@ -89,19 +89,19 @@ msgid "Apply policy to hosts"
89
89
  msgstr "对主机应用策略"
90
90
 
91
91
  msgid "Assign"
92
- msgstr ""
92
+ msgstr "分配"
93
93
 
94
94
  msgid "Assign Compliance Policy"
95
95
  msgstr "分配合规政策"
96
96
 
97
97
  msgid "Assign OpenSCAP Proxy"
98
- msgstr ""
98
+ msgstr "分配 OpenSCAP 代理"
99
99
 
100
100
  msgid "Assign OpenSCAP Proxy for "
101
- msgstr ""
101
+ msgstr "分配 OpenSCAP 代理 "
102
102
 
103
103
  msgid "Assign OpenSCAP Proxy to multiple hosts"
104
- msgstr ""
104
+ msgstr "为多个主机分配 OpenSCAP 代理"
105
105
 
106
106
  msgid "Back"
107
107
  msgstr "返回"
@@ -321,8 +321,7 @@ msgstr "保存失败 %s:"
321
321
 
322
322
  msgid "Failed to assign OpenSCAP Proxy to %{failed} of %{total} host."
323
323
  msgid_plural "Failed to assign OpenSCAP Proxy to %{failed} of %{total} hosts."
324
- msgstr[0] ""
325
- msgstr[1] ""
324
+ msgstr[0] "将 OpenSCAP 代理分配给 %{total} 主机的 %{failed} 失败。"
326
325
 
327
326
  msgid "Failed to delete %s compliance reports"
328
327
  msgstr "刪除 %s 合规报告失败"
@@ -413,10 +412,10 @@ msgid "Hosts passing this rule"
413
412
  msgstr "主机通过了这个规则"
414
413
 
415
414
  msgid "Hosts to explicitly exclude in the action. All other hosts will be included in the action, unless an included parameter is passed as well."
416
- msgstr ""
415
+ msgstr "主机明确排除在操作之外。除非还传递了包含的参数,否则所有其他主机都将包含在操作中。"
417
416
 
418
417
  msgid "Hosts to include in the action"
419
- msgstr ""
418
+ msgstr "操作中要包含的主机"
420
419
 
421
420
  msgid "How the policy should be deployed"
422
421
  msgstr "应如何部署策略"
@@ -425,7 +424,7 @@ msgid "ID of OpenSCAP Proxy"
425
424
  msgstr "OpenSCAP 代理服务器的 ID"
426
425
 
427
426
  msgid "ID of the OpenSCAP Proxy to assign to the hosts"
428
- msgstr ""
427
+ msgstr "分配给主机的 OpenSCAP 代理的 ID"
429
428
 
430
429
  msgid "In Foreman, a compliance policy checklist is defined via %s."
431
430
  msgstr "在 Foreman 中,合规策略检查清单通过 %s 定义。"
@@ -469,7 +468,7 @@ msgid "Latest reports for policy: %s"
469
468
  msgstr "最新的政策报告:%s"
470
469
 
471
470
  msgid "Line chart"
472
- msgstr ""
471
+ msgstr "折线图"
473
472
 
474
473
  msgid "List ARF reports"
475
474
  msgstr "列出 ARF 报告"
@@ -487,13 +486,13 @@ msgid "List Tailoring files"
487
486
  msgstr "列出 Tailoring 文件"
488
487
 
489
488
  msgid "List of host ids to exclude and not perform the action on"
490
- msgstr ""
489
+ msgstr "要排除的主机 ID 列表,不对其执行操作"
491
490
 
492
491
  msgid "List of host ids to perform the action on"
493
- msgstr ""
492
+ msgstr "要执行操作的主机 ID 列表"
494
493
 
495
494
  msgid "Loading"
496
- msgstr ""
495
+ msgstr "加载"
497
496
 
498
497
  msgid "Loading..."
499
498
  msgstr "载入中..."
@@ -541,7 +540,7 @@ msgid "No ARF reports for this policy"
541
540
  msgstr "此政策沒有 ARF 報告"
542
541
 
543
542
  msgid "No OpenSCAP Proxies available. Please configure a Smart Proxy with the OpenSCAP feature."
544
- msgstr ""
543
+ msgstr "没有可用的 OpenSCAP 代理。请使用 OpenSCAP 功能配置智能代理。"
545
544
 
546
545
  msgid "No OpenSCAP Proxy selected."
547
546
  msgstr "没有选择 OpenSCAP 代理。"
@@ -565,7 +564,7 @@ msgid "No compliance reports were found."
565
564
  msgstr "没有找到合规报告。"
566
565
 
567
566
  msgid "No data available"
568
- msgstr ""
567
+ msgstr "无可用数据"
569
568
 
570
569
  msgid "No hosts selected"
571
570
  msgstr "未选择主机"
@@ -631,13 +630,13 @@ msgid "OpenSCAP Proxy"
631
630
  msgstr "OpenSCAP 代理"
632
631
 
633
632
  msgid "OpenSCAP Proxy is set to %s"
634
- msgstr ""
633
+ msgstr "OpenSCAP 代理被设置为 %s"
635
634
 
636
635
  msgid "OpenSCAP Proxy to use for fetching SCAP content and uploading ARF reports. Leave blank and override appropriate parameters when using proxy load balancer."
637
636
  msgstr "用来获取 SCAP 内容以及上传 ARF 报告的 OpenSCAP 代理。如果为空,则在使用代理负责均衡器时覆盖相应的参数。"
638
637
 
639
638
  msgid "OpenSCAP Proxy with id %s not found"
640
- msgstr ""
639
+ msgstr "未找到 ID 为 %s 的 OpenSCAP 代理"
641
640
 
642
641
  msgid "Openscap Proxy"
643
642
  msgstr "Openscap 代理"
@@ -843,7 +842,7 @@ msgid "Schedule"
843
842
  msgstr "调度"
844
843
 
845
844
  msgid "Search string describing which hosts to perform the action on"
846
- msgstr ""
845
+ msgstr "搜索字符串,描述要对其执行操作的主机"
847
846
 
848
847
  msgid "Select Action"
849
848
  msgstr "选择操作"
@@ -928,8 +927,7 @@ msgstr "成功删除了 ARF 报告。"
928
927
 
929
928
  msgid "Successfully updated %{success} host."
930
929
  msgid_plural "Successfully updated %{success} hosts."
931
- msgstr[0] ""
932
- msgstr[1] ""
930
+ msgstr[0] "成功更新了 %{success} 主机。"
933
931
 
934
932
  msgid "Summary from %{time} ago to now"
935
933
  msgstr "从 %{time} 到现在的摘要"
@@ -978,7 +976,7 @@ msgid "The job has started on selected host(s), you can check the status on the
978
976
  msgstr "作业已在所选主机上启动,您可以在详情页中检查作业的状态。"
979
977
 
980
978
  msgid "The selected OpenSCAP Proxy does not have the OpenSCAP feature enabled."
981
- msgstr ""
979
+ msgstr "所选的 OpenSCAP 代理没有启用 OpenSCAP 功能。"
982
980
 
983
981
  msgid "There are significant differences in deployment options."
984
982
  msgstr "部署选项之间存在重大差异。"
@@ -996,7 +994,7 @@ msgid "This profile will be used to override the one from scap content"
996
994
  msgstr "这个配置文件将用于覆盖 scap 内容中的配置文件"
997
995
 
998
996
  msgid "This will change previous proxy assignments on the selected hosts."
999
- msgstr ""
997
+ msgstr "这将更改所选主机上的以前的代理分配。"
1000
998
 
1001
999
  msgid "Title"
1002
1000
  msgstr "提示"
@@ -490,7 +490,7 @@ msgid "List of host ids to perform the action on"
490
490
  msgstr ""
491
491
 
492
492
  msgid "Loading"
493
- msgstr ""
493
+ msgstr "載入中"
494
494
 
495
495
  msgid "Loading..."
496
496
  msgstr "載入中…"
@@ -3,7 +3,7 @@ require 'test_plugin_helper'
3
3
  class Api::V2::Compliance::HostsBulkActionsControllerTest < ActionController::TestCase
4
4
  tests Api::V2::Compliance::HostsBulkActionsController
5
5
 
6
- def setup
6
+ setup do
7
7
  as_admin do
8
8
  @organization = FactoryBot.create(:organization)
9
9
  @location = FactoryBot.create(:location)
@@ -17,6 +17,10 @@ class Api::V2::Compliance::HostsBulkActionsControllerTest < ActionController::Te
17
17
  :organization => @organization,
18
18
  :location => @location)
19
19
  @host_ids = [@host1.id, @host2.id]
20
+ @policy = FactoryBot.create(:policy,
21
+ :organizations => [@organization],
22
+ :locations => [@location])
23
+ @policy.scap_content.update(:organization_ids => [@organization.id], :location_ids => [@location.id])
20
24
  end
21
25
  end
22
26
 
@@ -129,4 +133,174 @@ class Api::V2::Compliance::HostsBulkActionsControllerTest < ActionController::Te
129
133
  refute_match(/Successfully updated/, response['error']['message'])
130
134
  assert_equal @host_ids.sort, response['error']['failed_host_ids'].sort
131
135
  end
136
+
137
+ test "should assign compliance policy to selected hosts" do
138
+ put :assign_compliance_policy,
139
+ params: valid_bulk_params.merge(:policy_id => @policy.id),
140
+ session: set_session_user
141
+
142
+ assert_response :success
143
+ response = ActiveSupport::JSON.decode(@response.body)
144
+ assert_match(/Updated hosts: Assigned with compliance policy/, response['message'])
145
+ assert_includes response['message'], @policy.name
146
+
147
+ @policy.reload
148
+ assert_includes @policy.hosts.map(&:id), @host1.id
149
+ assert_includes @policy.hosts.map(&:id), @host2.id
150
+ end
151
+
152
+ test "should assign compliance policy to a single host" do
153
+ put :assign_compliance_policy,
154
+ params: valid_bulk_params([@host1.id]).merge(:policy_id => @policy.id),
155
+ session: set_session_user
156
+
157
+ assert_response :success
158
+ response = ActiveSupport::JSON.decode(@response.body)
159
+ assert_match(/Updated host: Assigned with compliance policy/, response['message'])
160
+
161
+ @policy.reload
162
+ assert_includes @policy.hosts.map(&:id), @host1.id
163
+ refute_includes @policy.hosts.map(&:id), @host2.id
164
+ end
165
+
166
+ test "should require policy_id for assign" do
167
+ put :assign_compliance_policy,
168
+ params: valid_bulk_params,
169
+ session: set_session_user
170
+
171
+ assert_response :unprocessable_entity
172
+ response = ActiveSupport::JSON.decode(@response.body)
173
+ assert_match(/policy_id/, response['error']['message'])
174
+ end
175
+
176
+ test "should return error when policy is not found for assign" do
177
+ put :assign_compliance_policy,
178
+ params: valid_bulk_params.merge(:policy_id => 0),
179
+ session: set_session_user
180
+
181
+ assert_response :unprocessable_entity
182
+ response = ActiveSupport::JSON.decode(@response.body)
183
+ assert_match(/Compliance policy with id .* not found/, response['error']['message'])
184
+ end
185
+
186
+ test "should unassign compliance policy from selected hosts" do
187
+ as_admin do
188
+ @host1.policies = [@policy]
189
+ @host1.save!
190
+ @host2.policies = [@policy]
191
+ @host2.save!
192
+ end
193
+
194
+ put :unassign_compliance_policy,
195
+ params: valid_bulk_params.merge(:policy_id => @policy.id),
196
+ session: set_session_user
197
+
198
+ assert_response :success
199
+ response = ActiveSupport::JSON.decode(@response.body)
200
+ assert_match(/Updated hosts: Unassigned from compliance policy/, response['message'])
201
+ assert_includes response['message'], @policy.name
202
+
203
+ @policy.reload
204
+ refute_includes @policy.hosts.map(&:id), @host1.id
205
+ refute_includes @policy.hosts.map(&:id), @host2.id
206
+ end
207
+
208
+ test "should unassign compliance policy from a single host" do
209
+ as_admin do
210
+ @host1.policies = [@policy]
211
+ @host1.save!
212
+ @host2.policies = [@policy]
213
+ @host2.save!
214
+ end
215
+
216
+ put :unassign_compliance_policy,
217
+ params: valid_bulk_params([@host1.id]).merge(:policy_id => @policy.id),
218
+ session: set_session_user
219
+
220
+ assert_response :success
221
+ response = ActiveSupport::JSON.decode(@response.body)
222
+ assert_match(/Updated host: Unassigned from compliance policy/, response['message'])
223
+
224
+ @policy.reload
225
+ refute_includes @policy.hosts.map(&:id), @host1.id
226
+ assert_includes @policy.hosts.map(&:id), @host2.id
227
+ end
228
+
229
+ test "should require policy_id for unassign" do
230
+ put :unassign_compliance_policy,
231
+ params: valid_bulk_params,
232
+ session: set_session_user
233
+
234
+ assert_response :unprocessable_entity
235
+ response = ActiveSupport::JSON.decode(@response.body)
236
+ assert_match(/policy_id/, response['error']['message'])
237
+ end
238
+
239
+ test "should return error when policy is not found for unassign" do
240
+ put :unassign_compliance_policy,
241
+ params: valid_bulk_params.merge(:policy_id => 0),
242
+ session: set_session_user
243
+
244
+ assert_response :unprocessable_entity
245
+ response = ActiveSupport::JSON.decode(@response.body)
246
+ assert_match(/Compliance policy with id .* not found/, response['error']['message'])
247
+ end
248
+
249
+ context "forbidden user" do
250
+ setup do
251
+ @user = FactoryBot.create(:user, :admin => false,
252
+ :organizations => [@organization],
253
+ :locations => [@location])
254
+ end
255
+
256
+ test "should forbid assign compliance policy without assign_policies permission" do
257
+ setup_user('edit', 'hosts', nil, @user)
258
+
259
+ put :assign_compliance_policy,
260
+ params: valid_bulk_params.merge(:policy_id => @policy.id),
261
+ session: set_session_user(@user)
262
+
263
+ assert_forbidden_missing_permission('assign_policies')
264
+ end
265
+
266
+ test "should forbid unassign compliance policy without assign_policies permission" do
267
+ setup_user('edit', 'hosts', nil, @user)
268
+
269
+ put :unassign_compliance_policy,
270
+ params: valid_bulk_params.merge(:policy_id => @policy.id),
271
+ session: set_session_user(@user)
272
+
273
+ assert_forbidden_missing_permission('assign_policies')
274
+ end
275
+
276
+ test "should forbid change openscap proxy without edit_hosts permission" do
277
+ setup_user('assign', 'policies', nil, @user)
278
+
279
+ put :change_openscap_proxy,
280
+ params: valid_bulk_params.merge(:openscap_proxy_id => @proxy.id),
281
+ session: set_session_user(@user)
282
+
283
+ assert_forbidden_missing_permission('edit_hosts')
284
+ end
285
+
286
+ test "should forbid assign compliance policy when user cannot edit hosts" do
287
+ setup_user('assign', 'policies', nil, @user)
288
+
289
+ put :assign_compliance_policy,
290
+ params: valid_bulk_params.merge(:policy_id => @policy.id),
291
+ session: set_session_user(@user)
292
+
293
+ assert_response :forbidden
294
+ response = ActiveSupport::JSON.decode(@response.body)
295
+ assert_match(/No hosts matched search, or action unauthorized for selected hosts/, response['error']['message'])
296
+ end
297
+ end
298
+
299
+ private
300
+
301
+ def assert_forbidden_missing_permission(permission)
302
+ assert_response :forbidden
303
+ response = ActiveSupport::JSON.decode(@response.body)
304
+ assert_includes response['error']['missing_permissions'], permission
305
+ end
132
306
  end
@@ -59,6 +59,13 @@ end
59
59
  module ScapTestCommon
60
60
  private
61
61
 
62
+ def set_compliance_status(host, status)
63
+ compliance_status = host.get_status(ForemanOpenscap::ComplianceStatus)
64
+ compliance_status.status = status
65
+ compliance_status.reported_at = Time.current
66
+ compliance_status.save!
67
+ end
68
+
62
69
  def create_report_with_rules(host, rule_names, rule_results)
63
70
  raise "rule_names and rule_results should have the same length!" if rule_names.size != rule_results.size
64
71
  metrics = {
@@ -0,0 +1,48 @@
1
+ require 'test_plugin_helper'
2
+
3
+ class ComplianceStatusResetterTest < ActiveSupport::TestCase
4
+ setup do
5
+ ForemanOpenscap::Policy.any_instance.stubs(:ensure_needed_puppetclasses).returns(true)
6
+ @policy = FactoryBot.create(:policy)
7
+ end
8
+
9
+ test 'creates inconclusive status for host without existing status' do
10
+ host = FactoryBot.create(:compliance_host, :policies => [@policy])
11
+
12
+ ForemanOpenscap::ComplianceStatusResetter.to_inconclusive([host.id])
13
+
14
+ assert_equal ForemanOpenscap::ComplianceStatus::INCONCLUSIVE, host.reload.compliance_status
15
+ end
16
+
17
+ test 'resets existing compliant status to inconclusive' do
18
+ host = FactoryBot.create(:compliance_host, :policies => [@policy])
19
+ set_compliance_status(host, ForemanOpenscap::ComplianceStatus::COMPLIANT)
20
+
21
+ ForemanOpenscap::ComplianceStatusResetter.to_inconclusive([host.id])
22
+
23
+ assert_equal ForemanOpenscap::ComplianceStatus::INCONCLUSIVE, host.reload.compliance_status
24
+ end
25
+
26
+ test 'ignores blank and duplicate host ids without error' do
27
+ host = FactoryBot.create(:compliance_host, :policies => [@policy])
28
+
29
+ ForemanOpenscap::ComplianceStatusResetter.to_inconclusive([host.id, host.id, nil])
30
+
31
+ assert_equal ForemanOpenscap::ComplianceStatus::INCONCLUSIVE, host.reload.compliance_status
32
+ end
33
+
34
+ test 'does nothing for an empty list of host ids' do
35
+ assert_nil ForemanOpenscap::ComplianceStatusResetter.to_inconclusive([])
36
+ end
37
+
38
+ test 'refreshes host global_status so it reflects the new inconclusive compliance status' do
39
+ host = FactoryBot.create(:compliance_host, :policies => [@policy])
40
+ set_compliance_status(host, ForemanOpenscap::ComplianceStatus::COMPLIANT)
41
+ host.refresh_global_status!
42
+ assert_equal ::HostStatus::Global::OK, host.reload.global_status
43
+
44
+ ForemanOpenscap::ComplianceStatusResetter.to_inconclusive([host.id])
45
+
46
+ assert_equal ::HostStatus::Global::WARN, host.reload.global_status
47
+ end
48
+ end