foreman_openscap 0.5.0 → 0.5.1
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/arf_reports.js +16 -0
- data/app/assets/javascripts/foreman_openscap/openscap_proxy.js +52 -0
- data/app/assets/javascripts/foreman_openscap/reports.js +6 -0
- data/app/assets/stylesheets/foreman_openscap/policy.css +2 -1
- data/app/assets/stylesheets/foreman_openscap/reports.css +3 -0
- data/app/controllers/api/v2/compliance/arf_reports_controller.rb +2 -2
- data/app/controllers/api/v2/compliance/policies_controller.rb +6 -6
- data/app/controllers/api/v2/compliance/scap_contents_controller.rb +2 -2
- data/app/controllers/arf_reports_controller.rb +41 -5
- data/app/controllers/concerns/foreman_openscap/hostgroups_controller_extensions.rb +20 -0
- data/app/controllers/concerns/foreman_openscap/hosts_common_controller_extensions.rb +45 -0
- data/app/controllers/concerns/foreman_openscap/hosts_controller_extensions.rb +17 -0
- data/app/controllers/policies_controller.rb +4 -4
- data/app/helpers/arf_report_dashboard_helper.rb +5 -5
- data/app/helpers/arf_reports_helper.rb +28 -0
- data/app/helpers/compliance_hosts_helper.rb +5 -3
- data/app/helpers/policies_helper.rb +3 -3
- data/app/helpers/policy_dashboard_helper.rb +2 -2
- data/app/lib/proxy_api/available_proxy.rb +7 -7
- data/app/lib/proxy_api/openscap.rb +10 -0
- data/app/mailers/foreman_openscap/policy_mailer.rb +2 -2
- data/app/models/concerns/foreman_openscap/compliance_status_scoped_search.rb +5 -5
- data/app/models/concerns/foreman_openscap/host_extensions.rb +22 -14
- data/app/models/concerns/foreman_openscap/hostgroup_extensions.rb +12 -0
- data/app/models/concerns/foreman_openscap/log_extensions.rb +8 -0
- data/app/models/concerns/foreman_openscap/openscap_proxy_core_extensions.rb +55 -0
- data/app/models/concerns/foreman_openscap/openscap_proxy_extensions.rb +17 -0
- data/app/models/concerns/foreman_openscap/smart_proxy_extensions.rb +23 -0
- data/app/models/foreman_openscap/arf_report.rb +42 -21
- data/app/models/foreman_openscap/policy.rb +38 -38
- data/app/models/foreman_openscap/scap_content.rb +9 -9
- data/app/overrides/hostgroups/form/select_openscap_proxy.rb +4 -0
- data/app/overrides/hosts/form/select_openscap_proxy.rb +4 -0
- data/app/services/foreman_openscap/host_report_dashboard/data.rb +5 -5
- data/app/services/foreman_openscap/report_dashboard/data.rb +5 -5
- data/app/views/arf_reports/_detailed_message.html.erb +9 -0
- data/app/views/arf_reports/_list.html.erb +29 -9
- data/app/views/arf_reports/_output.html.erb +12 -8
- data/app/views/arf_reports/delete_multiple.html.erb +29 -0
- data/app/views/arf_reports/index.html.erb +1 -1
- data/app/views/arf_reports/show.html.erb +3 -1
- data/app/views/compliance_hosts/_openscap_proxy.html.erb +8 -0
- data/app/views/policies/_form.html.erb +1 -1
- data/app/views/policies/steps/_schedule_form.html.erb +1 -1
- data/config/routes.rb +17 -1
- data/db/migrate/20141013172051_create_scaptimony_policies.rb +1 -1
- data/db/migrate/20141014105333_create_scaptimony_assets.rb +2 -2
- data/db/migrate/20141015092642_create_scaptimony_arf_reports.rb +4 -4
- data/db/migrate/20141104164201_create_scaptimony_scap_contents.rb +1 -3
- data/db/migrate/20141104171545_create_scaptimony_policy_revisions.rb +2 -2
- data/db/migrate/20141105174834_add_columns_to_scaptimony_policies.rb +1 -1
- data/db/migrate/20141113221054_create_scaptimony_scap_content_profiles.rb +1 -1
- data/db/migrate/20141116171305_add_profile_to_scaptimony_policies.rb +1 -1
- data/db/migrate/20141119182606_create_scaptimony_xccdf_rule_results.rb +3 -3
- data/db/migrate/20150821100137_migrate_from_scaptimony.rb +2 -2
- data/db/migrate/20150929152345_move_arf_reports_to_reports_table.rb +1 -1
- data/db/migrate/20151023131950_link_arf_report_directly_to_host.rb +12 -8
- data/db/migrate/20151118165125_add_size_to_scap_content.rb +5 -0
- data/db/migrate/20151119155419_add_arf_fields_to_message.rb +8 -0
- data/db/migrate/20151120090851_add_openscap_proxy_to_host_and_hostgroup.rb +25 -0
- data/db/seeds.d/openscap_feature.rb +1 -1
- data/db/seeds.d/openscap_scap_default.rb +1 -1
- data/lib/foreman_openscap/bulk_upload.rb +11 -12
- data/lib/foreman_openscap/engine.rb +22 -11
- data/lib/foreman_openscap/helper.rb +1 -1
- data/lib/foreman_openscap/version.rb +1 -1
- data/lib/tasks/foreman_openscap_tasks.rake +3 -2
- data/test/factories/arf_report_factory.rb +2 -1
- data/test/factories/compliance_host_factory.rb +1 -0
- data/test/factories/scap_content_related.rb +1 -1
- data/test/functional/api/v2/compliance/arf_reports_controller_test.rb +3 -3
- data/test/functional/api/v2/compliance/policies_controller_test.rb +1 -1
- data/test/functional/api/v2/compliance/scap_contents_controller_test.rb +2 -2
- data/test/functional/arf_reports_controller_test.rb +21 -0
- data/test/lib/foreman_openscap/bulk_upload_test.rb +2 -2
- data/test/test_plugin_helper.rb +2 -2
- data/test/unit/arf_report_test.rb +12 -1
- data/test/unit/compliance_status_test.rb +6 -5
- data/test/unit/openscap_host_test.rb +4 -0
- data/test/unit/policy_mailer_test.rb +1 -1
- data/test/unit/scap_content_test.rb +1 -1
- metadata +29 -8
|
@@ -19,7 +19,7 @@ module ForemanOpenscap
|
|
|
19
19
|
api = ProxyAPI::Openscap.new(:url => scap_content.proxy_url)
|
|
20
20
|
errors = api.validate_scap_content(scap_content.scap_file)
|
|
21
21
|
if errors && errors['errors'].any?
|
|
22
|
-
errors['errors'].each {|error| scap_content.errors.add(:scap_file, _(error))}
|
|
22
|
+
errors['errors'].each { |error| scap_content.errors.add(:scap_file, _(error)) }
|
|
23
23
|
return false
|
|
24
24
|
end
|
|
25
25
|
rescue *ProxyAPI::AvailableProxy::HTTP_ERRORS => e
|
|
@@ -57,22 +57,22 @@ module ForemanOpenscap
|
|
|
57
57
|
scoped_search :on => :title, :complete_value => true
|
|
58
58
|
scoped_search :on => :original_filename, :complete_value => true, :rename => :filename
|
|
59
59
|
|
|
60
|
-
default_scope
|
|
60
|
+
default_scope do
|
|
61
61
|
with_taxonomy_scope do
|
|
62
62
|
order("foreman_openscap_scap_contents.title")
|
|
63
63
|
end
|
|
64
|
-
|
|
64
|
+
end
|
|
65
65
|
|
|
66
66
|
def used_location_ids
|
|
67
67
|
Location.joins(:taxable_taxonomies).where(
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
'taxable_taxonomies.taxable_type' => 'ForemanOpenscap::ScapContent',
|
|
69
|
+
'taxable_taxonomies.taxable_id' => id).pluck("#{Location.arel_table.name}.id")
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
def used_organization_ids
|
|
73
73
|
Organization.joins(:taxable_taxonomies).where(
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
'taxable_taxonomies.taxable_type' => 'ForemanOpenscap::ScapContent',
|
|
75
|
+
'taxable_taxonomies.taxable_id' => id).pluck("#{Location.arel_table.name}.id")
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
def to_label
|
|
@@ -100,9 +100,9 @@ module ForemanOpenscap
|
|
|
100
100
|
|
|
101
101
|
def create_profiles
|
|
102
102
|
profiles = fetch_profiles
|
|
103
|
-
profiles.each
|
|
103
|
+
profiles.each do|key, title|
|
|
104
104
|
scap_content_profiles.find_or_create_by_profile_id_and_title(key, title)
|
|
105
|
-
|
|
105
|
+
end
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
def redigest
|
|
@@ -20,11 +20,11 @@ module ForemanOpenscap::HostReportDashboard
|
|
|
20
20
|
|
|
21
21
|
def fetch_data
|
|
22
22
|
report.update(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
{
|
|
24
|
+
:passed => report_passed,
|
|
25
|
+
:failed => report_failed,
|
|
26
|
+
:othered => report_othered
|
|
27
|
+
}
|
|
28
28
|
)
|
|
29
29
|
end
|
|
30
30
|
|
|
@@ -14,11 +14,11 @@ module ForemanOpenscap::ReportDashboard
|
|
|
14
14
|
|
|
15
15
|
def fetch_data
|
|
16
16
|
report.update(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
{
|
|
18
|
+
:passed => passed_breakdowns,
|
|
19
|
+
:failed => failed_breakdowns,
|
|
20
|
+
:othered => othered_breakdowns
|
|
21
|
+
}
|
|
22
22
|
)
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<div>
|
|
2
|
+
<%= message.value %>
|
|
3
|
+
<%= link_to_function(content_tag(:span, "", {:rel => "twipsy", :class => 'glyphicon glyphicon-collapse-down', :"data-original-title" => _('More details')} ), "showReportDetails(#{message.id}, $(this))", :class => 'small more-info') %>
|
|
4
|
+
</div>
|
|
5
|
+
<div class="hidden message-details" id="details-<%= message.id %>">
|
|
6
|
+
<p><b><%= _('Description') %>:</b> <%= sanitize(message.description) %></p>
|
|
7
|
+
<p><b><%= _('Rationale') %>:</b> <%= sanitize(message.rationale) %></p>
|
|
8
|
+
<p><b><%= _('References') %>:</b> <%= sanitize(message.scap_references) %></p>
|
|
9
|
+
</div>
|
|
@@ -1,27 +1,47 @@
|
|
|
1
|
+
<%= javascript "jquery.cookie", "host_checkbox", "foreman_openscap/arf_reports" %>
|
|
2
|
+
|
|
1
3
|
<table class="table table-bordered table-striped ellipsis">
|
|
2
4
|
<tr>
|
|
5
|
+
<th class="ca" width="40px"><%= check_box_tag "check_all", "", false, { :onclick => "toggleCheck()", :'check-title' => _("Select all items in this page"), :'uncheck-title'=> _("items selected. Uncheck to Clear") } %></th>
|
|
3
6
|
<th><%= sort :host %></th>
|
|
4
7
|
<th><%= sort :reported_at, :as => _("Reported At") %></th>
|
|
5
|
-
<th><%= sort :
|
|
6
|
-
<th><%= sort :
|
|
7
|
-
<th><%= sort :
|
|
8
|
+
<th><%= sort :compliance_passed, :as => _("Passed") %></th>
|
|
9
|
+
<th><%= sort :compliance_failed, :as => _("Failed") %></th>
|
|
10
|
+
<th><%= sort :compliance_othered, :as => _("Other") %></th>
|
|
8
11
|
<th></th>
|
|
9
12
|
</tr>
|
|
10
13
|
<% for arf_report in @arf_reports %>
|
|
11
14
|
<tr>
|
|
15
|
+
<td class="ca">
|
|
16
|
+
<%= check_box_tag "host_ids[]", nil, false, :id => "host_ids_#{arf_report.id}", :disabled => !authorized?, :class => 'host_select_boxes', :onclick => 'hostChecked(this)' %>
|
|
17
|
+
</td>
|
|
12
18
|
<td><%= name_column(arf_report.host) %></td>
|
|
13
|
-
<td><%= _("%s ago") % time_ago_in_words(arf_report.reported_at) %></td>
|
|
19
|
+
<td><%= display_link_if_authorized(_("%s ago") % time_ago_in_words(arf_report.reported_at), hash_for_arf_report_path(:id => arf_report.id)) %></td>
|
|
14
20
|
<td><%= report_arf_column(arf_report.passed, "label-info") %></th>
|
|
15
21
|
<td><%= report_arf_column(arf_report.failed, "label-danger") %></th>
|
|
16
22
|
<td><%= report_arf_column(arf_report.othered, "label-warning") %></th>
|
|
17
23
|
<td>
|
|
18
|
-
<%=
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
:confirm => _("Delete compliance report for %s?") % arf_report.asset.host)
|
|
22
|
-
) %>
|
|
24
|
+
<%= display_delete_if_authorized(hash_for_arf_report_path(:id => arf_report.id),
|
|
25
|
+
:confirm => _("Delete compliance report for %s?") % arf_report.host)
|
|
26
|
+
%>
|
|
23
27
|
</td>
|
|
24
28
|
</tr>
|
|
25
29
|
<% end %>
|
|
26
30
|
</table>
|
|
31
|
+
<div id="confirmation-modal" class="modal fade">
|
|
32
|
+
<div class="modal-dialog">
|
|
33
|
+
<div class="modal-content">
|
|
34
|
+
<div class="modal-header">
|
|
35
|
+
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
|
36
|
+
<h4 class="modal-title"><%= _('Please Confirm') %></h4>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="modal-body">
|
|
39
|
+
</div>
|
|
40
|
+
<div class="modal-footer">
|
|
41
|
+
<button type="button" class="btn btn-default" data-dismiss="modal"><%= _('Cancel') %></button>
|
|
42
|
+
<button type="button" class="btn btn-primary" onclick="submit_modal_form()"><%= _('Submit') %></button>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
27
47
|
<%= will_paginate_with_info @arf_reports %>
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
<table id='report_log' class="table table-bordered table-striped">
|
|
2
2
|
<thead>
|
|
3
3
|
<tr>
|
|
4
|
-
<th><%= _("
|
|
5
|
-
<th><%= _("Resource") %></th>
|
|
4
|
+
<th><%= _("Severity") %></th>
|
|
6
5
|
<th><%= _("Message") %></th>
|
|
6
|
+
<th><%= _("Resource") %></th>
|
|
7
7
|
<th><%= _("Result") %></th>
|
|
8
8
|
</tr>
|
|
9
9
|
</thead>
|
|
10
10
|
<tbody>
|
|
11
11
|
<% logs.each do |log| %>
|
|
12
12
|
<tr>
|
|
13
|
-
<td><span <%=
|
|
14
|
-
<td
|
|
15
|
-
|
|
13
|
+
<td><span <%= severity_tag log.message.severity %>><%= h log.message.severity %></span></td>
|
|
14
|
+
<td>
|
|
15
|
+
<%= render :partial => 'detailed_message', :locals => { :message => log.message } %>
|
|
16
|
+
</td>
|
|
17
|
+
<td><%= h trunc_with_tooltip(log.source) %></td>
|
|
16
18
|
<td><span <%= result_tag log.result %>><%= h log.result %></span></td>
|
|
17
19
|
</tr>
|
|
18
20
|
<% end %>
|
|
19
|
-
<tr id='ntsh' <%= "style='display: none;'".html_safe if logs.size > 0
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
<tr id='ntsh' <%= "style='display: none;'".html_safe if logs.size > 0%>>
|
|
22
|
+
<td colspan="4">
|
|
23
|
+
<div class="alert alert-warning" role="alert"><%= _("Nothing to show") %></div>
|
|
24
|
+
</td>
|
|
25
|
+
</tr>
|
|
22
26
|
</tbody>
|
|
23
27
|
</table>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<div class="row">
|
|
2
|
+
<div class="col-md-8">
|
|
3
|
+
<table class="table table-bordered table-striped">
|
|
4
|
+
<thead>
|
|
5
|
+
<tr>
|
|
6
|
+
<th>
|
|
7
|
+
<%= _("Host") %>
|
|
8
|
+
</th>
|
|
9
|
+
<th>
|
|
10
|
+
<%= _("Reported At") %>
|
|
11
|
+
</th>
|
|
12
|
+
</tr>
|
|
13
|
+
</thead>
|
|
14
|
+
<tbody>
|
|
15
|
+
<% @arf_reports.each do |report| %>
|
|
16
|
+
<tr>
|
|
17
|
+
<td><%= report.host %></td>
|
|
18
|
+
<td><%=h report.created_at %></td>
|
|
19
|
+
</tr>
|
|
20
|
+
<% end %>
|
|
21
|
+
</tbody>
|
|
22
|
+
</table>
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<%= form_tag submit_delete_multiple_arf_reports_path({:arf_report_ids => params[:arf_report_ids]}) do %>
|
|
27
|
+
<span class="label label-danger"><%= _('Delete') %></span>
|
|
28
|
+
<%= _('these Complinace reports') %>
|
|
29
|
+
<% end %>
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
<%= javascript 'foreman_openscap/reports' %>
|
|
2
|
+
<%= stylesheet 'foreman_openscap/reports' %>
|
|
1
3
|
<% title "#{@arf_report.host}" %>
|
|
2
4
|
<p class='ra'> <%= _("Reported at %s ") % @arf_report.reported_at %> </p>
|
|
3
5
|
|
|
4
6
|
<% content_for(:search_bar) {show_logs} %>
|
|
5
7
|
|
|
6
8
|
<%= render 'output', :logs => @arf_report.logs%>
|
|
7
|
-
<%= render 'metrics', :status => @arf_report.status, :metrics => @arf_report.metrics %>
|
|
9
|
+
<%= render 'metrics', :status => @arf_report.status, :metrics => @arf_report.metrics if @arf_report.logs.any? %>
|
|
8
10
|
|
|
9
11
|
<%= title_actions link_to(_('Back'), :back),
|
|
10
12
|
display_delete_if_authorized(hash_for_arf_report_path(:id => @arf_report), :class=> "btn btn-danger"),
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<%= javascript 'foreman_openscap/openscap_proxy' %>
|
|
2
|
+
<% data_url = @host ? openscap_proxy_changed_hosts_path : openscap_proxy_changed_hostgroups_path%>
|
|
3
|
+
<%= select_f f, :openscap_proxy_id, SmartProxy.with_features("Openscap"), :id, :name,
|
|
4
|
+
{ :include_blank => blank_or_inherit_f(f, :openscap_proxy) },
|
|
5
|
+
{ :label => _('Openscap Proxy'),
|
|
6
|
+
:onchange => 'updateOpenscapProxy(this)',
|
|
7
|
+
:'data-url' => data_url,
|
|
8
|
+
:help_inline => :indicator } %>
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
{ :include_blank => _('Choose period') },
|
|
33
33
|
{ :onchange => 'period_selected(this)' }) %>
|
|
34
34
|
<%= select_f(f, :weekday, days_of_week_hash, :first, :last, :include_blank => _('Choose weekday')) %>
|
|
35
|
-
<%=
|
|
35
|
+
<%= select_f(f, :day_of_month, (1..31).to_a, :to_i, :to_s, :help_inline => _('Number of a day in month, note that not all months have same count of days')) %>
|
|
36
36
|
<%= text_f(f, :cron_line, :help_inline => _('You can specify custom cron line, e.g. "0 3 * * *", separate each of 5 values by space')) %>
|
|
37
37
|
</div>
|
|
38
38
|
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
{ :include_blank => _('Choose period') },
|
|
7
7
|
{ :onchange => 'period_selected(this)' }) %>
|
|
8
8
|
<%= select_f(f, :weekday, days_of_week_hash, :first, :last, :include_blank => _('Choose weekday')) %>
|
|
9
|
-
<%=
|
|
9
|
+
<%= select_f(f, :day_of_month, (1..31).to_a, :to_i, :to_s, :help_inline => _('Number of a day in month, note that not all months have same count of days')) %>
|
|
10
10
|
<%= text_f(f, :cron_line, :help_inline => _('You can specify custom cron line, e.g. "0 3 * * *", separate each of 5 values by space')) %>
|
|
11
11
|
</div>
|
data/config/routes.rb
CHANGED
|
@@ -10,6 +10,8 @@ Rails.application.routes.draw do
|
|
|
10
10
|
end
|
|
11
11
|
collection do
|
|
12
12
|
get 'auto_complete_search'
|
|
13
|
+
get 'delete_multiple'
|
|
14
|
+
post 'submit_delete_multiple'
|
|
13
15
|
end
|
|
14
16
|
end
|
|
15
17
|
|
|
@@ -17,7 +19,7 @@ Rails.application.routes.draw do
|
|
|
17
19
|
|
|
18
20
|
resources :policies, :only => [:index, :new, :show, :create, :edit, :update, :destroy] do
|
|
19
21
|
member do
|
|
20
|
-
|
|
22
|
+
match 'parse'
|
|
21
23
|
match 'dashboard', :to => 'policy_dashboard#index', :as => 'policy_dashboard'
|
|
22
24
|
end
|
|
23
25
|
collection do
|
|
@@ -56,3 +58,17 @@ Rails.application.routes.draw do
|
|
|
56
58
|
end
|
|
57
59
|
end
|
|
58
60
|
end
|
|
61
|
+
|
|
62
|
+
Foreman::Application.routes.draw do
|
|
63
|
+
resources :hosts do
|
|
64
|
+
collection do
|
|
65
|
+
post 'openscap_proxy_changed'
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
resources :hostgroups do
|
|
70
|
+
collection do
|
|
71
|
+
post 'openscap_proxy_changed'
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
class CreateScaptimonyAssets < ActiveRecord::Migration
|
|
2
2
|
def change
|
|
3
3
|
create_table :scaptimony_assets do |t|
|
|
4
|
-
t.string :name, limit
|
|
4
|
+
t.string :name, :limit => 255
|
|
5
5
|
|
|
6
6
|
t.timestamps
|
|
7
7
|
end
|
|
8
|
-
add_index :scaptimony_assets, :name, unique
|
|
8
|
+
add_index :scaptimony_assets, :name, :unique => true
|
|
9
9
|
end
|
|
10
10
|
end
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
class CreateScaptimonyArfReports < ActiveRecord::Migration
|
|
2
2
|
def change
|
|
3
3
|
create_table :scaptimony_arf_reports do |t|
|
|
4
|
-
t.references :asset, index
|
|
5
|
-
t.references :policy, index
|
|
4
|
+
t.references :asset, :index => true
|
|
5
|
+
t.references :policy, :index => true
|
|
6
6
|
t.datetime :date
|
|
7
|
-
t.string :digest, limit
|
|
7
|
+
t.string :digest, :limit => 128
|
|
8
8
|
|
|
9
9
|
t.timestamps
|
|
10
10
|
end
|
|
11
|
-
add_index :scaptimony_arf_reports, :digest, unique
|
|
11
|
+
add_index :scaptimony_arf_reports, :digest, :unique => true
|
|
12
12
|
end
|
|
13
13
|
end
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
class CreateScaptimonyPolicyRevisions < ActiveRecord::Migration
|
|
2
2
|
def change
|
|
3
3
|
create_table :scaptimony_policy_revisions do |t|
|
|
4
|
-
t.references :policy, index
|
|
5
|
-
t.references :scap_content, index
|
|
4
|
+
t.references :policy, :index => true
|
|
5
|
+
t.references :scap_content, :index => true
|
|
6
6
|
t.string :xccdf_profile
|
|
7
7
|
t.string :period
|
|
8
8
|
t.string :weekday
|
|
@@ -7,6 +7,6 @@ class AddColumnsToScaptimonyPolicies < ActiveRecord::Migration
|
|
|
7
7
|
|
|
8
8
|
# This works only with rails-4, I want to support rails-3 too
|
|
9
9
|
# add_reference :scaptimony_policies, :scap_content, index: true
|
|
10
|
-
add_column :scaptimony_policies, :scap_content_id, :integer, references
|
|
10
|
+
add_column :scaptimony_policies, :scap_content_id, :integer, :references => :scap_content
|
|
11
11
|
end
|
|
12
12
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
class CreateScaptimonyScapContentProfiles < ActiveRecord::Migration
|
|
2
2
|
def change
|
|
3
3
|
create_table :scaptimony_scap_content_profiles do |t|
|
|
4
|
-
t.references :scap_content, index
|
|
4
|
+
t.references :scap_content, :index => true
|
|
5
5
|
t.string :profile_id
|
|
6
6
|
t.string :title
|
|
7
7
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
class AddProfileToScaptimonyPolicies < ActiveRecord::Migration
|
|
2
2
|
def change
|
|
3
3
|
# add_reference :scaptimony_policies, :scap_content_profile, index: true
|
|
4
|
-
add_column :scaptimony_policies, :scap_content_profile_id, :integer, references
|
|
4
|
+
add_column :scaptimony_policies, :scap_content_profile_id, :integer, :references => :scap_content_profile
|
|
5
5
|
end
|
|
6
6
|
end
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
class CreateScaptimonyXccdfRuleResults < ActiveRecord::Migration
|
|
2
2
|
def change
|
|
3
3
|
create_table :scaptimony_xccdf_rule_results do |t|
|
|
4
|
-
t.references :arf_report, index
|
|
5
|
-
t.references :xccdf_result, index
|
|
6
|
-
t.references :xccdf_rule, index
|
|
4
|
+
t.references :arf_report, :index => true, :null => false
|
|
5
|
+
t.references :xccdf_result, :index => true, :null => false
|
|
6
|
+
t.references :xccdf_rule, :index => true, :null => false
|
|
7
7
|
end
|
|
8
8
|
end
|
|
9
9
|
end
|
|
@@ -25,7 +25,7 @@ class MigrateFromScaptimony < ActiveRecord::Migration
|
|
|
25
25
|
SQL
|
|
26
26
|
|
|
27
27
|
taxonomies = TaxableTaxonomy.where(:taxable_type => ["Scaptimony::ArfReport", "Scaptimony::Policy", "Scaptimony::ScapContent"])
|
|
28
|
-
taxonomies.each { |t| t.taxable_type = t.taxable_type.sub(/^Scaptimony/, "ForemanOpenscap")}.map(&:save!)
|
|
28
|
+
taxonomies.each { |t| t.taxable_type = t.taxable_type.sub(/^Scaptimony/, "ForemanOpenscap") }.map(&:save!)
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
def down
|
|
@@ -54,6 +54,6 @@ class MigrateFromScaptimony < ActiveRecord::Migration
|
|
|
54
54
|
SQL
|
|
55
55
|
|
|
56
56
|
taxonomies = TaxableTaxonomy.where(:taxable_type => ["ForemanOpenscap::ArfReport", "ForemanOpenscap::Policy", "ForemanOpenscap::ScapContent"])
|
|
57
|
-
taxonomies.each { |t| t.taxable_type = t.taxable_type.sub(/^ForemanOpenscap/, "Scaptimony")}.map(&:save!)
|
|
57
|
+
taxonomies.each { |t| t.taxable_type = t.taxable_type.sub(/^ForemanOpenscap/, "Scaptimony") }.map(&:save!)
|
|
58
58
|
end
|
|
59
59
|
end
|