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
|
# File 'app/lib/actions/pulp3/orchestration/repository/import_upload.rb', line 7
def plan(repository, smart_proxy, args)
file = {:filename => args.dig(:unit_key, :name), :sha256 => args.dig(:unit_key, :checksum) }
content_unit_href = args.dig(:unit_key, :content_unit_id)
docker_tag = (args.dig(:unit_type_id) == "docker_tag")
sequence do
if docker_tag
tag_manifest_output = plan_action(Pulp3::Repository::UploadTag,
repository,
smart_proxy,
args).output
plan_self(:commit_output => tag_manifest_output[:pulp_tasks])
plan_action(Pulp3::Repository::SaveVersion, repository, {force_fetch_version: true, tasks: tag_manifest_output[:pulp_tasks]})
else
if content_unit_href
artifact_output = { :content_unit_href => content_unit_href }
commit_output = {}
else
commit_output = plan_action(Pulp3::Repository::CommitUpload,
repository,
smart_proxy,
"/pulp/api/v3/uploads/" + args.dig(:upload_id) + "/",
args.dig(:unit_key, :checksum)).output
artifact_output = plan_action(Pulp3::Repository::SaveArtifact,
file,
repository,
smart_proxy,
commit_output[:pulp_tasks],
args.dig(:unit_type_id), args).output
end
plan_self(:commit_output => commit_output[:pulp_tasks], :artifact_output => artifact_output)
import_output = plan_action(Pulp3::Repository::ImportUpload, artifact_output, repository, smart_proxy).output
plan_action(Pulp3::Repository::SaveVersion, repository, tasks: import_output[:pulp_tasks])
end
end
end
|