foreman_openscap 10.0.3 → 10.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_openscap/arf_reports.js +3 -3
  3. data/app/assets/javascripts/foreman_openscap/locale/cs_CZ/foreman_openscap.js +2 -2
  4. data/app/assets/javascripts/foreman_openscap/locale/de/foreman_openscap.js +2 -2
  5. data/app/assets/javascripts/foreman_openscap/locale/en/foreman_openscap.js +2 -2
  6. data/app/assets/javascripts/foreman_openscap/locale/en_GB/foreman_openscap.js +2 -2
  7. data/app/assets/javascripts/foreman_openscap/locale/es/foreman_openscap.js +2 -2
  8. data/app/assets/javascripts/foreman_openscap/locale/fr/foreman_openscap.js +3 -3
  9. data/app/assets/javascripts/foreman_openscap/locale/gl/foreman_openscap.js +2 -2
  10. data/app/assets/javascripts/foreman_openscap/locale/it/foreman_openscap.js +2 -2
  11. data/app/assets/javascripts/foreman_openscap/locale/ja/foreman_openscap.js +3 -3
  12. data/app/assets/javascripts/foreman_openscap/locale/ka/foreman_openscap.js +3 -3
  13. data/app/assets/javascripts/foreman_openscap/locale/ko/foreman_openscap.js +208 -210
  14. data/app/assets/javascripts/foreman_openscap/locale/pt_BR/foreman_openscap.js +2 -2
  15. data/app/assets/javascripts/foreman_openscap/locale/ru/foreman_openscap.js +2 -2
  16. data/app/assets/javascripts/foreman_openscap/locale/sv_SE/foreman_openscap.js +2 -2
  17. data/app/assets/javascripts/foreman_openscap/locale/zh_CN/foreman_openscap.js +3 -3
  18. data/app/assets/javascripts/foreman_openscap/locale/zh_TW/foreman_openscap.js +2 -2
  19. data/app/assets/javascripts/foreman_openscap/policy_edit.js +1 -1
  20. data/app/assets/javascripts/foreman_openscap/reports.js +1 -1
  21. data/app/controllers/api/v2/compliance/scap_contents_controller.rb +0 -2
  22. data/app/controllers/arf_reports_controller.rb +8 -2
  23. data/{lib → app/services}/foreman_openscap/bulk_upload.rb +14 -7
  24. data/app/views/arf_reports/_list.html.erb +1 -1
  25. data/lib/foreman_openscap/engine.rb +1 -1
  26. data/lib/foreman_openscap/version.rb +1 -1
  27. data/lib/tasks/foreman_openscap_tasks.rake +0 -1
  28. data/locale/cs_CZ/LC_MESSAGES/foreman_openscap.mo +0 -0
  29. data/locale/cs_CZ/foreman_openscap.edit.po +1442 -0
  30. data/locale/cs_CZ/foreman_openscap.po +2 -2
  31. data/locale/cs_CZ/foreman_openscap.po.time_stamp +0 -0
  32. data/locale/de/LC_MESSAGES/foreman_openscap.mo +0 -0
  33. data/locale/de/foreman_openscap.edit.po +1450 -0
  34. data/locale/de/foreman_openscap.po +2 -2
  35. data/locale/de/foreman_openscap.po.time_stamp +0 -0
  36. data/locale/en/LC_MESSAGES/foreman_openscap.mo +0 -0
  37. data/locale/en/foreman_openscap.edit.po +1439 -0
  38. data/locale/en/foreman_openscap.po +2 -2
  39. data/locale/en/foreman_openscap.po.time_stamp +0 -0
  40. data/locale/en_GB/LC_MESSAGES/foreman_openscap.mo +0 -0
  41. data/locale/en_GB/foreman_openscap.edit.po +1440 -0
  42. data/locale/en_GB/foreman_openscap.po +2 -2
  43. data/locale/en_GB/foreman_openscap.po.time_stamp +0 -0
  44. data/locale/es/LC_MESSAGES/foreman_openscap.mo +0 -0
  45. data/locale/es/foreman_openscap.edit.po +1445 -0
  46. data/locale/es/foreman_openscap.po +2 -2
  47. data/locale/es/foreman_openscap.po.time_stamp +0 -0
  48. data/locale/foreman_openscap.pot +60 -62
  49. data/locale/fr/LC_MESSAGES/foreman_openscap.mo +0 -0
  50. data/locale/fr/foreman_openscap.edit.po +1459 -0
  51. data/locale/fr/foreman_openscap.po +3 -3
  52. data/locale/fr/foreman_openscap.po.time_stamp +0 -0
  53. data/locale/gl/LC_MESSAGES/foreman_openscap.mo +0 -0
  54. data/locale/gl/foreman_openscap.edit.po +1440 -0
  55. data/locale/gl/foreman_openscap.po +2 -2
  56. data/locale/gl/foreman_openscap.po.time_stamp +0 -0
  57. data/locale/it/LC_MESSAGES/foreman_openscap.mo +0 -0
  58. data/locale/it/foreman_openscap.edit.po +1442 -0
  59. data/locale/it/foreman_openscap.po +2 -2
  60. data/locale/it/foreman_openscap.po.time_stamp +0 -0
  61. data/locale/ja/LC_MESSAGES/foreman_openscap.mo +0 -0
  62. data/locale/ja/foreman_openscap.edit.po +1452 -0
  63. data/locale/ja/foreman_openscap.po +3 -3
  64. data/locale/ja/foreman_openscap.po.time_stamp +0 -0
  65. data/locale/ka/LC_MESSAGES/foreman_openscap.mo +0 -0
  66. data/locale/ka/foreman_openscap.edit.po +1448 -0
  67. data/locale/ka/foreman_openscap.po +3 -3
  68. data/locale/ka/foreman_openscap.po.time_stamp +0 -0
  69. data/locale/ko/LC_MESSAGES/foreman_openscap.mo +0 -0
  70. data/locale/ko/foreman_openscap.edit.po +1444 -0
  71. data/locale/ko/foreman_openscap.po +208 -210
  72. data/locale/ko/foreman_openscap.po.time_stamp +0 -0
  73. data/locale/pt_BR/LC_MESSAGES/foreman_openscap.mo +0 -0
  74. data/locale/pt_BR/foreman_openscap.edit.po +1450 -0
  75. data/locale/pt_BR/foreman_openscap.po +2 -2
  76. data/locale/pt_BR/foreman_openscap.po.time_stamp +0 -0
  77. data/locale/ru/LC_MESSAGES/foreman_openscap.mo +0 -0
  78. data/locale/ru/foreman_openscap.edit.po +1444 -0
  79. data/locale/ru/foreman_openscap.po +2 -2
  80. data/locale/ru/foreman_openscap.po.time_stamp +0 -0
  81. data/locale/sv_SE/LC_MESSAGES/foreman_openscap.mo +0 -0
  82. data/locale/sv_SE/foreman_openscap.edit.po +1440 -0
  83. data/locale/sv_SE/foreman_openscap.po +2 -2
  84. data/locale/sv_SE/foreman_openscap.po.time_stamp +0 -0
  85. data/locale/zh_CN/LC_MESSAGES/foreman_openscap.mo +0 -0
  86. data/locale/zh_CN/foreman_openscap.edit.po +1451 -0
  87. data/locale/zh_CN/foreman_openscap.po +3 -3
  88. data/locale/zh_CN/foreman_openscap.po.time_stamp +0 -0
  89. data/locale/zh_TW/LC_MESSAGES/foreman_openscap.mo +0 -0
  90. data/locale/zh_TW/foreman_openscap.edit.po +1441 -0
  91. data/locale/zh_TW/foreman_openscap.po +2 -2
  92. data/locale/zh_TW/foreman_openscap.po.time_stamp +0 -0
  93. data/test/lib/foreman_openscap/bulk_upload_test.rb +3 -4
  94. metadata +50 -4
