Sha256: bc77e1573cda205d86087f93b6e00f8adf95a7561b6ec73c121d1dcfa33216bd

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

#
# Copyright 2014 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

module Actions
  module Katello
    module ContentViewPuppetEnvironment
      class CloneContent < Actions::Base
        def plan(puppet_environment, module_ids_by_repoid)
          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
        end

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

        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
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
katello-2.2.2 app/lib/actions/katello/content_view_puppet_environment/clone_content.rb