From ee90bbf1ffec559c8374e1154df6a0802fcc28fd Mon Sep 17 00:00:00 2001 From: James Wong Date: Mon, 8 May 2017 15:21:48 -0400 Subject: [PATCH] Tower CUD refresh_in_provider followed by manager --- .../ansible_tower/shared/automation_manager/tower_api.rb | 5 ++++- .../automation_manager/configuration_script_source.rb | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/manageiq/providers/ansible_tower/shared/automation_manager/tower_api.rb b/app/models/manageiq/providers/ansible_tower/shared/automation_manager/tower_api.rb index ed2874ae6d7..bf63e514adc 100644 --- a/app/models/manageiq/providers/ansible_tower/shared/automation_manager/tower_api.rb +++ b/app/models/manageiq/providers/ansible_tower/shared/automation_manager/tower_api.rb @@ -67,7 +67,10 @@ def update_in_provider(params) with_provider_object do |provider_object| provider_object.update_attributes!(params) end - self.class.send('refresh', self) + if respond_to?(:refresh_in_provider) + refresh_in_provider + end + self.class.send('refresh', manager) reload rescue AnsibleTowerClient::ClientError => error raise diff --git a/spec/support/ansible_shared/automation_manager/configuration_script_source.rb b/spec/support/ansible_shared/automation_manager/configuration_script_source.rb index fff878810e8..6464275e161 100644 --- a/spec/support/ansible_shared/automation_manager/configuration_script_source.rb +++ b/spec/support/ansible_shared/automation_manager/configuration_script_source.rb @@ -160,7 +160,8 @@ def store_new_project(project, manager) it "#update_in_provider to succeed and send notification" do expect(AnsibleTowerClient::Connection).to receive(:new).and_return(atc) - expect(EmsRefresh).to receive(:queue_refresh_task).with(project).and_return([finished_task]) + expect(EmsRefresh).to receive(:queue_refresh_task).with(manager).and_return([finished_task]) + expect(project).to receive(:refresh_in_provider) expect(Notification).to receive(:create).with(expected_notify) expect(project.update_in_provider({})).to be_a(described_class) end