foreman_openscap 0.8.6 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/api/v2/compliance/arf_reports_controller.rb +3 -3
  3. data/app/controllers/api/v2/compliance/policies_controller.rb +2 -2
  4. data/app/controllers/api/v2/compliance/scap_contents_controller.rb +1 -1
  5. data/app/controllers/api/v2/compliance/tailoring_files_controller.rb +2 -2
  6. data/app/controllers/arf_reports_controller.rb +2 -2
  7. data/app/controllers/concerns/foreman_openscap/hosts_controller_extensions.rb +4 -7
  8. data/app/controllers/policies_controller.rb +3 -3
  9. data/app/controllers/policy_dashboard_controller.rb +1 -1
  10. data/app/controllers/scap_contents_controller.rb +2 -2
  11. data/app/controllers/tailoring_files_controller.rb +2 -2
  12. data/app/helpers/arf_reports_helper.rb +1 -1
  13. data/app/helpers/concerns/foreman_openscap/hosts_helper_extensions.rb +4 -11
  14. data/app/helpers/concerns/foreman_openscap/lookup_keys_helper_extensions.rb +2 -8
  15. data/app/helpers/policies_helper.rb +1 -1
  16. data/app/lib/proxy_api/openscap.rb +2 -3
  17. data/app/models/concerns/foreman_openscap/host_extensions.rb +19 -20
  18. data/app/models/foreman_openscap/arf_report.rb +8 -12
  19. data/app/views/scap_contents/_form.html.erb +1 -1
  20. data/app/views/tailoring_files/_form.html.erb +1 -1
  21. data/db/migrate/20141013172051_create_scaptimony_policies.rb +1 -1
  22. data/db/migrate/20141014105333_create_scaptimony_assets.rb +1 -1
  23. data/db/migrate/20141015092642_create_scaptimony_arf_reports.rb +1 -1
  24. data/db/migrate/20141015115511_add_arf_report_unique_constraint.rb +1 -1
  25. data/db/migrate/20141104164201_create_scaptimony_scap_contents.rb +1 -1
  26. data/db/migrate/20141104171545_create_scaptimony_policy_revisions.rb +1 -1
  27. data/db/migrate/20141105174625_add_description_to_scaptimony_policy_revisions.rb +1 -1
  28. data/db/migrate/20141105174834_add_columns_to_scaptimony_policies.rb +1 -1
  29. data/db/migrate/20141107091756_add_columns_to_scaptimony_scap_contents.rb +1 -1
  30. data/db/migrate/20141111104519_add_constraint_to_scaptimony_scap_contents.rb +1 -1
  31. data/db/migrate/20141113221054_create_scaptimony_scap_content_profiles.rb +1 -1
  32. data/db/migrate/20141116170632_remove_xccdf_profile_from_scaptimony_policies.rb +1 -1
  33. data/db/migrate/20141116171305_add_profile_to_scaptimony_policies.rb +1 -1
  34. data/db/migrate/20141118142954_add_constraint_to_scaptimony_policies.rb +1 -1
  35. data/db/migrate/20141119164918_create_scaptimony_xccdf_results.rb +1 -1
  36. data/db/migrate/20141119175434_create_scaptimony_xccdf_rules.rb +1 -1
  37. data/db/migrate/20141119182606_create_scaptimony_xccdf_rule_results.rb +1 -1
  38. data/db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb +1 -1
  39. data/db/migrate/20141121164042_replace_arf_report_breakdown_view.rb +1 -1
  40. data/db/migrate/20141206211151_create_scaptimony_assets_policies.rb +1 -1
  41. data/db/migrate/20141214112917_add_scap_file_to_scap_content.rb +1 -1
  42. data/db/migrate/20141216154502_rename_scaptimony_asset_policies.rb +1 -1
  43. data/db/migrate/20150111085317_polymorph_asset.rb +1 -1
  44. data/db/migrate/20150112152944_create_scaptimony_arf_report_raws.rb +1 -1
  45. data/db/migrate/20150114210634_rename_scaptimony_arf_report_raw_raw.rb +1 -1
  46. data/db/migrate/20150115155947_add_scaptimony_scap_content_digest.rb +1 -1
  47. data/db/migrate/20150116083129_add_day_of_month_and_cron_line_to_scaptimony_policy.rb +1 -1
  48. data/db/migrate/20150821100137_migrate_from_scaptimony.rb +1 -1
  49. data/db/migrate/20150827123826_remove_scaptimony_permissions.rb +1 -1
  50. data/db/migrate/20150925124959_create_policy_arf_reports.rb +1 -1
  51. data/db/migrate/20150929124853_add_result_to_logs.rb +1 -1
  52. data/db/migrate/20150929152345_move_arf_reports_to_reports_table.rb +2 -2
  53. data/db/migrate/20151118165125_add_size_to_scap_content.rb +1 -1
  54. data/db/migrate/20151119155419_add_arf_fields_to_message.rb +1 -1
  55. data/db/migrate/20151120090851_add_openscap_proxy_to_host_and_hostgroup.rb +1 -1
  56. data/db/migrate/20160830113437_remove_deleted_policy.rb +1 -1
  57. data/db/migrate/20160925213031_change_scap_widget_names.rb +1 -1
  58. data/db/migrate/20161109155255_create_tailoring_files.rb +1 -1
  59. data/db/migrate/20161223153249_add_permissions_to_arf_report.rb +1 -1
  60. data/db/migrate/20170821081205_rename_mail_notification.foreman_openscap.rb +1 -1
  61. data/db/migrate/20170830221751_add_index_to_logs_result.rb +1 -1
  62. data/db/migrate/20171011134112_remove_arf_reports_without_policy.rb +1 -11
  63. data/db/migrate/20171016125613_add_content_title_unique_constraint.foreman_openscap.rb +1 -1
  64. data/lib/foreman_openscap/engine.rb +5 -5
  65. data/lib/foreman_openscap/version.rb +1 -1
  66. data/test/factories/arf_report_factory.rb +1 -1
  67. data/test/functional/api/v2/compliance/arf_reports_controller_test.rb +21 -21
  68. data/test/functional/api/v2/compliance/policies_controller_test.rb +12 -12
  69. data/test/functional/api/v2/compliance/scap_contents_controller_test.rb +6 -6
  70. data/test/functional/api/v2/compliance/tailoring_files_controller_test.rb +8 -8
  71. data/test/functional/arf_reports_controller_test.rb +3 -3
  72. data/test/functional/openscap_proxies_controller_test.rb +1 -1
  73. data/test/functional/tailoring_files_controller_test.rb +6 -6
  74. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a2517a24cb92ee7898fa02ab267bc2e32f05565
4
- data.tar.gz: 1c4beabb618e2953f03bae31db8bfe988c72076a
3
+ metadata.gz: 8860c02972d0a7286d2d44f6a23c02a79a540ad1
4
+ data.tar.gz: a0789f0a6842b9609f688208e9a7e9dc7289ba1f
5
5
  SHA512:
6
- metadata.gz: 8d9b4179678e3e3d69f59636dafbc5e895a198c032354ac3fc9793d6f0006d7d4c9fe53aa7bae414606fccf2f7f2e9341836c6b76a2713ed7d61c439d9d55dae
7
- data.tar.gz: ad099fa637e2fdbe1efa5e9b07e4fd79901e186c9c985bf22dd94a05296df1a1fa07300366fc4fbd981ecf288fff3ac013407b917bbc06842c070283d4d22121
6
+ metadata.gz: 6f5c7ba56f44c5db6828ffa2d5f6d02fb470e910c8614a11ec68121962f04c96472b5edf6e35e4abd20b29b68b012f3c67c0b192268c98b517f7ee8b63b4286c
7
+ data.tar.gz: 2b495b6833ec1362dc7dcc386d83e1a3c076c742db55bce19b80301f793b961e8db16535abaf41478d28815086305447dff21ed6c15d5a40626260b4eb7b7f54
@@ -10,8 +10,8 @@ module Api
10
10
 
11
11
  add_smart_proxy_filters :create, :features => 'Openscap'
12
12
 
13
- before_filter :find_resource, :only => %w[show destroy download download_html]
14
- skip_after_filter :log_response_body, :only => %w[download download_html]
13
+ before_action :find_resource, :only => %w[show destroy download download_html]
14
+ skip_after_action :log_response_body, :only => %w[download download_html]
15
15
 
16
16
  def resource_name
