diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-01 03:08:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-01 03:08:09 +0300 |
commit | 396ad86100541bed6bc9960541a7dcddfaddd6de (patch) | |
tree | 65f131996352948dbeb09d7ccd56107561c08fe3 /app/models/project.rb | |
parent | abae8f34f377519946a91101ef7abf504454531c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 5aec64da4cf..03b247f213b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1238,14 +1238,12 @@ class Project < ApplicationRecord update_column(:has_external_wiki, services.external_wikis.any?) if Gitlab::Database.read_write? end - def find_or_initialize_services(exceptions: []) - available_services_names = Service.available_services_names - exceptions + def find_or_initialize_services + available_services_names = Service.available_services_names - disabled_services - available_services = available_services_names.map do |service_name| + available_services_names.map do |service_name| find_or_initialize_service(service_name) end - - available_services.compact end def disabled_services @@ -1258,13 +1256,11 @@ class Project < ApplicationRecord service = find_service(services, name) return service if service - # We should check if template for the service exists template = find_service(services_templates, name) if template Service.build_from_template(id, template) else - # If no template, we should create an instance. Ex `build_gitlab_ci_service` public_send("build_#{name}_service") # rubocop:disable GitlabSecurity/PublicSend end end @@ -1278,10 +1274,6 @@ class Project < ApplicationRecord end # rubocop: enable CodeReuse/ServiceClass - def find_service(list, name) - list.find { |service| service.to_param == name } - end - def ci_services services.where(category: :ci) end @@ -2422,6 +2414,10 @@ class Project < ApplicationRecord private + def find_service(services, name) + services.find { |service| service.to_param == name } + end + def closest_namespace_setting(name) namespace.closest_setting(name) end |