summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-03-27 10:28:04 +0100
committerTiago Botelho <tiagonbotelho@hotmail.com>2018-03-27 16:13:42 +0100
commitbf4a3af06ac4cb7f321267bf395022420e0c14a2 (patch)
tree793fecb88f34aa8d56f0c7677b4bff5ff697bbfb /app
parentc628f8f42651a74462eddd71ab53bd1784f9a8bf (diff)
downloadgitlab-ce-bf4a3af06ac4cb7f321267bf395022420e0c14a2.tar.gz
Project creation does not fail silently on DB related changes
Diffstat (limited to 'app')
-rw-r--r--app/services/projects/create_service.rb19
1 files changed, 11 insertions, 8 deletions
diff --git a/app/services/projects/create_service.rb b/app/services/projects/create_service.rb
index 7fa1387084c..ac0b5515d55 100644
--- a/app/services/projects/create_service.rb
+++ b/app/services/projects/create_service.rb
@@ -90,9 +90,6 @@ module Projects
unless @project.gitlab_project_import?
@project.write_repository_config
@project.create_wiki unless skip_wiki?
- create_services_from_active_templates(@project)
-
- @project.create_labels
end
event_service.create_project(@project, current_user)
@@ -121,21 +118,27 @@ module Projects
Project.transaction do
@project.create_or_update_import_data(data: import_data[:data], credentials: import_data[:credentials]) if import_data
- if @project.save && !@project.import?
- raise 'Failed to create repository' unless @project.create_repository
+ if @project.save
+ unless @project.gitlab_project_import?
+ create_services_from_active_templates(@project)
+ @project.create_labels
+ end
+
+ unless @project.import?
+ raise 'Failed to create repository' unless @project.create_repository
+ end
end
end
end
def fail(error:)
message = "Unable to save project. Error: #{error}"
- message << "Project ID: #{@project.id}" if @project && @project.id
Rails.logger.error(message)
- if @project && @project.import?
+ if @project
@project.errors.add(:base, message)
- @project.mark_import_as_failed(message)
+ @project.mark_import_as_failed(message) if @project.import?
end
@project