17
17
  '::ForemanOpenscap::ArfReport'
@@ -49,7 +49,7 @@ module Api
49
49
  def create
50
50
  asset = ForemanOpenscap::Helper::get_asset(params[:cname], params[:policy_id])
51
51
  if asset.host.openscap_proxy
52
- arf_report = ForemanOpenscap::ArfReport.create_arf(asset, params)
52
+ arf_report = ForemanOpenscap::ArfReport.create_arf(asset, params.to_unsafe_h)
53
53
  asset.host.refresh_statuses([HostStatus.find_status_by_humanized_name("compliance")])
54
54
  render :json => { :result => :OK, :id => arf_report.id.to_s }
55
55
  else
@@ -6,9 +6,9 @@ module Api::V2
6
6
 
7
7
  add_smart_proxy_filters %i[content tailoring], :features => 'Openscap'
8
8
 
9
- before_filter :find_resource, :except => %w[index create]
9
+ before_action :find_resource, :except => %w[index create]
10
10
 
11
- skip_after_filter :log_response_body, :only => [:content]
11
+ skip_after_action :log_response_body, :only => [:content]
12
12
 
13
13
  def resource_name
14
14
  '::ForemanOpenscap::Policy'
@@ -2,7 +2,7 @@ module Api::V2
2
2
  module Compliance
3
3
  class ScapContentsController < ::Api::V2::BaseController
4
4
  include Foreman::Controller::Parameters::ScapContent
5
- before_filter :find_resource, :except => %w[index create]
5
+ before_action :find_resource, :except => %w[index create]
6
6
 
7
7
  def resource_name
8
8
  '::ForemanOpenscap::ScapContent'
@@ -2,8 +2,8 @@ module Api::V2
2
2
  module Compliance
3
3
  class TailoringFilesController < ::Api::V2::BaseController
4
4
  include Foreman::Controller::Parameters::TailoringFile
5
- before_filter :find_resource, :except => %w[index create]
6
- before_filter :openscap_proxy_check, :only => %w[create]
5
+ before_action :find_resource, :except => %w[index create]
6
+ before_action :openscap_proxy_check, :only => %w[create]
7
7
 
8
8
  def resource_name
9
9
  '::ForemanOpenscap::TailoringFile'
@@ -2,8 +2,8 @@ class ArfReportsController < ApplicationController
2
2
  include Foreman::Controller::AutoCompleteSearch
3
3
  include ForemanOpenscap::ArfReportsControllerCommonExtensions
4
4
 
5
- before_filter :find_arf_report, :only => %i[show show_html destroy parse_html parse_bzip download_html]
6
- before_filter :find_multiple, :only => %i[delete_multiple submit_delete_multiple]
5
+ before_action :find_arf_report, :only => %i[show show_html destroy parse_html parse_bzip download_html]
6
+ before_action :find_multiple, :only => %i[delete_multiple submit_delete_multiple]
7
7
 
8
8
  def model_of_controller
9
9
  ::ForemanOpenscap::ArfReport
@@ -1,17 +1,14 @@
1
1
  module ForemanOpenscap
2
2
  module HostsControllerExtensions
3
- extend ActiveSupport::Concern
4
-
5
- included do
6
- alias_method_chain :process_hostgroup, :openscap
7
- self::AJAX_REQUESTS << 'openscap_proxy_changed'
3
+ def self.prepended(base)
4
+ base::AJAX_REQUESTS << 'openscap_proxy_changed'
8
5
  end
9
6
 
10
- def process_hostgroup_with_openscap
7
+ def process_hostgroup
11
8
  @hostgroup = Hostgroup.find(params[:host][:hostgroup_id]) if params[:host][:hostgroup_id].to_i > 0
12
9
  return head(:not_found) unless @hostgroup
13
10
  @openscap_proxy = @hostgroup.openscap_proxy
14
- process_hostgroup_without_openscap
11
+ super
15
12
  end
16
13
  end
17
14
  end
@@ -2,9 +2,9 @@ class PoliciesController < ApplicationController
2
2
  include Foreman::Controller::AutoCompleteSearch
3
3
  include Foreman::Controller::Parameters::Policy
4
4
 
