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
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/lib/actions/katello/repository/create.rb', line 6
def plan(repository, args = {})
clone = args[:clone] || false
force_repo_create = args[:force_repo_create] || false
repository.save!
root = repository.root
action_subject(repository)
org = repository.organization
sequence do
create_action = plan_action(Pulp3::Orchestration::Repository::Create,
repository, SmartProxy.pulp_primary, force_repo_create)
return if create_action.error
unless clone
view_env = org.default_content_view.content_view_environment(org.library)
if repository.product.redhat?
plan_action(Actions::Candlepin::Environment::AddContentToEnvironment, :view_env_cp_id => view_env.cp_id, :content_id => repository.content_id)
else
unless root.content
content_create = plan_action(Katello::Product::ContentCreate, root)
plan_action(Actions::Candlepin::Environment::AddContentToEnvironment, :view_env_cp_id => view_env.cp_id, :content_id => content_create.input[:content_id])
end
end
end
concurrence do
plan_self(:repository_id => repository.id, :clone => clone)
if !clone && repository.url.present?
repository.product.alternate_content_sources.with_type(repository.content_type).each do |acs|
acs.smart_proxies.each do |smart_proxy|
smart_proxy_acs = ::Katello::SmartProxyAlternateContentSource.create(alternate_content_source_id: acs.id, smart_proxy_id: smart_proxy.id, repository_id: repository.id)
plan_action(Pulp3::Orchestration::AlternateContentSource::Create, smart_proxy_acs)
end
end
end
end
end
end
|