Class: Actions::Katello::ContentViewVersion::Import

Inherits:
EntryAction
  • Object
show all
Defined in:
app/lib/actions/katello/content_view_version/import.rb

Instance Method Summary collapse

Instance Method Details

#finalizeObject



49
50
51
52
53
# File 'app/lib/actions/katello/content_view_version/import.rb', line 49

def finalize
  if task.execution_plan.run_steps.any? { |s| s.action_class == ::Actions::Pulp3::ContentViewVersion::CreateImport && s.state != :success }
    ::Katello::EventQueue.push_event(::Katello::Events::DeleteLatestContentViewVersion::EVENT_TYPE, input[:content_view_id])
  end
end

#humanized_nameObject



55
56
57
# File 'app/lib/actions/katello/content_view_version/import.rb', line 55

def humanized_name
  _("Import Content View Version")
end

#plan(organization:, path:, metadata:) ⇒ Object



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:)
   = ::Katello::Pulp3::ContentViewVersion::MetadataMap.new(metadata: )

  import = ::Katello::Pulp3::ContentViewVersion::Import.new(
    organization: organization,
    metadata_map: ,
    path: path,
    smart_proxy: SmartProxy.pulp_primary!
  )

  import.check!

  gpg_helper = ::Katello::Pulp3::ContentViewVersion::ImportGpgKeys.
                  new(organization: organization,
                      metadata_gpg_keys: .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 .syncable_format?
      plan_action(::Actions::BulkAction,
            ::Actions::Katello::Repository::Sync,
            import..exportable(format: .format),
            skip_candlepin_check: true
            )
    end

    if import.content_view
      plan_action(, import: import)
      plan_action(::Actions::Katello::ContentView::Publish, import.content_view, .content_view_version.description,
                    path: path,
                    metadata: ,
                    importing: !.syncable_format?,
                    syncable: .syncable_format?,
                    major: .content_view_version.major,
                    minor: .content_view_version.minor)
      plan_self(content_view_id: import.content_view.id)
    end
  end
end