Skip to content

Commit d489bd3

Browse files
committed
Update stop_event_monitor_queue_on_change to take changes
1 parent de2cf4f commit d489bd3

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

app/models/manageiq/providers/openstack/manager_mixin.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ module ManageIQ::Providers::Openstack::ManagerMixin
33
include ManageIQ::Providers::Openstack::HelperMethods
44

55
included do
6-
after_save :stop_event_monitor_queue_on_change
76
before_destroy :stop_event_monitor
87
end
98

@@ -263,21 +262,20 @@ def event_monitor_available?
263262
false
264263
end
265264

266-
def stop_event_monitor_queue_on_change
267-
if event_monitor_class && !self.new_record? && (authentications.detect{ |x| x.previous_changes.present? } ||
268-
endpoints.detect{ |x| x.previous_changes.present? })
265+
def stop_event_monitor_queue_on_change(_changes)
266+
if event_monitor_class && !new_record?
269267
_log.info("EMS: [#{name}], Credentials or endpoints have changed, stopping Event Monitor. It will be restarted by the WorkerMonitor.")
270268
stop_event_monitor_queue
271269
network_manager.stop_event_monitor_queue if try(:network_manager) && !network_manager.new_record?
272270
cinder_manager.stop_event_monitor_queue if try(:cinder_manager) && !cinder_manager.new_record?
273271
end
274272
end
275273

276-
def stop_event_monitor_queue_on_credential_change
274+
def stop_event_monitor_queue_on_credential_change(changes)
277275
# TODO(lsmola) this check should not be needed. Right now we are saving each individual authentication and
278276
# it is breaking the check for changes. We should have it all saved by autosave when saving EMS, so the code
279277
# for authentications needs to be rewritten.
280-
stop_event_monitor_queue_on_change
278+
stop_event_monitor_queue_on_change(changes)
281279
end
282280

283281
def translate_exception(err)

app/models/manageiq/providers/openstack/storage_manager/cinder_manager.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ def allow_targeted_refresh?
8282
true
8383
end
8484

85-
def stop_event_monitor_queue_on_change
86-
if !self.new_record? && parent_manager && (authentications.detect{ |x| x.previous_changes.present? } ||
87-
endpoints.detect{ |x| x.previous_changes.present? })
85+
def stop_event_monitor_queue_on_change(_changes)
86+
if !self.new_record? && parent_manager
8887
_log.info("EMS: [#{name}], Credentials or endpoints have changed, stopping Event Monitor. It will be restarted by the WorkerMonitor.")
8988
stop_event_monitor_queue
9089
end

0 commit comments

Comments
 (0)