Skip to content

Commit

Permalink
Merge pull request #16949 from gmcculloug/provision_vm_update_name_se…
Browse files Browse the repository at this point in the history
…rvice

Follow up to update_vm_name for Service template provisioning
(cherry picked from commit cdb1271)

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1539750
  • Loading branch information
bdunne authored and simaishi committed Feb 5, 2018
1 parent b1c1ae0 commit 7f3a211
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/miq_provision.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def update_vm_name(new_name, update_request: true)
options[:vm_target_hostname] = get_hostname(new_name)

update_attributes(:description => self.class.get_description(self, new_name), :options => options)
miq_request.update_description_from_tasks if update_request
miq_request.try(:update_description_from_tasks) if update_request
end

def after_ae_delivery(ae_result)
Expand Down
11 changes: 11 additions & 0 deletions spec/models/miq_provision_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@

@vm_prov.update_vm_name(@target_vm_name, :update_request => false)
end

it "When task is part of a ServiceTemplateProvisionRequest the description should not update" do
request_descripton = "Service Name Test"
service_provision_request = FactoryGirl.create(:service_template_provision_request, :description => request_descripton)
@vm_prov.update_attributes(:miq_request_id => service_provision_request.id)

expect(service_provision_request).not_to receive(:update_description_from_tasks)
@vm_prov.update_vm_name(@target_vm_name, :update_request => true)

expect(service_provision_request.description).to eq(request_descripton)
end
end

context "when auto naming sequence exceeds the range" do
Expand Down

0 comments on commit 7f3a211

Please sign in to comment.