5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'app/lib/actions/katello/repository/create_container_push_root.rb', line 5
def plan(root, relative_path = nil)
repository = ::Katello::Repository.new(:environment => root.organization.library, :content_view_version => root.organization.library.default_content_view_version, :root => root)
root.product.with_lock do
begin
root.save!
rescue ActiveRecord::RecordInvalid => e
if root.is_container_push && e.message.include?("Name has already been taken for this product")
Rails.logger.debug("Skipping root repository creation as container push root repository already exists: #{root.container_push_name}")
return
end
raise e
end
repository.container_repository_name = relative_path if root.docker? && root.is_container_push
repository.relative_path = relative_path || repository.custom_repo_path
begin
repository.save!
rescue ActiveRecord::RecordInvalid => e
if root.is_container_push && e.message.include?("Container Repository Name") && e.message.include?("conflicts with an existing repository")
Rails.logger.debug("Skipping repository creation as container push repository already exists: #{root.container_push_name}")
return
end
raise e
end
end
action_subject(repository)
plan_action(::Actions::Katello::Repository::Create, repository)
end
|