-
Notifications
You must be signed in to change notification settings - Fork 900
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
Fix: Vm#ems_created_on field is empty for vm (VMware provider) #19185
Fix: Vm#ems_created_on field is empty for vm (VMware provider) #19185
Conversation
…whcih converts ActiveRecord_Relation to Array Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1743579
When cloning a VM from a template a VmDeployedEvent is raised which wasn't being picked up by assign_ems_created_on
The assign_ems_created_on method will query the provider so it has to be queued for the ems_operations role
bfba1b5
to
057fb9c
Compare
The query for vm.ems_events wasn't returning any events where the vm was the dest_vm_or_template_id because an extra AND ems_event.vm_or_template_id = id was being added to the where query.
057fb9c
to
219bc92
Compare
app/models/vm_or_template.rb
Outdated
@@ -120,7 +120,7 @@ class VmOrTemplate < ApplicationRecord | |||
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) }, | |||
has_many :ems_events, ->(vmt) { unscope(where: :vm_or_template_id).where(["vm_or_template_id = ? OR dest_vm_or_template_id = ?", vmt.id, vmt.id]).order(:timestamp) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Props to @djberg96 for this ^
fd67e1d
to
b16f469
Compare
\cc @agrare |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but I have some commits here so I'll let someone else review&merge
@bdunne can you take a look? |
b16f469
to
4c6670e
Compare
4c6670e
to
7e7b0c7
Compare
Checked commits yrudman/manageiq@fb27840~...7e7b0c7 with ruby 2.4.6, rubocop 0.69.0, haml-lint 0.20.0, and yamllint 1.10.0 |
ISSUE:
ems_created_on
field is empty for WMvare providerFIX:
reject
instead ofreject!
onActiveRecord::Relation
vm.ems_events
Vm#created_on
should be executed on server which hasems_operations
roleVmDeployedEvent
when looking for newly provisioned VMsFixes https://bugzilla.redhat.com/show_bug.cgi?id=1743579
@miq-bot add-label changelog/yes, bug, core, hammer/yes, ivanchuk/yes