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



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

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



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

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

#plan(opts = {}) ⇒ 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
48
# File 'app/lib/actions/katello/content_view_version/import.rb', line 5

def plan(opts = {})
   = ::Katello::Pulp3::ContentViewVersion::MetadataMap.new(metadata: opts[:metadata])

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

  import.check!

  gpg_helper = ::Katello::Pulp3::ContentViewVersion::ImportGpgKeys.
                  new(organization: opts[:organization],
                      metadata_gpg_keys: .gpg_keys)
  gpg_helper.import!

  sequence do
    plan_action(AutoCreateProducts, { import: import })
    plan_action(AutoCreateRepositories, { import: import, path: opts[:path] })
    plan_action(AutoCreateRedhatRepositories, { import: import, path: opts[: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: opts[:path],
                    metadata: opts[: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