Sha256: 02e7bfd9c4788908be8dfc52f9f2fc131d461ab8c337b5752dc6d7d193966c17

Contents?: true

Size: 1.26 KB

Versions: 32

Compression:

Stored size: 1.26 KB

Contents

module Actions
  module Pulp3
    module ContentView
      class DeleteRepositoryReferences < Pulp3::AbstractAsyncTask
        def plan(content_view, smart_proxy)
          if content_view.repository_references.any?
            plan_self(:content_view_id => content_view.id, :smart_proxy_id => smart_proxy.id)
          end
        end

        def invoke_external_task
          tasks = []
          content_view = ::Katello::ContentView.find(input[:content_view_id])
          to_delete = content_view.repository_references.select do |repository_reference|
            repo = repository_reference.root_repository.library_instance
            if delete_href?(repository_reference.repository_href, content_view)
              tasks << repo.backend_service(smart_proxy).delete_repository(repository_reference)
              true
            else
              false
            end
          end
          to_delete.each(&:destroy)

          output[:pulp_tasks] = tasks
        end

        #migrated composites may have the same RepositoryReference as their component
        def delete_href?(href, content_view)
          ::Katello::Pulp3::RepositoryReference.where(:repository_href => href).where.not(:content_view_id => content_view.id).empty?
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
katello-4.14.0 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.14.0.rc3 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.14.0.rc2 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.14.0.rc1.1 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.14.0.rc1 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.13.1 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.13.0 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.12.1 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.13.0.rc1 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.12.0 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.12.0.rc3 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.12.0.rc2 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.12.0.rc1 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.11.1 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.11.0 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.11.0.rc2 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.11.0.rc1 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.10.0 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.9.2 app/lib/actions/pulp3/content_view/delete_repository_references.rb
katello-4.10.0.rc2 app/lib/actions/pulp3/content_view/delete_repository_references.rb