5
- before_filter :find_by_id, :only => %i[show edit update parse destroy]
6
- before_filter :find_multiple, :only => %i[select_multiple_hosts update_multiple_hosts disassociate_multiple_hosts remove_policy_from_multiple_hosts]
7
- before_filter :find_tailoring_file, :only => [:tailoring_file_selected]
5
+ before_action :find_by_id, :only => %i[show edit update parse destroy]
6
+ before_action :find_multiple, :only => %i[select_multiple_hosts update_multiple_hosts disassociate_multiple_hosts remove_policy_from_multiple_hosts]
7
+ before_action :find_tailoring_file, :only => [:tailoring_file_selected]
8
8
 
9
9
  def model_of_controller
10
10
  ::ForemanOpenscap::Policy
@@ -1,5 +1,5 @@
1
1
  class PolicyDashboardController < ApplicationController
2
- before_filter :prefetch_data, :only => :index
2
+ before_action :prefetch_data, :only => :index
3
3
 
4
4
  def index
5
5
  end
@@ -2,8 +2,8 @@ class ScapContentsController < ApplicationController
2
2
  include Foreman::Controller::AutoCompleteSearch
3
3
  include Foreman::Controller::Parameters::ScapContent
4
4
 
5
- before_filter :handle_file_upload, :only => %i[create update]
6
- before_filter :find_by_id, :only => %i[show edit update destroy]
5
+ before_action :handle_file_upload, :only => %i[create update]
6
+ before_action :find_by_id, :only => %i[show edit update destroy]
7
7
 
8
8
  def model_of_controller
9
9
  ::ForemanOpenscap::ScapContent
@@ -2,8 +2,8 @@ class TailoringFilesController < ApplicationController
2
2
  include Foreman::Controller::AutoCompleteSearch
3
3
  include Foreman::Controller::Parameters::TailoringFile
4
4
 
5
- before_filter :find_tailoring_file, :only => %i[destroy update edit xml]
6
- before_filter :handle_file_upload, :only => %i[create update]
5
+ before_action :find_tailoring_file, :only => %i[destroy update edit xml]
6
+ before_action :handle_file_upload, :only => %i[create update]
7
7
 
8
8
  def model_of_controller
9
9
  ::ForemanOpenscap::TailoringFile
@@ -59,7 +59,7 @@ module ArfReportsHelper
59
59
  end
60
60
 
61
61
  def reported_info(arf_report)
62
- msg = _("Reported at %s") % arf_report.reported_at
62
+ msg = _("Reported at %s") % date_time_absolute(arf_report.reported_at)
63
63
  msg << _(" for policy %s") % display_link_if_authorized(arf_report.policy.name, hash_for_edit_policy_path(:id => arf_report.policy.id)) if arf_report.policy
64
64
  return msg.html_safe unless arf_report.openscap_proxy
65
65
  msg += _(" through %s") % openscap_proxy_link(arf_report)
@@ -1,19 +1,12 @@
1
1
  module ForemanOpenscap
2
2
  module HostsHelperExtensions
