From 76aeb6ce3b4ccb0aa65ba4b02308cc97ddf68dd2 Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Tue, 6 Dec 2022 14:21:22 -0500 Subject: [PATCH 1/2] Use the new after_update_endpoints callback for RefreshWorker Restart the RefreshWorker after endpoints are updated --- app/models/manageiq/providers/vmware/infra_manager.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/manageiq/providers/vmware/infra_manager.rb b/app/models/manageiq/providers/vmware/infra_manager.rb index fd8b58e42..610e11b4c 100644 --- a/app/models/manageiq/providers/vmware/infra_manager.rb +++ b/app/models/manageiq/providers/vmware/infra_manager.rb @@ -31,7 +31,6 @@ class Vmware::InfraManager < InfraManager include VimConnectMixin include CisConnectMixin - before_save :stop_event_monitor_queue_on_change, :stop_refresh_worker_queue_on_change before_destroy :stop_event_monitor, :stop_refresh_worker supports :catalog @@ -350,6 +349,11 @@ def after_update_authentication stop_refresh_worker_queue_on_credential_change end + def after_update_endpoints + super + stop_refresh_worker_queue_on_change + end + def self.event_monitor_class self::EventCatcher end From 1a491c556424c0ba2fbcc3c2c3487ce1c1836237 Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Wed, 7 Dec 2022 11:47:57 -0500 Subject: [PATCH 2/2] wip --- .../providers/vmware/infra_manager.rb | 8 ++--- .../providers/vmware/infra_manager_spec.rb | 33 ------------------- 2 files changed, 4 insertions(+), 37 deletions(-) diff --git a/app/models/manageiq/providers/vmware/infra_manager.rb b/app/models/manageiq/providers/vmware/infra_manager.rb index 610e11b4c..1db5b9a3a 100644 --- a/app/models/manageiq/providers/vmware/infra_manager.rb +++ b/app/models/manageiq/providers/vmware/infra_manager.rb @@ -344,14 +344,14 @@ def validate_remote_console_webmks_support true end - def after_update_authentication + def after_update_authentication(changes) super - stop_refresh_worker_queue_on_credential_change + stop_refresh_worker_queue_on_credential_change(changes) end - def after_update_endpoints + def after_update_endpoints(changes) super - stop_refresh_worker_queue_on_change + stop_refresh_worker_queue_on_change(changes) end def self.event_monitor_class diff --git a/spec/models/manageiq/providers/vmware/infra_manager_spec.rb b/spec/models/manageiq/providers/vmware/infra_manager_spec.rb index 44c86e988..3f03cf504 100644 --- a/spec/models/manageiq/providers/vmware/infra_manager_spec.rb +++ b/spec/models/manageiq/providers/vmware/infra_manager_spec.rb @@ -239,39 +239,6 @@ end end - context "handling changes that may require EventCatcher restart" do - before(:each) do - zone = EvmSpecHelper.local_miq_server.zone - @ems = FactoryBot.create(:ems_vmware, :zone => zone) - end - - it "will restart EventCatcher when ipaddress changes" do - @ems.update(:ipaddress => "1.1.1.1") - assert_event_catcher_restart_queued - end - - it "will restart EventCatcher when hostname changes" do - @ems.update(:hostname => "something-else") - assert_event_catcher_restart_queued - end - - it "will restart EventCatcher when credentials change" do - @ems.update_authentication(:default => {:userid => "new_user_id"}) - assert_event_catcher_restart_queued - end - - it "will not put multiple restarts of the EventCatcher on the queue" do - @ems.update(:ipaddress => "1.1.1.1") - @ems.update(:hostname => "something else") - assert_event_catcher_restart_queued - end - - it "will not restart EventCatcher when name changes" do - @ems.update(:name => "something else") - expect(MiqQueue.count).to eq(0) - end - end - context "catalog types" do it "#catalog_types" do ems = FactoryBot.create(:ems_vmware)