Class: Actions::Katello::Repository::MultiCloneContents

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

Instance Method Summary collapse

Methods included from CheckMatchingContent

#check_matching_content

Instance Method Details

#finalizeObject



52
53
54
55
56
# File 'app/lib/actions/katello/repository/multi_clone_contents.rb', line 52

def finalize
  repository = ::Katello::Repository.find(input[:target_repo_id])
  source_checksum_type = input[:source_checksum_type]
  repository.update!(saved_checksum_type: source_checksum_type) if (repository && source_checksum_type)
end

#metadata_generate(source_repositories, new_repository, filters, matching_content) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/lib/actions/katello/repository/multi_clone_contents.rb', line 36

def (source_repositories, new_repository, filters, matching_content)
   = {}

  [:matching_content] = matching_content

  if source_repositories.count == 1 && filters.empty?
    [:source_repository] = source_repositories.first
  end

  plan_action(Katello::Repository::MetadataGenerate, new_repository, )
  unless source_repositories.first.saved_checksum_type == new_repository.saved_checksum_type
    plan_self(:source_checksum_type => source_repositories.first.saved_checksum_type,
              :target_repo_id => new_repository.id)
  end
end

#plan(extended_repo_mapping, options) ⇒ Object



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
# File 'app/lib/actions/katello/repository/multi_clone_contents.rb', line 7

def plan(extended_repo_mapping, options)
   = options.fetch(:generate_metadata, true)
  copy_contents = options.fetch(:copy_contents, true)
  solve_dependencies = options.fetch(:solve_dependencies, false)

  sequence do
    if copy_contents
      plan_action(Pulp3::Orchestration::Repository::MultiCopyAllUnits,
                  extended_repo_mapping,
                  SmartProxy.pulp_primary,
                  solve_dependencies: solve_dependencies)
    end

    concurrence do
      extended_repo_mapping.each do |source_repos, dest_repo_map|
        dest_repo_map[:matching_content] = check_matching_content(dest_repo_map[:dest_repo], source_repos)

        if 
          (source_repos, dest_repo_map[:dest_repo], dest_repo_map[:filters], dest_repo_map[:matching_content])
        end
      end

      extended_repo_mapping.values.each do |dest_repo_map|
        plan_action(Katello::Repository::IndexContent, id: dest_repo_map[:dest_repo].id)
      end
    end
  end
end