3
- extend ActiveSupport::Concern
4
-
5
- included do
6
- alias_method_chain :multiple_actions, :scap
7
- alias_method_chain :name_column, :scap
8
- end
9
-
10
- def multiple_actions_with_scap
11
- multiple_actions_without_scap + [[_('Assign Compliance Policy'), select_multiple_hosts_policies_path],
3
+ def multiple_actions
4
+ super + [[_('Assign Compliance Policy'), select_multiple_hosts_policies_path],
12
5
  [_('Unassign Compliance Policy'), disassociate_multiple_hosts_policies_path]]
13
6
  end
14
7
 
15
- def name_column_with_scap(record)
16
- record.nil? ? _('Host is deleted') : name_column_without_scap(record)
8
+ def name_column(record)
9
+ record.nil? ? _('Host is deleted') : super(record)
17
10
  end
18
11
  end
19
12
  end
@@ -1,14 +1,8 @@
1
1
  module ForemanOpenscap
2
2
  module LookupKeysHelperExtensions
3
- extend ActiveSupport::Concern
4
-
5
- included do
6
- alias_method_chain :overridable_lookup_keys, :scap
7
- end
8
-
9
- def overridable_lookup_keys_with_scap(klass, obj)
3
+ def overridable_lookup_keys(klass, obj)
10
4
  return [] if klass.name == "foreman_scap_client"
11
- overridable_lookup_keys_without_scap klass, obj
5
+ super klass, obj
12
6
  end
13
7
  end
14
8
  end
@@ -88,7 +88,7 @@ module PoliciesHelper
88
88
  end
89
89
 
90
90
  def previous_link(form)
91
- previous = content_tag(:span, :class => 'glyphicon glyphicon-chevron-left') {}
91
+ previous = content_tag(:span, :class => 'glyphicon glyphicon-chevron-left')
92
92
  content_tag(:div, :class => 'pull-left') do
93
93
  link_to(previous.html_safe, '#', :class => 'btn btn-default', :onclick => "previous_step('#{@policy.previous_step}')")
94
94
  end
@@ -51,9 +51,8 @@ module ::ProxyAPI
51
51
  begin
52
52
  parse(delete("arf/#{report.id}/#{cname}/#{report.reported_at.to_i}/#{report.policy_arf_report.digest}"))
53
53
  rescue => e
54
- msg = "Failed to destroy arf report with id #{report.id} on Smart Proxy, cause: #{e.message}"
55
- logger.error msg
56
- report.errors.add(:base, msg)
54
+ logger.error "Failed to destroy arf report with id #{report.id} on Smart Proxy"
55
+ logger.debug e.backtrace.join("\n\t")
57
56
  false
58
57
  end
59
58
  end
@@ -1,55 +1,54 @@
1
1
  module ForemanOpenscap
2
2
  module HostExtensions
3
- extend ActiveSupport::Concern
4
3
  ::Host::Managed::Jail.allow :policies_enc
5
4
 
6
- included do
7
- has_one :asset, :as => :assetable, :class_name => "::ForemanOpenscap::Asset"
8
- has_many :asset_policies, :through => :asset, :class_name => "::ForemanOpenscap::AssetPolicy"
9
- has_many :policies, :through => :asset_policies, :class_name => "::ForemanOpenscap::Policy"
10
- has_many :arf_reports, :class_name => '::ForemanOpenscap::ArfReport', :foreign_key => :host_id
11
- has_one :compliance_status_object, :class_name => '::ForemanOpenscap::ComplianceStatus', :foreign_key => 'host_id'
5
+ def self.prepended(base)
6
+ base.has_one :asset, :as => :assetable, :class_name => "::ForemanOpenscap::Asset"
7
+ base.has_many :asset_policies, :through => :asset, :class_name => "::ForemanOpenscap::AssetPolicy"
8
+ base.has_many :policies, :through => :asset_policies, :class_name => "::ForemanOpenscap::Policy"
9
+ base.has_many :arf_reports, :class_name => '::ForemanOpenscap::ArfReport', :foreign_key => :host_id
10
+ base.has_one :compliance_status_object, :class_name => '::ForemanOpenscap::ComplianceStatus', :foreign_key => 'host_id'
12
11
 
13
- scoped_search :relation => :policies, :on => :name, :complete_value => true, :rename => :compliance_policy,
12
+ base.scoped_search :relation => :policies, :on => :name, :complete_value => true, :rename => :compliance_policy,
14
13
  :only_explicit => true, :operators => ['= '], :ext_method => :search_by_policy_name
15
14
 
16
- scoped_search :relation => :policies, :on => :id, :complete_value => false, :rename => :compliance_policy_id,
15
+ base.scoped_search :relation => :policies, :on => :id, :complete_value => false, :rename => :compliance_policy_id,
17
16
  :only_explicit => true, :operators => ['= ', '!= '], :ext_method => :search_by_policy_id
18
17
 
19
- scoped_search :relation => :policies, :on => :name, :complete_value => true, :rename => :compliance_report_missing_for,
18
+ base.scoped_search :relation => :policies, :on => :name, :complete_value => true, :rename => :compliance_report_missing_for,
20
19
  :only_explicit => true, :operators => ['= ', '!= '], :ext_method => :search_by_missing_arf
21
20
 
22
- scoped_search :relation => :compliance_status_object, :on => :status, :rename => :compliance_status,
21
+ base.scoped_search :relation => :compliance_status_object, :on => :status, :rename => :compliance_status,
23
22
  :complete_value => { :compliant => ::ForemanOpenscap::ComplianceStatus::COMPLIANT,
24
23
  :incompliant => ::ForemanOpenscap::ComplianceStatus::INCOMPLIANT,
25
24
  :inconclusive => ::ForemanOpenscap::ComplianceStatus::INCONCLUSIVE }
26
- after_update :puppetrun!, :if => ->(host) { Setting[:puppetrun] && host.changed.include?('openscap_proxy_id') }
25
+ base.after_update :puppetrun!, :if => ->(host) { Setting[:puppetrun] && host.changed.include?('openscap_proxy_id') }
27
26
 
28
- scope :comply_with, lambda { |policy|
27
+ base.scope :comply_with, lambda { |policy|
29
28
  joins(:arf_reports).merge(ArfReport.latest_of_policy(policy)).merge(ArfReport.passed)
30
29
  }
31
30
 
32
- scope :incomply_with, lambda { |policy|
31
+ base.scope :incomply_with, lambda { |policy|
33
32
  joins(:arf_reports).merge(ArfReport.latest_of_policy(policy)).merge(ArfReport.failed)
34
33
  }
35
34
 
36
- scope :inconclusive_with, lambda { |policy|
35
+ base.scope :inconclusive_with, lambda { |policy|
37
36
  joins(:arf_reports).merge(ArfReport.latest_of_policy(policy)).merge(ArfReport.othered)
38
37
  }
39
38
 
40
- scope :policy_reports_missing, lambda { |policy|
39
+ base.scope :policy_reports_missing, lambda { |policy|
41
40
  search_for("compliance_report_missing_for = \"#{policy.name}\"")
42
41
  }
43
42
 
44
- scope :assigned_to_policy, lambda { |policy|
43
+ base.scope :assigned_to_policy, lambda { |policy|
45
44
  search_for("compliance_policy = \"#{policy.name}\"")
46
45
  }
47
46
 
48
- alias_method_chain :inherited_attributes, :openscap
47
+ base.send :extend, ClassMethods
49
48
  end
50
49
 
51
- def inherited_attributes_with_openscap
52
- inherited_attributes_without_openscap.concat(%w[openscap_proxy_id])
50
+ def inherited_attributes
51
+ super.concat(%w[openscap_proxy_id])
53
52
  end
54
53
 
55
54
  def policies=(policies)
@@ -189,22 +189,18 @@ module ForemanOpenscap
189
189
  end
190
190
 
191
191
  def destroy_from_proxy
192
- if !host
193
- destroy_from_proxy_warning "host"
194
- elsif !policy
195
- destroy_from_proxy_warning "policy"
196
- elsif !openscap_proxy
197
- destroy_from_proxy_warning "OpenSCAP proxy"
192
+ if host
193
+ begin
194
+ openscap_proxy_api.destroy_report(self, ForemanOpenscap::Helper::find_name_or_uuid_by_host(host))
195
+ rescue Foreman::Exception => e
196
+ logger.error "Failed to delete report with id #{id} from proxy, cause: #{e.message}"
197
+ logger.debug e.backtrace.join("\n\t")
198
+ end
198
199
  else
199
- openscap_proxy_api.destroy_report(self, ForemanOpenscap::Helper::find_name_or_uuid_by_host(host))
200
+ logger.error "Failed to delete report with id #{id} from proxy, no host associated with report"
200
201
  end
201
202
  end
202
203
 
203
- def destroy_from_proxy_warning(associated)
204
- logger.warn "Skipping deletion of report with id #{id} from proxy, no #{associated} associated with report"
205
- true
206
- end
207
-
208
204
  def self.newline_to_space(string)
209
205
  string.gsub(/ *\n+/, " ")
210
206
  end
@@ -17,7 +17,7 @@
17
17
  <div class="tab-content">
18
18
  <div class="tab-pane active" id="primary">
19
19
  <%= text_f(f, :title) %>
20
- <%= file_field_f f, :scap_file, :help_block => _("Upload SCAP DataStream file") %>
20
+ <%= file_field_f f, :scap_file, :file_name => @scap_content.original_filename , :label_help => _("SCAP DataStream file") %>
21
21
  </div>
22
22
  <%= render 'taxonomies/loc_org_tabs', :f => f, :obj => @scap_content %>
23
23
  <%= submit_or_cancel f %>
@@ -17,7 +17,7 @@
17
17
  <div class="tab-content">
18
18
  <div class="tab-pane active" id="primary">
19
19
  <%= text_f(f, :name) %>
20
- <%= file_field_f f, :scap_file, :help_block => _("Upload DataStream Tailoring file") %>
20
+ <%= file_field_f f, :scap_file, :file_name => @tailoring_file.original_filename, :label_help => _("DataStream Tailoring file") %>
21
21
  </div>
22
22
  <%= render 'taxonomies/loc_org_tabs', :f => f, :obj => @tailoring_file %>
23
23
  <%= submit_or_cancel f %>
@@ -1,4 +1,4 @@
1
- class CreateScaptimonyPolicies < ActiveRecord::Migration
1
+ class CreateScaptimonyPolicies < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :scaptimony_policies do |t|
4
4
  t.string :name, :limit => 80
@@ -1,4 +1,4 @@
1
- class CreateScaptimonyAssets < ActiveRecord::Migration
1
+ class CreateScaptimonyAssets < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :scaptimony_assets do |t|
4
4
  t.string :name, :limit => 255
@@ -1,4 +1,4 @@
1
- class CreateScaptimonyArfReports < ActiveRecord::Migration
1
+ class CreateScaptimonyArfReports < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :scaptimony_arf_reports do |t|
4
4
  t.references :asset, :index => true
@@ -1,4 +1,4 @@
1
- class AddArfReportUniqueConstraint < ActiveRecord::Migration
1
+ class AddArfReportUniqueConstraint < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_index :scaptimony_arf_reports, %i[asset_id policy_id date digest],
4
4
  :unique => true, :name => :index_scaptimony_arf_reports_unique_set
@@ -1,4 +1,4 @@
1
- class CreateScaptimonyScapContents < ActiveRecord::Migration
1
+ class CreateScaptimonyScapContents < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :scaptimony_scap_contents, &:timestamps
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateScaptimonyPolicyRevisions < ActiveRecord::Migration
1
+ class CreateScaptimonyPolicyRevisions < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :scaptimony_policy_revisions do |t|
4
4
  t.references :policy, :index => true
@@ -1,4 +1,4 @@
1
- class AddDescriptionToScaptimonyPolicyRevisions < ActiveRecord::Migration
1
+ class AddDescriptionToScaptimonyPolicyRevisions < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :scaptimony_policy_revisions, :description, :string
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddColumnsToScaptimonyPolicies < ActiveRecord::Migration
1
+ class AddColumnsToScaptimonyPolicies < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :scaptimony_policies, :xccdf_profile, :string
4
4
  add_column :scaptimony_policies, :period, :string
@@ -1,4 +1,4 @@
1
- class AddColumnsToScaptimonyScapContents < ActiveRecord::Migration
1
+ class AddColumnsToScaptimonyScapContents < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  add_column :scaptimony_scap_contents, :title, :string
4
4
  add_column :scaptimony_scap_contents, :original_filename, :string
@@ -1,4 +1,4 @@
1
- class AddConstraintToScaptimonyScapContents < ActiveRecord::Migration
1
+ class AddConstraintToScaptimonyScapContents < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  change_column :scaptimony_scap_contents, :title, :string, :null => false
4
4
  end
@@ -1,4 +1,4 @@
1
- class CreateScaptimonyScapContentProfiles < ActiveRecord::Migration
1
+ class CreateScaptimonyScapContentProfiles < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  create_table :scaptimony_scap_content_profiles do |t|
4
4
  t.references :scap_content, :index => true
@@ -1,4 +1,4 @@
1
- class RemoveXccdfProfileFromScaptimonyPolicies < ActiveRecord::Migration
1
+ class RemoveXccdfProfileFromScaptimonyPolicies < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  remove_column :scaptimony_policies, :xccdf_profile, :string
4
4
  end
@@ -1,4 +1,4 @@
1
- class AddProfileToScaptimonyPolicies < ActiveRecord::Migration
1
+ class AddProfileToScaptimonyPolicies < ActiveRecord::Migration[4.2]
2
2
  def change
3
3
  # add_reference :scaptimony_policies, :scap_content_profile, index: true
4
4
  add_column :scaptimony_policies, :scap_content_profile_id, :integer, :references => :scap_content_profile