From 428485429546dc8369b00f57e226d463f52e40cd Mon Sep 17 00:00:00 2001 From: Piotr Kliczewski Date: Thu, 9 Nov 2017 17:03:29 +0100 Subject: [PATCH] Refresh new target do not run post_refresh In case when we run refresh_new_target a vm is created before the refresh was run so we need to make sure it is picked up by post_refresh. Bug-Url: https://bugzilla.redhat.com/1510459 --- app/models/ems_refresh.rb | 2 +- spec/models/ems_refresh_spec.rb | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/ems_refresh.rb b/app/models/ems_refresh.rb index 14dc5d04145..f3b37c596ee 100644 --- a/app/models/ems_refresh.rb +++ b/app/models/ems_refresh.rb @@ -109,7 +109,7 @@ def self.refresh_new_target(ems_id, target_hash, target_class, target_find) end ems.refresher.refresh(get_target_objects(target)) - + target.post_create_actions_queue if target.respond_to?(:post_create_actions_queue) target end diff --git a/spec/models/ems_refresh_spec.rb b/spec/models/ems_refresh_spec.rb index 9f17b46a583..3d4f6822382 100644 --- a/spec/models/ems_refresh_spec.rb +++ b/spec/models/ems_refresh_spec.rb @@ -184,7 +184,10 @@ def assert_queue_item(expected_targets) end context '.refresh_new_target' do - let(:ems) { FactoryGirl.create(:ems_vmware) } + let(:ems) do + _, _, zone = EvmSpecHelper.create_guid_miq_server_zone + FactoryGirl.create(:ems_vmware, :zone => zone) + end context 'targeting a new vm' do let(:vm_hash) do