Commit 93176e9f authored by Imre Farkas's avatar Imre Farkas

Merge branch 'sh-fix-create-projects-with-prometheus-service' into 'master'

Fix errors creating project with active Prometheus service template

Closes #212419

See merge request gitlab-org/gitlab!30340
parents e934aee7 d615759b
......@@ -173,6 +173,10 @@ module Projects
def create_prometheus_service
service = @project.find_or_initialize_service(::PrometheusService.to_param)
# If the service has already been inserted in the database, that
# means it came from a template, and there's nothing more to do.
return if service.persisted?
if service.prometheus_available?
service.save!
else
......
---
title: Fix errors creating project with active Prometheus service template
merge_request: 30340
author:
type: fixed
......@@ -348,6 +348,7 @@ describe Projects::CreateService, '#execute' do
project = create_project(user, opts)
expect(project.services.count).to eq 1
expect(project.errors).to be_empty
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment