Class: Actions::Katello::Repository::FinishUpload

Inherits:
Base
  • Object
show all
Defined in:
app/lib/actions/katello/repository/finish_upload.rb

Instance Method Summary collapse

Instance Method Details

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

def plan(repository, options = {})
  import_upload_task = options.fetch(:import_upload_task, nil)
  upload_actions = options.fetch(:upload_actions, nil)
  content_type = options.fetch(:content_type)
  if content_type
    unit_type_id = SmartProxy.pulp_primary.content_service(content_type)::CONTENT_TYPE
  else
    content_type = repository.content_type
    unit_type_id = SmartProxy.pulp_primary.content_service(content_type)::CONTENT_TYPE
  end
   = options.fetch(:generate_metadata, true)
  plan_action(Katello::Repository::MetadataGenerate, repository, :dependency => import_upload_task, :force_publication => true) if 

  if repository.deb? && 
    plan_action(::Actions::Candlepin::Product::ContentUpdate,
                owner:           repository.organization.label,
                repository_id:   repository.id,
                name:            repository.root.name,
                type:            repository.root.content_type,
                arches:          repository.root.format_arches,
                label:           repository.root.,
                content_url:     repository.root.custom_content_path,
                gpg_key_url:     repository.yum_gpg_key_url,
                metadata_expire: repository.root.)
  end

  recent_range = 5.minutes.ago.utc.iso8601
  plan_action(Katello::Repository::FilteredIndexContent,
              id: repository.id,
              filter: {:association => {:created => {"$gt" => recent_range}}},
              content_type: unit_type_id,
              import_upload_task: import_upload_task,
              upload_actions: upload_actions)
end