Sha256: adc7a8801e67e4e14705b8a83e5e5f4698e036cb6614e838a7d9474d24ccb815

Contents?: true

Size: 1.29 KB

Versions: 83

Compression:

Stored size: 1.29 KB

Contents

module Actions
  module Katello
    module Repository
      # Clones the contnet of the repository into the environment
      # effectively promotion the repository to the environment
      class CloneToEnvironment < Actions::Base
        def plan(repository, environment)
          clone = find_or_build_environment_clone(repository, environment)

          sequence do
            if clone.new_record?
              plan_action(Repository::Create, clone, clone: true)
            end

            plan_action(::Actions::Katello::Repository::CloneContents, [repository], clone, :copy_contents => !clone.yum?)
          end
        end

        # The environment clone clone of the repository is the one
        # visible for the systems in the environment
        def find_or_build_environment_clone(repository, environment)
          version = repository.content_view_version
          clone = version.content_view.get_repo_clone(environment, repository).first

          if clone
            clone = ::Katello::Repository.find(clone.id) # reload readonly object
            clone.update!(content_view_version_id: version.id)
          else
            clone = repository.build_clone(environment: environment, content_view: version.content_view)
          end
          return clone
        end
      end
    end
  end
end

Version data entries

83 entries across 83 versions & 1 rubygems

Version Path
katello-4.16.0 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.15.1 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.16.0.rc2 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.16.0.rc1 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.14.3 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.14.2 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.15.0 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.15.0.rc2 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.15.0.rc1 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.14.1 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.14.0 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.14.0.rc3 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.14.0.rc2 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.14.0.rc1.1 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.14.0.rc1 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.13.1 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.13.0 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.12.1 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.13.0.rc1 app/lib/actions/katello/repository/clone_to_environment.rb
katello-4.12.0 app/lib/actions/katello/repository/clone_to_environment.rb