foreman_openscap 4.1.3 → 4.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 65c54fcbd65a0adcb3f9b4de1a910347846e0bde26474badf13af2b41b46774f
4
- data.tar.gz: bfed9e4eb472d42bace5aa31d6eba2b2e3beb20fa28518b9dc20df73c9413b0c
3
+ metadata.gz: 69eab4d9434f1b502ba511db38d8a7faff9721c5416703f6010ccc87fdc52b86
4
+ data.tar.gz: 94ba4cbecc85106f968d9b5f137e0808dbd12711db01fd14e0f0c4e9761e27a1
5
5
  SHA512:
6
- metadata.gz: 5976ff19ccb147ff0a677ed3d61a219ae8e8aeac6c2526d48b57de37f3cbc83b425817365a2ede1be36813c0f9aa0ebc1d73636deb9b350f799b04d2581a7337
7
- data.tar.gz: a5ad35a6f95d9f992f99f7fbf6f44c33c3a9c9d769dc1b8d871d0806b91b92f78b084231c87af15680ab760ebc931bf5027af28538a047e99fffd075839379c0
6
+ metadata.gz: 4e3253f876e3ab4efd5c853fdb05f0b81cbbe7184c5b00ea552690b0cce9664a76210c32f92fe86c631bc9eaa2ed81ba1a8762b8b47e0678149a946cf593554e
7
+ data.tar.gz: a6c3706f6fcc836af18f7aeda76c1cf735981836a0661cdcc66e4ead2272b6249519f305ff3b6766266ebb05eda1ebfe778811993286be3e162e269412aa6fd8
@@ -6,3 +6,8 @@
6
6
  display: none;
7
7
  }
8
8
 
9
+ span.scap_policy_popover {
10
+ float: left;
11
+ margin-top: 2px;
12
+ }
13
+
@@ -14,16 +14,13 @@ module ArfReportsHelper
14
14
  end
15
15
 
16
16
  def arf_report_breadcrumbs
17
- if @arf_report && @arf_report.host
18
- breadcrumbs(:resource_url => api_compliance_arf_reports_path,
19
- :switchable => false,
20
- :items => [
21
- { :caption => _('Compliance Reports'),
22
- :url => url_for(arf_reports_path) },
23
- { :caption => @arf_report.host.name,
24
- :url => (arf_report_path(@arf_report) if authorized_for(hash_for_arf_report_path(@arf_report))) }
25
- ])
26
- end
17
+ breadcrumbs(:resource_url => api_compliance_arf_reports_path,
18
+ :switchable => false,
19
+ :items => [
20
+ { :caption => _('Compliance Reports'),
21
+ :url => url_for(arf_reports_path) },
22
+ { :caption => @arf_report.host.to_s }
23
+ ])
27
24
  end
28
25
 
29
26
  def result_tag(level)
@@ -11,10 +11,10 @@ module PoliciesHelper
11
11
 
12
12
  def deploy_by_radios(f, policy)
13
13
  ForemanOpenscap::ConfigNameService.new.configs.map do |tool|
14
- popover_block = popover("", config_inline_help(tool.inline_help))
14
+ popover_block = tag.span(popover("", config_inline_help(tool.inline_help)), class: 'scap_policy_popover')
15
15
 
16
- label = label_tag('', :class => 'col-md-2 control-label') do
17
- tool.type.to_s.capitalize.html_safe + ' ' + popover_block.html_safe
16
+ label = label_tag('', :class => 'col-md-2 control-label', :for => "policy_deploy_by_#{tool.type}") do
17
+ tool.type.to_s.capitalize.html_safe
18
18
  end
19
19
 
20
20
  radio = content_tag(:div, :class => "col-md-2") do
@@ -23,7 +23,7 @@ module PoliciesHelper
23
23
 
24
24
  content_tag(:div, :class => "clearfix") do
25
25
  content_tag(:div, :class => "form-group") do
26
- label.html_safe + radio.html_safe
26
+ label.html_safe + popover_block.html_safe + radio.html_safe
27
27
  end
28
28
  end
29
29
  end.join('').html_safe
@@ -136,17 +136,4 @@ module PoliciesHelper
136
136
  def translate_steps(policy)
