Sha256: b8d5d619b0e21aa132c96c34f56c7994c46eb3c692acf67523e4b0459726a3ee

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

module Actions
  module Katello
    module Repository
      class CreateRoot < Actions::EntryAction
        def plan(root, relative_path = nil)
          begin
            root.save!
          rescue ActiveRecord::RecordInvalid => e
            if root.is_container_push && e.message.include?("Container Repository Name") && e.message.include?("conflicts with an existing repository")
              logger.warn("Skipping repository creation as container push repository already exists: #{root.container_push_name}")
              return
            end
            raise e
          end
          repository = ::Katello::Repository.new(:environment => root.organization.library,
                                      :content_view_version => root.organization.library.default_content_view_version,
                                      :root => root)
          repository.container_repository_name = relative_path if root.docker? && root.is_container_push
          repository.relative_path = relative_path || repository.custom_repo_path
          repository.save!

          action_subject(repository)
          plan_action(::Actions::Katello::Repository::Create, repository)
        end

        def humanized_name
          _("Create")
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
katello-4.14.2 app/lib/actions/katello/repository/create_root.rb
katello-4.14.1 app/lib/actions/katello/repository/create_root.rb