foreman_openscap 6.0.0 → 7.1.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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/foreman_openscap/locale/cs_CZ/foreman_openscap.js +1302 -0
- data/app/assets/javascripts/foreman_openscap/locale/de/foreman_openscap.js +1302 -0
- data/app/assets/javascripts/foreman_openscap/locale/en/foreman_openscap.js +1302 -0
- data/app/assets/javascripts/foreman_openscap/locale/en_GB/foreman_openscap.js +1302 -0
- data/app/assets/javascripts/foreman_openscap/locale/es/foreman_openscap.js +1304 -0
- data/app/assets/javascripts/foreman_openscap/locale/fr/foreman_openscap.js +1304 -0
- data/app/assets/javascripts/foreman_openscap/locale/gl/foreman_openscap.js +1302 -0
- data/app/assets/javascripts/foreman_openscap/locale/it/foreman_openscap.js +1302 -0
- data/app/assets/javascripts/foreman_openscap/locale/ja/foreman_openscap.js +1300 -0
- data/app/assets/javascripts/foreman_openscap/locale/ko/foreman_openscap.js +1302 -0
- data/app/assets/javascripts/foreman_openscap/locale/pt_BR/foreman_openscap.js +1304 -0
- data/app/assets/javascripts/foreman_openscap/locale/ru/foreman_openscap.js +1302 -0
- data/app/assets/javascripts/foreman_openscap/locale/sv_SE/foreman_openscap.js +1302 -0
- data/app/assets/javascripts/foreman_openscap/locale/zh_CN/foreman_openscap.js +1300 -0
- data/app/assets/javascripts/foreman_openscap/locale/zh_TW/foreman_openscap.js +1302 -0
- data/app/controllers/api/v2/compliance/arf_reports_controller.rb +2 -1
- data/app/controllers/concerns/foreman_openscap/hosts_and_hostgroups_controller_extensions.rb +1 -1
- data/app/controllers/policies_controller.rb +10 -5
- data/app/controllers/tailoring_files_controller.rb +3 -0
- data/app/helpers/compliance_hosts_helper.rb +2 -0
- data/app/helpers/foreman_openscap_helper.rb +11 -8
- data/app/helpers/policies_helper.rb +2 -0
- data/app/services/foreman_openscap/client_config/ansible.rb +4 -1
- data/app/services/foreman_openscap/client_config/manual.rb +1 -1
- data/app/services/foreman_openscap/client_config/puppet.rb +4 -1
- data/app/services/foreman_openscap/oval/sync_oval_contents.rb +2 -2
- data/app/views/arf_reports/_list.html.erb +1 -1
- data/app/views/arf_reports/show.html.erb +0 -1
- data/app/views/arf_reports/welcome.html.erb +1 -1
- data/app/views/compliance_hosts/show.html.erb +1 -1
- data/app/views/policies/_list.html.erb +3 -3
- data/app/views/policies/index.html.erb +1 -1
- data/app/views/policies/steps/_deployment_options_form.html.erb +1 -1
- data/app/views/policies/steps/_policy_attributes_form.html.erb +1 -1
- data/app/views/policies/steps/_schedule_form.html.erb +8 -4
- data/app/views/policy_dashboard/index.html.erb +1 -1
- data/app/views/scap_contents/_list.html.erb +3 -3
- data/app/views/scap_contents/index.html.erb +1 -1
- data/app/views/tailoring_files/_list.html.erb +3 -3
- data/app/views/tailoring_files/index.html.erb +1 -1
- data/lib/foreman_openscap/bulk_upload.rb +7 -7
- data/lib/foreman_openscap/engine.rb +2 -7
- data/lib/foreman_openscap/version.rb +1 -1
- data/locale/Makefile +6 -3
- data/locale/cs_CZ/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/cs_CZ/foreman_openscap.edit.po +1735 -0
- data/locale/cs_CZ/foreman_openscap.po +1309 -0
- data/locale/cs_CZ/foreman_openscap.po.time_stamp +0 -0
- data/locale/de/foreman_openscap.edit.po +1745 -0
- data/locale/de/foreman_openscap.po +195 -0
- data/locale/de/foreman_openscap.po.time_stamp +0 -0
- data/locale/en/LC_MESSAGES/foreman_openscap.mo +0 -0
- data/locale/en/foreman_openscap.edit.po +1735 -0
- data/locale/en/foreman_openscap.po +1309 -0
- data/locale/en/foreman_openscap.po.time_stamp +0 -0
- data/locale/en_GB/foreman_openscap.edit.po +1735 -0
- data/locale/en_GB/foreman_openscap.po +195 -0
- data/locale/en_GB/foreman_openscap.po.time_stamp +0 -0
- data/locale/es/foreman_openscap.edit.po +1740 -0
- data/locale/es/foreman_openscap.po +195 -0
- data/locale/es/foreman_openscap.po.time_stamp +0 -0
- data/locale/foreman_openscap.pot +388 -76
- data/locale/fr/foreman_openscap.edit.po +1746 -0
- data/locale/fr/foreman_openscap.po +195 -0
- data/locale/fr/foreman_openscap.po.time_stamp +0 -0
- data/locale/gl/foreman_openscap.edit.po +1735 -0
- data/locale/gl/foreman_openscap.po +195 -0
- data/locale/gl/foreman_openscap.po.time_stamp +0 -0
- data/locale/it/foreman_openscap.edit.po +1737 -0
- data/locale/it/foreman_openscap.po +195 -0
- data/locale/it/foreman_openscap.po.time_stamp +0 -0
- data/locale/ja/foreman_openscap.edit.po +1741 -0
- data/locale/ja/foreman_openscap.po +195 -0
- data/locale/ja/foreman_openscap.po.time_stamp +0 -0
- data/locale/ko/foreman_openscap.edit.po +1735 -0
- data/locale/ko/foreman_openscap.po +195 -0
- data/locale/ko/foreman_openscap.po.time_stamp +0 -0
- data/locale/pt_BR/foreman_openscap.edit.po +1745 -0
- data/locale/pt_BR/foreman_openscap.po +195 -0
- data/locale/pt_BR/foreman_openscap.po.time_stamp +0 -0
- data/locale/ru/foreman_openscap.edit.po +1739 -0
- data/locale/ru/foreman_openscap.po +195 -0
- data/locale/ru/foreman_openscap.po.time_stamp +0 -0
- data/locale/sv_SE/foreman_openscap.edit.po +1735 -0
- data/locale/sv_SE/foreman_openscap.po +195 -0
- data/locale/sv_SE/foreman_openscap.po.time_stamp +0 -0
- data/locale/zh_CN/foreman_openscap.edit.po +1740 -0
- data/locale/zh_CN/foreman_openscap.po +195 -0
- data/locale/zh_CN/foreman_openscap.po.time_stamp +0 -0
- data/locale/zh_TW/foreman_openscap.edit.po +1736 -0
- data/locale/zh_TW/foreman_openscap.po +195 -0
- data/locale/zh_TW/foreman_openscap.po.time_stamp +0 -0
- data/package.json +0 -3
- data/webpack/routes/OvalContents/OvalContentsNew/OvalContentsNew.js +2 -2
- data/webpack/routes/OvalPolicies/OvalPoliciesNew/HostgroupSelect.js +1 -1
- data/webpack/routes/OvalPolicies/OvalPoliciesNew/NewOvalPolicyFormHelpers.js +3 -3
- data/webpack/routes/OvalPolicies/OvalPoliciesShow/OvalPoliciesShowHelper.js +4 -4
- metadata +54 -5
|
@@ -124,7 +124,8 @@ module Api
|
|
|
124
124
|
end
|
|
125
125
|
|
|
126
126
|
def handle_download_error(error)
|
|
127
|
-
render_error
|
|
127
|
+
render_error :custom_error, :status => :unprocessable_entity,
|
|
128
|
+
:locals => { :message => _("Downloading the report failed: #{error.message}") }
|
|
128
129
|
end
|
|
129
130
|
|
|
130
131
|
def upload_fail(msg)
|
data/app/controllers/concerns/foreman_openscap/hosts_and_hostgroups_controller_extensions.rb
CHANGED
|
@@ -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
|
|
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
|
|
@@ -117,13 +117,18 @@ class PoliciesController < ApplicationController
|
|
|
117
117
|
@tailoring_file = ForemanOpenscap::TailoringFile.find(params[:tailoring_file_id]) if params[:tailoring_file_id].present?
|
|
118
118
|
end
|
|
119
119
|
|
|
120
|
+
def multiple_with_filter?
|
|
121
|
+
params.key?(:search)
|
|
122
|
+
end
|
|
123
|
+
|
|
120
124
|
def find_multiple
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
@hosts
|
|
125
|
+
if params.key?(:host_names) || params.key?(:host_ids) || multiple_with_filter?
|
|
126
|
+
@hosts = Host.search_for(params[:search]) if multiple_with_filter?
|
|
127
|
+
@hosts ||= Host.merge(Host.where(id: params[:host_ids]).or(Host.where(name: params[:host_names])))
|
|
124
128
|
if @hosts.empty?
|
|
125
|
-
error _('No hosts were found
|
|
126
|
-
redirect_to(hosts_path)
|
|
129
|
+
error _('No hosts were found with that id, name or query filter')
|
|
130
|
+
redirect_to(hosts_path)
|
|
131
|
+
return false
|
|
127
132
|
end
|
|
128
133
|
else
|
|
129
134
|
error _('No hosts selected')
|
|
@@ -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 },
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
require 'foreman_openscap/version'
|
|
2
2
|
|
|
3
3
|
module ForemanOpenscapHelper
|
|
4
|
-
def
|
|
5
|
-
|
|
6
|
-
text,
|
|
7
|
-
scap_doc_url(section),
|
|
8
|
-
:rel => 'external noopener noreferrer', :target => '_blank'
|
|
9
|
-
)
|
|
4
|
+
def scap_doc_button(section)
|
|
5
|
+
documentation_button(section, root_url: scap_doc_url)
|
|
10
6
|
end
|
|
11
7
|
|
|
12
8
|
def scap_doc_url(section = '')
|
|
@@ -15,10 +11,17 @@ module ForemanOpenscapHelper
|
|
|
15
11
|
documentation_url(section, root_url: scap_root_url)
|
|
16
12
|
end
|
|
17
13
|
|
|
14
|
+
private
|
|
15
|
+
|
|
16
|
+
def doc_flavor
|
|
17
|
+
ForemanOpenscap.with_katello? ? 'katello' : 'foreman-el'
|
|
18
|
+
end
|
|
19
|
+
|
|
18
20
|
def scap_root_url
|
|
19
21
|
@scap_root_url ||= begin
|
|
20
|
-
version =
|
|
21
|
-
|
|
22
|
+
version = SETTINGS[:version]
|
|
23
|
+
version = version.tag == 'develop' ? 'nightly' : version.short
|
|
24
|
+
"https://docs.theforeman.org/#{version}/Managing_Security_Compliance/index-#{doc_flavor}.html#"
|
|
22
25
|
end
|
|
23
26
|
end
|
|
24
27
|
end
|
|
@@ -55,11 +55,13 @@ module PoliciesHelper
|
|
|
55
55
|
select_f form, :scap_content_id, scap_contents, :id, :title,
|
|
56
56
|
{ :include_blank => _("Choose existing SCAP Content") },
|
|
57
57
|
{ :label => _("SCAP Content"),
|
|
58
|
+
:required => true,
|
|
58
59
|
:onchange => 'scap_content_selected(this);',
|
|
59
60
|
:'data-url' => method_path('scap_content_selected') }
|
|
60
61
|
else
|
|
61
62
|
select_f form, :scap_content_id, scap_contents, :id, :title,
|
|
62
63
|
{ :label => _("SCAP Content"),
|
|
64
|
+
:required => true,
|
|
63
65
|
:onchange => 'scap_content_selected(this);',
|
|
64
66
|
:'data-url' => method_path('scap_content_selected') }
|
|
65
67
|
end
|
|
@@ -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 => "
|
|
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 => "
|
|
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:
|
|
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
|
|
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>
|
|
@@ -9,6 +9,6 @@
|
|
|
9
9
|
<%= _("You don't seem to have any ARF report. ARF report is a summary of a single scan occurrence on a particular host for a given Compliance Policy.") %></br>
|
|
10
10
|
</p>
|
|
11
11
|
<div class="blank-slate-pf-main-action">
|
|
12
|
-
<%= link_to _('Documentation'),
|
|
12
|
+
<%= link_to _('Documentation'), scap_doc_url("Monitoring_Compliance_security-compliance"), :rel => 'external', :class => 'btn btn-primary btn-lg' %>
|
|
13
13
|
</div>
|
|
14
14
|
</div>
|
|
@@ -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>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
<% title_actions(
|
|
5
5
|
display_link_if_authorized(_("New Compliance Policy"), hash_for_new_policy_path, :class => "btn btn-primary"),
|
|
6
|
-
|
|
6
|
+
scap_doc_button('Managing_Compliance_Policies_security-compliance')
|
|
7
7
|
) %>
|
|
8
8
|
|
|
9
9
|
<%= render :partial => 'list' %>
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<div class="alert alert-info" id="scap-deployment-options-info-banner">
|
|
5
5
|
<span class="pficon pficon-info"></span>
|
|
6
6
|
<strong><%= _('There are significant differences in deployment options.') %></strong>
|
|
7
|
-
<%= _('Please make sure you understand them by reading our') %> <%=
|
|
7
|
+
<%= _('Please make sure you understand them by reading our') %> <%= link_to(_('documentation'), scap_doc_url('deploying-compliance-policies_security-compliance'), :rel => 'external noopener noreferrer', :target => '_blank') %>.
|
|
8
8
|
</div>
|
|
9
9
|
|
|
10
10
|
<%= deploy_by_radios f, @policy %>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div class="tab-pane <%= show_partial_wizard(step) %>" id="create-policy">
|
|
2
2
|
<%= wizard_header @policy.step_index, *translate_steps(@policy) %>
|
|
3
|
-
<%= text_f(f, :name) %>
|
|
3
|
+
<%= text_f(f, :name, :required => true) %>
|
|
4
4
|
<%= text_f(f, :description, :size => "col-md-8" ) %>
|
|
5
5
|
</div>
|
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
<%= wizard_header @policy.step_index, *@policy.steps %>
|
|
5
5
|
<%= select_f(f, :period, %w[Weekly Monthly Custom], :downcase, :to_s,
|
|
6
6
|
{ :include_blank => _('Choose period') },
|
|
7
|
-
{ :onchange => 'period_selected(this)' }) %>
|
|
8
|
-
<%= select_f(f, :weekday, days_of_week_hash, :first, :last,
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
{ :onchange => 'period_selected(this)', :required => true }) %>
|
|
8
|
+
<%= select_f(f, :weekday, days_of_week_hash, :first, :last,
|
|
9
|
+
{ :include_blank => _('Choose weekday') },
|
|
10
|
+
{ :required => true }) %>
|
|
11
|
+
<%= select_f(f, :day_of_month, (1..31).to_a, :to_i, :to_s,
|
|
12
|
+
{ :include_blank => _('Choose day in month') },
|
|
13
|
+
{ :help_inline => _('Number of a day in month, note that not all months have same count of days'), :required => true }) %>
|
|
14
|
+
<%= text_f(f, :cron_line, :help_inline => _('You can specify custom cron line, e.g. "0 3 * * *", separate each of 5 values by space'), :required => true) %>
|
|
11
15
|
</div>
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
<% title _("SCAP Contents") %>
|
|
2
2
|
|
|
3
3
|
<% title_actions(display_link_if_authorized(_("Upload New SCAP Content"), hash_for_new_scap_content_path, :class => 'btn btn-primary'),
|
|
4
|
-
|
|
4
|
+
scap_doc_button('Configuring_SCAP_Contents_security-compliance')) %>
|
|
5
5
|
|
|
6
6
|
<%= render :partial => 'list' %>
|
|
@@ -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| %>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
<% title _("Tailoring Files") %>
|
|
2
2
|
<% title_actions(display_link_if_authorized(_("Upload New Tailoring file"), hash_for_new_tailoring_file_path, :class => 'btn btn-primary'),
|
|
3
|
-
|
|
3
|
+
scap_doc_button('tailoring-xccdf-profiles_security-compliance')) %>
|
|
4
4
|
<%= render :partial => 'list' %>
|
|
@@ -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:
|
|
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("
|
|
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("
|
|
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
|
|
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:
|
|
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
|
|
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.
|
|
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)
|
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
|
|
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!
|
|
Binary file
|