@@ -3,7 +3,7 @@
3
3
  "locale_data": {
4
4
  "foreman_openscap": {
5
5
  "": {
6
- "Project-Id-Version": "foreman_openscap 10.0.1",
6
+ "Project-Id-Version": "foreman_openscap 10.1.0",
7
7
  "Report-Msgid-Bugs-To": "",
8
8
  "PO-Revision-Date": "2016-04-14 07:48+0000",
9
9
  "Last-Translator": "FIRST AUTHOR <EMAIL@ADDRESS>, 2016",
@@ -94,7 +94,7 @@
94
94
  "By default, remediation is applied to the current host. Optionally, remediate any additional hosts that fail the rule.": [
95
95
  ""
96
96
  ],
97
- "Can't find scap-security-guide RPM, are you sure it is installed on your server?": [
97
+ "Can't find %{packages} RPM(s), are you sure it is installed on your server?": [
98
98
  ""
99
99
  ],
100
100
  "Cancel": [
@@ -3,7 +3,7 @@
3
3
  "locale_data": {
4
4
  "foreman_openscap": {
5
5
  "": {
6
- "Project-Id-Version": "foreman_openscap 10.0.1",
6
+ "Project-Id-Version": "foreman_openscap 10.1.0",
7
7
  "Report-Msgid-Bugs-To": "",
8
8
  "PO-Revision-Date": "2016-04-14 07:48+0000",
9
9
  "Last-Translator": "FIRST AUTHOR <EMAIL@ADDRESS>, 2016",
@@ -93,7 +93,7 @@
93
93
  "By default, remediation is applied to the current host. Optionally, remediate any additional hosts that fail the rule.": [
94
94
  ""
95
95
  ],
96
- "Can't find scap-security-guide RPM, are you sure it is installed on your server?": [
96
+ "Can't find %{packages} RPM(s), are you sure it is installed on your server?": [
97
97
  ""
98
98
  ],
99
99
  "Cancel": [
@@ -3,7 +3,7 @@
3
3
  "locale_data": {
4
4
  "foreman_openscap": {
5
5
  "": {
6
- "Project-Id-Version": "foreman_openscap 10.0.1",
6
+ "Project-Id-Version": "foreman_openscap 10.1.0",
7
7
  "Report-Msgid-Bugs-To": "",
8
8
  "PO-Revision-Date": "2016-04-14 07:48+0000",
9
9
  "Last-Translator": "FULL NAME <EMAIL@ADDRESS>",
@@ -93,7 +93,7 @@
93
93
  "By default, remediation is applied to the current host. Optionally, remediate any additional hosts that fail the rule.": [
94
94
  ""
95
95
  ],
96
- "Can't find scap-security-guide RPM, are you sure it is installed on your server?": [
96
+ "Can't find %{packages} RPM(s), are you sure it is installed on your server?": [
97
97
  ""
98
98
  ],
99
99
  "Cancel": [
@@ -3,7 +3,7 @@
3
3
  "locale_data": {
4
4
  "foreman_openscap": {
5
5
  "": {
6
- "Project-Id-Version": "foreman_openscap 10.0.1",
6
+ "Project-Id-Version": "foreman_openscap 10.1.0",
7
7
  "Report-Msgid-Bugs-To": "",
8
8
  "PO-Revision-Date": "2016-04-14 07:48+0000",
9
9
  "Last-Translator": "FIRST AUTHOR <EMAIL@ADDRESS>, 2016",
@@ -92,8 +92,8 @@
92
92
  "By default, remediation is applied to the current host. Optionally, remediate any additional hosts that fail the rule.": [
93
93
  "默认情况下,补救会应用到当前主机。(可选)修复任何规则失败的额外主机。"
94
94
  ],
95
- "Can't find scap-security-guide RPM, are you sure it is installed on your server?": [
96
- "无法找到 scap-security-guide RPM,您确定是否已安装在服务器上?"
95
+ "Can't find %{packages} RPM(s), are you sure it is installed on your server?": [
96
+ ""
97
97
  ],
98
98
  "Cancel": [
99
99
  "取消"
@@ -3,7 +3,7 @@
3
3
  "locale_data": {
4
4
  "foreman_openscap": {
5
5
  "": {
6
- "Project-Id-Version": "foreman_openscap 10.0.1",
6
+ "Project-Id-Version": "foreman_openscap 10.1.0",
7
7
  "Report-Msgid-Bugs-To": "",
8
8
  "PO-Revision-Date": "2016-04-14 07:48+0000",
9
9
  "Last-Translator": "FIRST AUTHOR <EMAIL@ADDRESS>, 2016",
@@ -93,7 +93,7 @@
93
93
  "By default, remediation is applied to the current host. Optionally, remediate any additional hosts that fail the rule.": [
94
94
  ""
95
95
  ],
96
- "Can't find scap-security-guide RPM, are you sure it is installed on your server?": [
96
+ "Can't find %{packages} RPM(s), are you sure it is installed on your server?": [
97
97
  ""
98
98
  ],
99
99
  "Cancel": [
@@ -30,7 +30,7 @@ function tailoring_file_selected(element) {
30
30
 
31
31
  function previous_step(previous) {
32
32
  $('#policy_current_step').val(previous);
33
- $('#new_policy').submit();
33
+ $('#new_policy').trigger("submit");
34
34
  }
35
35
 
36
36
  function period_selected(period) {
@@ -7,5 +7,5 @@ function showReportDetails(log_id, event) {
7
7
  function showRemediationWizard(log_id) {
8
8
  var wizard_button = $('#openscapRemediationWizardButton');
9
9
  wizard_button.attr('data-log-id', log_id);
10
- wizard_button.click();
10
+ wizard_button.trigger("click");
11
11
  }
@@ -1,5 +1,3 @@
1
- require 'foreman_openscap/bulk_upload'
2
-
3
1
  module Api::V2
4
2
  module Compliance
5
3
  class ScapContentsController < ::Api::V2::BaseController
@@ -10,9 +10,15 @@ class ArfReportsController < ApplicationController
10
10
  end
11
11
 
12
12
  def index
13
+ # Avoid using includes() with nested associations and "order by" together. Otherwise,
14
+ # includes() will use join tables instead and Rails somehow create many objects and
15
+ # high memory consumption.
16
+ @arf_reports_pg = resource_base.search_for(params[:search], :order => params[:order])
17
+ .paginate(:page => params[:page], :per_page => params[:per_page])
18
+ arf_report_ids = @arf_reports_pg.pluck(:id)
13
19
  @arf_reports = resource_base.includes(:policy, :openscap_proxy, :host => %i[policies last_report_object host_statuses])
14
- .search_for(params[:search], :order => params[:order])
15
- .paginate(:page => params[:page], :per_page => params[:per_page])
20
+ .where(id: arf_report_ids)
21
+ .sort_by { |arf_report| arf_report_ids.index(arf_report.id) }
16
22
  end
17
23
 
18
24
  def show
@@ -7,21 +7,28 @@ module ForemanOpenscap
7
7
  @result = OpenStruct.new(:errors => [], :results => [])
8
8
  end
9
9
 
10
- def files_from_guide
11
- `rpm -ql scap-security-guide | grep ds.xml`.split
10
+ def security_guide_packages
11
+ %w(scap-security-guide)
12
12
  end
13
13
 
14
- def scap_guide_installed?
15
- `rpm -qa | grep scap-security-guide`.present?
14
+ def files_from_guide(package)
15
+ `rpm -ql #{package} | grep ds.xml`.split
16
+ end
17
+
18
+ def package_installed?(package)
19
+ `rpm -qa | grep #{package}`.present?
16
20
  end
17
21
 
18
22
  def upload_from_scap_guide
19
- unless scap_guide_installed?
20
- @result.errors.push(_("Can't find scap-security-guide RPM, are you sure it is installed on your server?"))
23
+ package = security_guide_packages.find { |p| package_installed? p }
24
+ unless package
25
+ joined_packages = security_guide_packages.join(', ')
26
+ msg = _("Can't find %{packages} RPM(s), are you sure it is installed on your server?")
27
+ @result.errors.push(msg % {packages: joined_packages})
21
28
  return @result
22
29
  end
23
30
 
24
- upload_from_files(files_from_guide, true)
31
+ upload_from_files(files_from_guide(package), true)
25
32
  end
26
33
 
27
34
  def upload_from_files(files_array, from_scap_guide = false)
@@ -56,4 +56,4 @@
56
56
  </div>
57
57
  </div>
58
58
  </div>
59
- <%= will_paginate_with_info @arf_reports %>
59
+ <%= will_paginate_with_info @arf_reports_pg %>
@@ -40,7 +40,7 @@ module ForemanOpenscap
40
40
  initializer 'foreman_openscap.register_plugin', :before => :finisher_hook do |app|
41
41
  app.reloader.to_prepare do
42
42
  Foreman::Plugin.register :foreman_openscap do
43
- requires_foreman '>= 3.13'
43
+ requires_foreman '>= 3.14'
44
44
  register_gettext
45
45
 
46
46
  apipie_documented_controllers ["#{ForemanOpenscap::Engine.root}/app/controllers/api/v2/compliance/*.rb"]
@@ -1,3 +1,3 @@
1
1
  module ForemanOpenscap
2
- VERSION = "10.0.3".freeze
2
+ VERSION = "10.1.0".freeze
3
3
  end
@@ -1,6 +1,5 @@
1
1
  # Tasks
2
2
  namespace :foreman_openscap do
3
- require 'foreman_openscap/bulk_upload'
4
3
  require 'foreman_openscap/message_cleaner'
5
4
 
6
5
  namespace :bulk_upload do