137
137
  policy.steps.map { |step| _(step) }
138
138
  end
139
-
140
- def policy_breadcrumbs
141
- if @policy
142
- breadcrumbs(:resource_url => api_compliance_policies_path,
143
- :name_field => 'name',
144
- :items => [
145
- { :caption => _('Policies'),
146
- :url => url_for(policies_path) },
147
- { :caption => @policy.name,
148
- :url => (edit_policy_path(@policy) if authorized_for(hash_for_edit_policy_path(@policy))) }
149
- ])
150
- end
151
- end
152
139
  end
@@ -156,8 +156,8 @@ module ForemanOpenscap
156
156
 
157
157
  def assign_locations_organizations
158
158
  if host
159
- self.location_ids = [host.location_id] if SETTINGS[:locations_enabled]
160
- self.organization_ids = [host.organization_id] if SETTINGS[:organizations_enabled]
159
+ self.location_ids = [host.location_id]
160
+ self.organization_ids = [host.organization_id]
161
161
  end
162
162
  end
163
163
 
@@ -6,6 +6,8 @@ module ForemanOpenscap
6
6
  include Taxonomix
7
7
  attr_writer :current_step, :wizard_initiated
8
8
 
9
+ STEPS_LIST = [N_('Deployment Options'), N_('Policy Attributes'), N_('SCAP Content'), N_('Schedule'), N_('Locations'), N_('Organizations'), N_('Hostgroups')]
10
+
9
11
  belongs_to :scap_content
10
12
  belongs_to :scap_content_profile
11
13
  belongs_to :tailoring_file
@@ -108,10 +110,7 @@ module ForemanOpenscap
108
110
  end
109
111
 
110
112
  def steps
111
- base_steps = [N_('Deployment Options'), N_('Policy Attributes'), N_('SCAP Content'), N_('Schedule')]
112
- base_steps << N_('Locations') if SETTINGS[:locations_enabled]
113
- base_steps << N_('Organizations') if SETTINGS[:organizations_enabled]
114
- base_steps << N_('Hostgroups') # always be last.
113
+ STEPS_LIST
115
114
  end
116
115
 
117
116
  def current_step
@@ -2,7 +2,7 @@
2
2
  <% javascript 'foreman_openscap/reports' %>
3
3
  <% stylesheet 'foreman_openscap/reports' %>
4
4
 
5
- <% title "#{@arf_report.host}" %>
5
+ <% title @arf_report.host.to_s %>
6
6
  <%= arf_report_breadcrumbs %>
7
7
 
8
8
  <p class='ra'><%= reported_info @arf_report %></p>
@@ -1,5 +1,6 @@
1
1
  <%= javascript 'foreman_openscap/load_report'%>
2
2
 
3
+ <% title @arf_report.host.to_s %>
3
4
  <%= arf_report_breadcrumbs %>
4
5
 
5
6
  <div class="row">
@@ -3,14 +3,7 @@
3
3
 
4
4
  <%= breadcrumbs(:resource_url => api_hosts_path,
5
5
  :resource_filter => "is_compliance_host = true",
6
- :name_field => 'name',
7
- :switchable => true,
8
- :items => [
9
- { :caption => _('Compliance Hosts'),
10
- :url => url_for(hosts_path(:search => "is_compliance_host = true")) },
11
- { :caption => ((N_("%s compliance reports by policy") % @host.to_label)),
12
- :url => (host_path(@host) if authorized_for(hash_for_host_path(@host))) }
13
- ])
6
+ :name_field => 'name')
14
7
  %>
15
8
  <% title n_("%s compliance report by policy", "%s compliance reports by policy" , @host.combined_policies.length) % @host.to_label %>
16
9
  <% @host.combined_policies.each do |policy| %>
@@ -1,4 +1,5 @@
1
- <% title _("Edit Compliance Policy") %>
2
- <%= policy_breadcrumbs %>
1
+ <% title _("Edit %s") % @policy.name %>
2
+ <%= breadcrumbs(:resource_url => api_compliance_policies_path,
3
+ :name_field => 'name') %>
3
4
 
4
5
  <%= render :partial => "form" %>
