Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow up to update_vm_name for Service template provisioning #16949

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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