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
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/lib/actions/katello/content_view_version/import.rb', line 5
def plan(organization:, path:, metadata:)
metadata_map = ::Katello::Pulp3::ContentViewVersion::MetadataMap.new(metadata: metadata)
import = ::Katello::Pulp3::ContentViewVersion::Import.new(
organization: organization,
metadata_map: metadata_map,
path: path,
smart_proxy: SmartProxy.pulp_primary!
)
import.check!
gpg_helper = ::Katello::Pulp3::ContentViewVersion::ImportGpgKeys.
new(organization: organization,
metadata_gpg_keys: metadata_map.gpg_keys)
gpg_helper.import!
sequence do
plan_action(AutoCreateProducts, import: import)
plan_action(AutoCreateRepositories, import: import, path: path)
plan_action(AutoCreateRedhatRepositories, import: import, path: path)
if metadata_map.syncable_format?
plan_action(::Actions::BulkAction,
::Actions::Katello::Repository::Sync,
import.intersecting_repos_library_and_metadata.exportable(format: metadata_map.format),
skip_candlepin_check: true
)
end
if import.content_view
plan_action(ResetContentViewRepositoriesFromMetadata, import: import)
plan_action(::Actions::Katello::ContentView::Publish, import.content_view, metadata_map.content_view_version.description,
path: path,
metadata: metadata,
importing: !metadata_map.syncable_format?,
syncable: metadata_map.syncable_format?,
major: metadata_map.content_view_version.major,
minor: metadata_map.content_view_version.minor)
plan_self(content_view_id: import.content_view.id)
end
end
end
|