@@ -1,4 +1,6 @@
1
- <%= policy_breadcrumbs %>
1
+ <% title _("Details for Compliance Policy %s") % @policy.name %>
2
+ <%= breadcrumbs(:resource_url => api_compliance_policies_path,
3
+ :name_field => 'name') %>
2
4
 
3
5
  <div class="row">
4
6
  <iframe style="min-height: 800px" height="100%" width="100%" frameborder="0" src="<%= parse_policy_path(@policy) %>"></iframe>
@@ -1,15 +1,5 @@
1
- <% title _("Edit SCAP Content") %>
1
+ <% title _("Edit %s") % @scap_content.title %>
2
2
  <%= breadcrumbs(:resource_url => api_compliance_scap_contents_path,
3
- :name_field => 'title',
4
- :items => [
5
- { :caption => _('Scap Contents'),
6
- :url => url_for(scap_contents_path)
7
- },
8
- { :caption => @scap_content.title,
9
- :url => (edit_scap_content_path(@scap_content) if authorized_for(hash_for_edit_scap_content_path(@scap_content)))
10
- }
11
- ]
12
- ) if @scap_content %>
13
-
3
+ :name_field => 'title') %>
14
4
 
15
5
  <%= render :partial => 'form' %>
@@ -1,13 +1,5 @@
1
- <% title _("Edit Tailoring File") %>
1
+ <% title _("Edit %s") % @tailoring_file.name %>
2
2
  <%= breadcrumbs(:resource_url => api_compliance_tailoring_files_path,
3
- :items => [
4
- { :caption => _('Tailoring Files'),
5
- :url => url_for(tailoring_files_path)
6
- },
7
- { :caption => @tailoring_file.name,
8
- :url => (edit_tailoring_file_path(@tailoring_file) if authorized_for(hash_for_edit_tailoring_file_path(@tailoring_file)))
9
- }
10
- ]
11
- ) if @tailoring_file %>
3
+ :name_field => 'name') %>
12
4
 
13
5
  <%= render :partial => 'form' %>
@@ -14,11 +14,15 @@ class UpdatePuppetPortParamType < ActiveRecord::Migration[6.0]
14
14
  return unless puppet_class
15
15
  port_key = puppet_class.class_params.find_by :key => 'port'
16
16
  return unless port_key
17
+ def_value = port_key.default_value
17
18
 
18
19
  if method == :to_i
19
- port_key.update_columns(:key_type => "integer", :default_value => port_key.default_value.to_i)
20
+ port_key.key_type = "integer"
21
+ port_key.default_value = def_value.to_i
20
22
  else
21
- port_key.update_columns(:key_type => "string", :default_value => port_key.default_value.to_s)
23
+ port_key.key_type == "string"
24
+ port_key.default_value = port_key.default_value.to_s
22
25
  end
26
+ port_key.save!
23
27
  end
24
28
  end
@@ -11,8 +11,9 @@ if ForemanOpenscap.with_remote_execution?
11
11
  else
12
12
  template = JobTemplate.import!(File.read(template), :default => true, :lock => true, :update => sync)
13
13
  end
14
- template.organizations = organizations if SETTINGS[:organizations_enabled] && template.present?
15
- template.locations = locations if SETTINGS[:locations_enabled] && template.present?
14
+ next unless template.present?
15
+ template.organizations = organizations
16
+ template.locations = locations
16
17
  end
17
18
  end
18
19
  end
@@ -49,8 +49,8 @@ module ForemanOpenscap
49
49
  next if scap_content.persisted?
50
50
  scap_content.scap_file = file
51
51
  scap_content.original_filename = filename
52
- scap_content.location_ids = Location.all.map(&:id)
53
- scap_content.organization_ids = Organization.all.map(&:id)
52
+ scap_content.location_ids = Location.all.pluck(:id)
53
+ scap_content.organization_ids = Organization.all.pluck(:id)
54
54
 
55
55
  if scap_content.save
56
56
  @result.results.push(scap_content)
@@ -1,3 +1,3 @@
1
1
  module ForemanOpenscap
2
- VERSION = "4.1.3".freeze
2
+ VERSION = "4.2.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_openscap
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.3
4
+ version: 4.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - slukasik@redhat.com
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-18 00:00:00.000000000 Z
11
+ date: 2021-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake