foreman_openscap 6.0.0 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/foreman_openscap/locale/cs_CZ/foreman_openscap.js +1302 -0
  3. data/app/assets/javascripts/foreman_openscap/locale/de/foreman_openscap.js +1302 -0
  4. data/app/assets/javascripts/foreman_openscap/locale/en/foreman_openscap.js +1302 -0
  5. data/app/assets/javascripts/foreman_openscap/locale/en_GB/foreman_openscap.js +1302 -0
  6. data/app/assets/javascripts/foreman_openscap/locale/es/foreman_openscap.js +1304 -0
  7. data/app/assets/javascripts/foreman_openscap/locale/fr/foreman_openscap.js +1304 -0
  8. data/app/assets/javascripts/foreman_openscap/locale/gl/foreman_openscap.js +1302 -0
  9. data/app/assets/javascripts/foreman_openscap/locale/it/foreman_openscap.js +1302 -0
  10. data/app/assets/javascripts/foreman_openscap/locale/ja/foreman_openscap.js +1300 -0
  11. data/app/assets/javascripts/foreman_openscap/locale/ko/foreman_openscap.js +1302 -0
  12. data/app/assets/javascripts/foreman_openscap/locale/pt_BR/foreman_openscap.js +1304 -0
  13. data/app/assets/javascripts/foreman_openscap/locale/ru/foreman_openscap.js +1302 -0
  14. data/app/assets/javascripts/foreman_openscap/locale/sv_SE/foreman_openscap.js +1302 -0
  15. data/app/assets/javascripts/foreman_openscap/locale/zh_CN/foreman_openscap.js +1300 -0
  16. data/app/assets/javascripts/foreman_openscap/locale/zh_TW/foreman_openscap.js +1302 -0
  17. data/app/controllers/concerns/foreman_openscap/hosts_and_hostgroups_controller_extensions.rb +1 -1
  18. data/app/helpers/compliance_hosts_helper.rb +2 -0
  19. data/app/services/foreman_openscap/client_config/ansible.rb +4 -1
  20. data/app/services/foreman_openscap/client_config/manual.rb +1 -1
  21. data/app/services/foreman_openscap/client_config/puppet.rb +4 -1
  22. data/app/services/foreman_openscap/oval/sync_oval_contents.rb +2 -2
  23. data/app/views/arf_reports/_list.html.erb +1 -1
  24. data/app/views/policies/_list.html.erb +3 -3
  25. data/app/views/scap_contents/_list.html.erb +3 -3
  26. data/app/views/tailoring_files/_list.html.erb +3 -3
  27. data/lib/foreman_openscap/bulk_upload.rb +7 -7
  28. data/lib/foreman_openscap/engine.rb +2 -7
  29. data/lib/foreman_openscap/version.rb +1 -1
  30. data/locale/Makefile +6 -3
  31. data/locale/cs_CZ/LC_MESSAGES/foreman_openscap.mo +0 -0
  32. data/locale/cs_CZ/foreman_openscap.edit.po +1735 -0
  33. data/locale/cs_CZ/foreman_openscap.po +1309 -0
  34. data/locale/cs_CZ/foreman_openscap.po.time_stamp +0 -0
  35. data/locale/de/foreman_openscap.edit.po +1745 -0
  36. data/locale/de/foreman_openscap.po +195 -0
  37. data/locale/de/foreman_openscap.po.time_stamp +0 -0
  38. data/locale/en/LC_MESSAGES/foreman_openscap.mo +0 -0
  39. data/locale/en/foreman_openscap.edit.po +1735 -0
  40. data/locale/en/foreman_openscap.po +1309 -0
  41. data/locale/en/foreman_openscap.po.time_stamp +0 -0
  42. data/locale/en_GB/foreman_openscap.edit.po +1735 -0
  43. data/locale/en_GB/foreman_openscap.po +195 -0
  44. data/locale/en_GB/foreman_openscap.po.time_stamp +0 -0
  45. data/locale/es/foreman_openscap.edit.po +1740 -0
  46. data/locale/es/foreman_openscap.po +195 -0
  47. data/locale/es/foreman_openscap.po.time_stamp +0 -0
  48. data/locale/foreman_openscap.pot +361 -49
  49. data/locale/fr/foreman_openscap.edit.po +1746 -0
  50. data/locale/fr/foreman_openscap.po +195 -0
  51. data/locale/fr/foreman_openscap.po.time_stamp +0 -0
  52. data/locale/gl/foreman_openscap.edit.po +1735 -0
  53. data/locale/gl/foreman_openscap.po +195 -0
  54. data/locale/gl/foreman_openscap.po.time_stamp +0 -0
  55. data/locale/it/foreman_openscap.edit.po +1737 -0
  56. data/locale/it/foreman_openscap.po +195 -0
  57. data/locale/it/foreman_openscap.po.time_stamp +0 -0
  58. data/locale/ja/foreman_openscap.edit.po +1741 -0
  59. data/locale/ja/foreman_openscap.po +195 -0
  60. data/locale/ja/foreman_openscap.po.time_stamp +0 -0
  61. data/locale/ko/foreman_openscap.edit.po +1735 -0
  62. data/locale/ko/foreman_openscap.po +195 -0
  63. data/locale/ko/foreman_openscap.po.time_stamp +0 -0
  64. data/locale/pt_BR/foreman_openscap.edit.po +1745 -0
  65. data/locale/pt_BR/foreman_openscap.po +195 -0
  66. data/locale/pt_BR/foreman_openscap.po.time_stamp +0 -0
  67. data/locale/ru/foreman_openscap.edit.po +1739 -0
  68. data/locale/ru/foreman_openscap.po +195 -0
  69. data/locale/ru/foreman_openscap.po.time_stamp +0 -0
  70. data/locale/sv_SE/foreman_openscap.edit.po +1735 -0
  71. data/locale/sv_SE/foreman_openscap.po +195 -0
  72. data/locale/sv_SE/foreman_openscap.po.time_stamp +0 -0
  73. data/locale/zh_CN/foreman_openscap.edit.po +1740 -0
  74. data/locale/zh_CN/foreman_openscap.po +195 -0
  75. data/locale/zh_CN/foreman_openscap.po.time_stamp +0 -0
  76. data/locale/zh_TW/foreman_openscap.edit.po +1736 -0
  77. data/locale/zh_TW/foreman_openscap.po +195 -0
  78. data/locale/zh_TW/foreman_openscap.po.time_stamp +0 -0
  79. data/webpack/routes/OvalContents/OvalContentsNew/OvalContentsNew.js +2 -2
  80. data/webpack/routes/OvalPolicies/OvalPoliciesNew/HostgroupSelect.js +1 -1
  81. data/webpack/routes/OvalPolicies/OvalPoliciesNew/NewOvalPolicyFormHelpers.js +3 -3
  82. data/webpack/routes/OvalPolicies/OvalPoliciesShow/OvalPoliciesShowHelper.js +4 -4
  83. metadata +52 -3
@@ -7,7 +7,7 @@ module ForemanOpenscap
7
7
 
8
8
  def detect_proxy_without_scap
9
9
  unless openscap_proxy_id.nil?
10
- error = "The #{openscap_proxy_id[:name]} proxy does not have Openscap feature enabled. Either set correct OpenSCAP Proxy or unset it."
10
+ error = _("The %s proxy does not have Openscap feature enabled. Either set correct OpenSCAP Proxy or unset it.") % openscap_proxy_id[:name]
11
11
  return error(error, :now => true) unless scap_enabled_proxy?(openscap_proxy_id)
12
12
  end
13
13
  end
@@ -20,6 +20,8 @@ module ComplianceHostsHelper
20
20
  end
21
21
 
22
22
  def compliance_host_multiple_actions
23
+ return [] unless User.current.can?(:edit_hosts)
24
+
23
25
  [
24
26
  { :action => [_('Assign Compliance Policy'), select_multiple_hosts_policies_path], :priority => 1210 },
25
27
  { :action => [_('Unassign Compliance Policy'), disassociate_multiple_hosts_policies_path], :priority => 1211 },
@@ -20,8 +20,11 @@ module ForemanOpenscap
20
20
  end
21
21
 
22
22
  def inline_help
23
+ t1 = _("Requires Ansible plugin, %s Ansible role and variables. This will assign the role to the hosts or selected hostgroups.") % ansible_role_name
24
+ t2 = _("To deploy foreman_scap_client, ansible roles run needs to be triggered manually. Manual run is also required after any change to this policy.")
25
+
23
26
  {
24
- :text => "Requires Ansible plugin, #{ansible_role_name} Ansible role and variables. This will assign the role to the hosts or selected hostgroups.<br>To deploy foreman_scap_client, ansible roles run needs to be triggered manually. Manual run is also required after any change to this policy.",
27
+ :text => "#{t1}<br>#{t2}",
25
28
  :replace_text => 'Ansible role',
26
29
  :route_helper_method => :hash_for_ansible_roles_path
27
30
  }
@@ -11,7 +11,7 @@ module ForemanOpenscap
11
11
 
12
12
  def inline_help
13
13
  {
14
- :text => "This leaves the setup of the foreman_scap_client solely on the user. The policy still needs to be defined in order to link incoming ARF reports."
14
+ :text => _("This leaves the setup of the foreman_scap_client solely on the user. The policy still needs to be defined in order to link incoming ARF reports.")
15
15
  }
16
16
  end
17
17
 
@@ -14,8 +14,11 @@ module ForemanOpenscap
14
14
  end
15
15
 
16
16
  def inline_help
17
+ t1 = _("Requires %s Puppet class. This will assign the class to the hosts or selected hostgroups.") % puppetclass_name
18
+ t2 = _("Every puppet run ensures the foreman_scap_client is configured according to the policy.")
19
+
17
20
  {
18
- :text => "Requires #{puppetclass_name} Puppet class. This will assign the class to the hosts or selected hostgroups.<br>Every puppet run ensures the foreman_scap_client is configured according to the policy.",
21
+ :text => "#{t1}<br>#{t2}",
19
22
  :replace_text => 'Puppet class',
20
23
  :route_helper_method => :hash_for_puppetclasses_path
21
24
  }
@@ -5,7 +5,7 @@ module ForemanOpenscap
5
5
  begin
6
6
  content_blob = fetch_content_blob(oval_content.url)
7
7
  rescue StandardError => e
8
- oval_content.errors.add(:base, "#{fail_msg oval_content}, cause: #{e.message}")
8
+ oval_content.errors.add(:base, "#{fail_msg oval_content}, " + _("cause: ") + e.message)
9
9
  return oval_content
10
10
  end
11
11
 
@@ -25,7 +25,7 @@ module ForemanOpenscap
25
25
  private
26
26
 
27
27
  def fail_msg(content)
28
- "Failed to fetch content file from #{content.url}"
28
+ _("Failed to fetch content file from %s") % content.url
29
29
  end
30
30
 
31
31
  def fetch_content_blob(url)
@@ -3,7 +3,7 @@
3
3
  <table class="<%= table_css_classes %>">
4
4
  <tr>
5
5
  <th class="ca" width="40px"><%= check_box_tag "check_all", "", false, { :onclick => "tfm.hosts.table.toggleCheck()", :'check-title' => _("Select all items in this page"), :'uncheck-title'=> _("items selected. Uncheck to Clear") } %></th>
6
- <th><%= sort :host %></th>
6
+ <th><%= sort :host, as: _('Host') %></th>
7
7
  <th><%= sort :reported, :as => _("Reported At") %></th>
8
8
  <th><%= sort :policy, :as => _("Policy") %></th>
9
9
  <th><%= sort :openscap_proxy, :as => _("Openscap Proxy") %></th>
@@ -1,8 +1,8 @@
1
1
  <table class="<%= table_css_classes('table-fixed') %>">
2
2
  <tr>
3
- <th><%= sort :name %></th>
4
- <th><%= sort :content %></th>
5
- <th><%= sort :profile %></th>
3
+ <th><%= sort :name, as: _('Name') %></th>
4
+ <th><%= sort :content, as: _('Content') %></th>
5
+ <th><%= sort :profile, as: _('Profile') %></th>
6
6
  <th><%= sort :tailoring_file, :as => _('Tailoring File') %></th>
7
7
  <th><%= sort :tailoring_file_profile, :as => _('Effective Profile') %></th>
8
8
  <th><%= _('Actions') %></th>
@@ -1,8 +1,8 @@
1
1
  <table class="<%= table_css_classes('table-two-pane table-fixed') %>">
2
2
  <tr>
3
- <th class="col-md-4"><%= sort :title %></th>
4
- <th class="col-md-5"><%= sort :filename %></th>
5
- <th class="col-md-2"><%= sort :created_at %></th>
3
+ <th class="col-md-4"><%= sort :title, as: _('Title') %></th>
4
+ <th class="col-md-5"><%= sort :filename, as: _('File name') %></th>
5
+ <th class="col-md-2"><%= sort :created_at, as: _('Created at') %></th>
6
6
  <th class="col-md-1"><%= _('Actions') %></th>
7
7
  </tr>
8
8
  <% for content in @contents %>
@@ -1,8 +1,8 @@
1
1
  <table class="<%= table_css_classes('table-fixed') %>">
2
2
  <tr>
3
- <th class="col-md-4"><%= sort :name %></th>
4
- <th class="col-md-5"><%= sort :filename %></th>
5
- <th class="col-md-2"><%= sort :created_at %></th>
3
+ <th class="col-md-4"><%= sort :name, as: _('Name') %></th>
4
+ <th class="col-md-5"><%= sort :filename, as: _('File name') %></th>
5
+ <th class="col-md-2"><%= sort :created_at, as: _('Created at') %></th>
6
6
  <th class="col-md-1"><%= _('Actions') %></th>
7
7
  </tr>
8
8
  <% @tailoring_files.each do |file| %>
@@ -17,7 +17,7 @@ module ForemanOpenscap
17
17
 
18
18
  def upload_from_scap_guide
19
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?")
20
+ @result.errors.push(_("Can't find scap-security-guide RPM, are you sure it is installed on your server?"))
21
21
  return @result
22
22
  end
23
23
 
@@ -26,18 +26,18 @@ module ForemanOpenscap
26
26
 
27
27
  def upload_from_files(files_array, from_scap_guide = false)
28
28
  unless files_array.is_a? Array
29
- @result.errors.push("Expected an array of files to upload, got: #{files_array}.")
29
+ @result.errors.push(_("Expected an array of files to upload, got: %s.") % files_array)
30
30
  return @result
31
31
  end
32
32
 
33
33
  files_array.each do |datastream|
34
34
  if File.directory?(datastream)
35
- @result.errors.push("#{datastream} is a directory, expecting file.")
35
+ @result.errors.push(_("%s is a directory, expecting file.") % datastream)
36
36
  next
37
37
  end
38
38
 
39
39
  unless File.file?(datastream)
40
- @result.errors.push("#{datastream} does not exist, skipping.")
40
+ @result.errors.push(_("%s does not exist, skipping.") % datastream)
41
41
  next
42
42
  end
43
43
 
@@ -55,7 +55,7 @@ module ForemanOpenscap
55
55
  if scap_content.save
56
56
  @result.results.push(scap_content)
57
57
  else
58
- @result.errors.push("Failed saving #{datastream}: #{scap_content.errors.full_messages.uniq.join(',')}")
58
+ @result.errors.push(_("Failed saving %s:") % datastream + " #{scap_content.errors.full_messages.uniq.join(',')}")
59
59
  end
60
60
  end
61
61
  @result
@@ -63,7 +63,7 @@ module ForemanOpenscap
63
63
 
64
64
  def upload_from_directory(directory_path)
65
65
  unless directory_path && Dir.exist?(directory_path)
66
- @result[:errors].push("No such directory: #{directory_path}. Please check the path you have provided.")
66
+ @result[:errors].push(_("No such directory: %s. Please check the path you have provided.") % directory_path)
67
67
  return @result
68
68
  end
69
69
 
@@ -85,7 +85,7 @@ module ForemanOpenscap
85
85
 
86
86
  def content_name(datastream, from_scap_guide)
87
87
  os_name = extract_name_from_file(datastream)
88
- from_scap_guide ? "Red Hat #{os_name} default content" : "#{os_name} content"
88
+ from_scap_guide ? (_("Red Hat %s default content") % os_name) : (_("%s content") % os_name)
89
89
  end
90
90
  end
91
91
  end
@@ -48,7 +48,8 @@ module ForemanOpenscap
48
48
 
49
49
  initializer 'foreman_openscap.register_plugin', :before => :finisher_hook do |app|
50
50
  Foreman::Plugin.register :foreman_openscap do
51
- requires_foreman '>= 3.3'
51
+ requires_foreman '>= 3.7'
52
+ register_gettext
52
53
 
53
54
  apipie_documented_controllers ["#{ForemanOpenscap::Engine.root}/app/controllers/api/v2/compliance/*.rb"]
54
55
 
@@ -246,12 +247,6 @@ module ForemanOpenscap
246
247
  end
247
248
  end
248
249
 
249
- initializer 'foreman_openscap.register_gettext', after: :load_config_initializers do |_app|
250
- locale_dir = File.join(File.expand_path('../../..', __FILE__), 'locale')
251
- locale_domain = 'foreman_openscap'
252
- Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
253
- end
254
-
255
250
  # Include concerns in this config.to_prepare block
256
251
  config.to_prepare do
257
252
  ::Api::V2::HostsController.send(:include, ForemanOpenscap::Api::V2::HostsControllerExtensions)
@@ -1,3 +1,3 @@
1
1
  module ForemanOpenscap
2
- VERSION = "6.0.0".freeze
2
+ VERSION = "7.0.0".freeze
3
3
  end
data/locale/Makefile CHANGED
@@ -14,6 +14,7 @@ POFILES = $(shell find . -name '$(DOMAIN).po')
14
14
  MOFILES = $(patsubst %.po,%.mo,$(POFILES))
15
15
  POXFILES = $(patsubst %.po,%.pox,$(POFILES))
16
16
  EDITFILES = $(patsubst %.po,%.edit.po,$(POFILES))
17
+ JSFILES = $(shell find ../app/assets/javascripts/*/locale -name '$(DOMAIN).js')
17
18
 
18
19
  %.mo: %.po
19
20
  mkdir -p $(shell dirname $@)/LC_MESSAGES
@@ -42,18 +43,20 @@ uniq-po:
42
43
  done
43
44
 
44
45
  tx-pull: $(EDITFILES)
45
- tx pull -f
46
+ cd .. && tx pull -f
46
47
  for f in $(EDITFILES) ; do \
47
48
  sed -i 's/^\("Project-Id-Version: \).*$$/\1$(DOMAIN) $(VERSION)\\n"/' $$f; \
48
49
  done
49
50
 
50
51
  tx-update: tx-pull
51
52
  @echo
52
- @echo Run rake plugin:gettext[$(DOMAIN)] from the Foreman installation, then make -C locale mo-files to finish
53
+ @echo Run rake plugin:gettext[$(DOMAIN)] from the Foreman installation
54
+ @echo then run rake plugin:po_to_json[$(DOMAIN)] from the Foreman installation
55
+ @echo then run make -C locale mo-files to finish
53
56
  @echo
54
57
 
55
58
  mo-files: $(MOFILES)
56
- git add $(POFILES) $(POTFILE) ../locale/*/LC_MESSAGES
59
+ git add $(POFILES) $(POTFILE) $(JSFILES) ../locale/*/LC_MESSAGES
57
60
  git commit -m "i18n - pulling from tx"
58
61
  @echo
59
62
  @echo Changes commited!