Class: Actions::Katello::ContentViewPuppetEnvironment::CloneContent

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

Instance Method Summary collapse

Instance Method Details

#clauses(module_ids) ⇒ Object



19
20
21
# File 'app/lib/actions/katello/content_view_puppet_environment/clone_content.rb', line 19

def clauses(module_ids)
  { 'unit_id' => { "$in" => module_ids } }
end

#plan(puppet_environment, module_ids_by_repoid) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/lib/actions/katello/content_view_puppet_environment/clone_content.rb', line 5

def plan(puppet_environment, module_ids_by_repoid)
  sequence do
    concurrence do
      module_ids_by_repoid.each_pair do |repo_id, module_ids|
        source_repo = ::Katello::ContentViewPuppetEnvironment.where(:pulp_id => repo_id).first ||
          ::Katello::Repository.where(:pulp_id => repo_id).first
        plan_copy(Pulp::Repository::CopyPuppetModule, source_repo, puppet_environment, clauses(module_ids))
      end
    end

    plan_action(Pulp::ContentViewPuppetEnvironment::IndexContent, id: puppet_environment.id)
  end
end

#plan_copy(action_class, source_repo, target_repo, clauses = nil) ⇒ Object



23
24
25
26
27
28
# File 'app/lib/actions/katello/content_view_puppet_environment/clone_content.rb', line 23

def plan_copy(action_class, source_repo, target_repo, clauses = nil)
  plan_action(action_class,
              source_pulp_id: source_repo.pulp_id,
              target_pulp_id: target_repo.pulp_id,
              clauses:        clauses)
end