Skip to content

Commit

Permalink
Fixes #25558 - better error on cv publish repo conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
jlsherrill committed Nov 27, 2018
1 parent d83615f commit 095a037
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/models/katello/repository.rb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ class Repository < Katello::Model

validates_with Validators::ContainerImageNameValidator, :attributes => :container_repository_name, :allow_blank => false, :if => :docker?
validates :pulp_id, :presence => true, :uniqueness => true, :if => proc { |r| r.name.present? }
validates :container_repository_name, :uniqueness => true, :if => :docker?
validates :container_repository_name, :if => :docker?, :uniqueness => {message: ->(object, _data) do
_("for repository '%{name}' is not unique and cannot be created in '%{env}'. Its Container Repository Name (%{container_name}) conflicts with an existing repository. Consider changing the Lifecycle Environment's Registry Name Pattern to something more specific.") %
{name: object.name, container_name: object.container_repository_name, :env => object.environment.name}
end}

before_validation :set_pulp_id
before_validation :set_container_repository_name, :if => :docker?
Expand Down

0 comments on commit 095a037

Please sign in to comment.