Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Openscap Result to VM model #15862

Merged
merged 1 commit into from
Sep 18, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/models/openscap_result.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class OpenscapResult < ApplicationRecord
belongs_to :container_image
belongs_to :resource, :polymorphic => true
has_one :binary_blob, :dependent => :destroy, :autosave => true, :as => :resource, :required => true
has_many :openscap_rule_results, :dependent => :destroy, :autosave => true

Expand Down
2 changes: 2 additions & 0 deletions app/models/vm_or_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ class VmOrTemplate < ApplicationRecord
has_many :storage_files, :dependent => :destroy
has_many :storage_files_files, -> { where "rsc_type = 'file'" }, :class_name => "StorageFile"

has_one :openscap_result, :as => :resource, :dependent => :destroy

# EMS Events
has_many :ems_events, ->(vmt) { where(["vm_or_template_id = ? OR dest_vm_or_template_id = ?", vmt.id, vmt.id]).order(:timestamp) },
:class_name => "EmsEvent"
Expand Down