diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 15:09:34 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-07 15:09:34 +0300 |
commit | 903ccf7c93eb9490c76857bffe744249cc07de09 (patch) | |
tree | 603a3162e91999160e4efc74f351f9405f422d61 /app/models | |
parent | 41cb558299b483b44b45351730ee4c0e9fe4ca2c (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/container_repository.rb | 2 | ||||
-rw-r--r-- | app/models/project_services/prometheus_service.rb | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/app/models/container_repository.rb b/app/models/container_repository.rb index b74c044b687..3bff7cb06c1 100644 --- a/app/models/container_repository.rb +++ b/app/models/container_repository.rb @@ -8,6 +8,8 @@ class ContainerRepository < ApplicationRecord validates :name, length: { minimum: 0, allow_nil: false } validates :name, uniqueness: { scope: :project_id } + enum status: { delete_scheduled: 0, delete_failed: 1 } + delegate :client, to: :registry scope :ordered, -> { order(:name) } diff --git a/app/models/project_services/prometheus_service.rb b/app/models/project_services/prometheus_service.rb index fd4ee069041..17bc29ebdcf 100644 --- a/app/models/project_services/prometheus_service.rb +++ b/app/models/project_services/prometheus_service.rb @@ -13,9 +13,9 @@ class PrometheusService < MonitoringService # to allow localhost URLs when the following conditions are true: # 1. project is the self-monitoring project. # 2. api_url is the internal Prometheus URL. - with_options presence: true, if: :manual_configuration? do - validates :api_url, public_url: true, unless: proc { |object| object.allow_local_api_url? } - validates :api_url, url: true, if: proc { |object| object.allow_local_api_url? } + with_options presence: true do + validates :api_url, public_url: true, if: ->(object) { object.manual_configuration? && !object.allow_local_api_url? } + validates :api_url, url: true, if: ->(object) { object.manual_configuration? && object.allow_local_api_url? } end before_save :synchronize_service_state |