Sha256: d8336c2311f8dbf94ce649448940872985e40640e5cf236f212b1cdbd6fec861

Contents?: true

Size: 1.56 KB

Versions: 12

Compression:

Stored size: 1.56 KB

Contents

module Actions
  module Katello
    module Organization
      class ManifestDelete < Actions::AbstractAsyncTask
        middleware.use Actions::Middleware::PropagateCandlepinErrors

        include Helpers::Notifications

        def plan(organization)
          action_subject(organization)

          sequence do
            plan_action(Candlepin::Owner::DestroyImports, { label: organization.label })

            repositories = ::Katello::Repository.in_default_view.in_product(::Katello::Product.redhat.in_org(organization))
            repositories.each do |repo|
              plan_action(Katello::Repository::RefreshRepository, repo)
            end
            plan_self(:organization_name => organization.name)
          end
        end

        def run
          organization = ::Organization.find_by(name: input[:organization_name])
          organization&.manifest_expiration_date(cached: false) # update organization.manifest_imported? value
        end

        def failure_notification(plan)
          ::Katello::UINotifications::Subscriptions::ManifestDeleteError.deliver!(
            :subject => subject_organization,
            :task => get_foreman_task(plan)
          )
        end

        def success_notification(_plan)
          ::Katello::UINotifications::Subscriptions::ManifestDeleteSuccess.deliver!(
            subject_organization
          )
        end

        def humanized_name
          _("Delete Manifest")
        end

        def finalize
          subject_organization.audit_manifest_action(_('Manifest deleted'))
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
katello-4.14.2 app/lib/actions/katello/organization/manifest_delete.rb
katello-4.15.0 app/lib/actions/katello/organization/manifest_delete.rb
katello-4.15.0.rc2 app/lib/actions/katello/organization/manifest_delete.rb
katello-4.15.0.rc1 app/lib/actions/katello/organization/manifest_delete.rb
katello-4.14.1 app/lib/actions/katello/organization/manifest_delete.rb
katello-4.14.0 app/lib/actions/katello/organization/manifest_delete.rb
katello-4.14.0.rc3 app/lib/actions/katello/organization/manifest_delete.rb
katello-4.14.0.rc2 app/lib/actions/katello/organization/manifest_delete.rb
katello-4.14.0.rc1.1 app/lib/actions/katello/organization/manifest_delete.rb
katello-4.14.0.rc1 app/lib/actions/katello/organization/manifest_delete.rb
katello-4.13.1 app/lib/actions/katello/organization/manifest_delete.rb
katello-4.13.0 app/lib/actions/katello/organization/manifest_delete.rb