Class: Actions::Katello::Repository::IncrementalImport

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

Instance Method Summary collapse

Instance Method Details

#plan(repo, import_location) ⇒ Object

Parameters:

  • repo
  • import_location

    location of files to import



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/lib/actions/katello/repository/incremental_import.rb', line 13

def plan(repo, import_location)
  action_subject(repo)

  rpm_files = Dir.glob(File.join(import_location, "*rpm"))

  rpm_filepaths = rpm_files.collect do |filepath|
    {path: filepath, filename: File.basename(filepath)}
  end

  json_files = Dir.glob(File.join(import_location, "*json"))
  pulp_units = json_files.map { |json_file| JSON.parse(File.read(json_file)) }
  errata = pulp_units.select { |pulp_unit| erratum? pulp_unit }

  sequence do
    # NB: UploadFiles may time out during plan phase, it copies
    # everything to /tmp. It is better to just have Pulp generate
    # incrementals in the same way it publishes normally, vs optimizing
    # this call. https://pulp.plan.io/issues/1543
    plan_action(Katello::Repository::UploadFiles, repo, rpm_filepaths)
    plan_action(Katello::Repository::UploadErrata, repo, errata)
  end

  plan_self
end

#rescue_strategyObject



44
45
46
# File 'app/lib/actions/katello/repository/incremental_import.rb', line 44

def rescue_strategy
  Dynflow::Action::Rescue::Skip
end

#runObject



38
39
40
41
42
# File 'app/lib/actions/katello/repository/incremental_import.rb', line 38

def run
  # Assume contents changed. This type of upload does not need the same
  # level of optimization as sync because it is not called frequently.
  output[:contents_changed] = true
end