Sha256: b4b4935a36c59dc304ed93743262788a00cdb46a45dab52ab778008917fd0061

Contents?: true

Size: 1.94 KB

Versions: 77

Compression:

Stored size: 1.94 KB

Contents

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

        include Helpers::Notifications

        def plan(organization, path, force)
          action_subject organization
          manifest_update = organization.products.redhat.any?

          sequence do
            plan_action(Candlepin::Owner::Import,
                        :label => organization.label,
                        :path => path,
                        :force => force)
            plan_action(Candlepin::Owner::ImportProducts, :organization_id => organization.id)

            if manifest_update
              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
            end
            plan_self(:organization_name => organization.name)
          end
        end

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

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

        def humanized_name
          _("Import Manifest")
        end

        # results in correct grammar on Tasks page,
        # e.g. "Import manifest for organization Default Organization"
        def humanized_input
          "for organization '#{input[:organization_name]}'"
        end

        def finalize
          subject_organization.clear_manifest_expired_notifications
          subject_organization.audit_manifest_action(_('Manifest imported'))
        end
      end
    end
  end
end

Version data entries

77 entries across 77 versions & 1 rubygems

Version Path
katello-4.12.1 app/lib/actions/katello/organization/manifest_import.rb
katello-4.12.0 app/lib/actions/katello/organization/manifest_import.rb
katello-4.12.0.rc3 app/lib/actions/katello/organization/manifest_import.rb
katello-4.12.0.rc2 app/lib/actions/katello/organization/manifest_import.rb
katello-4.12.0.rc1 app/lib/actions/katello/organization/manifest_import.rb
katello-4.11.1 app/lib/actions/katello/organization/manifest_import.rb
katello-4.11.0 app/lib/actions/katello/organization/manifest_import.rb
katello-4.11.0.rc2 app/lib/actions/katello/organization/manifest_import.rb
katello-4.11.0.rc1 app/lib/actions/katello/organization/manifest_import.rb
katello-4.10.0 app/lib/actions/katello/organization/manifest_import.rb
katello-4.9.2 app/lib/actions/katello/organization/manifest_import.rb
katello-4.10.0.rc2 app/lib/actions/katello/organization/manifest_import.rb
katello-4.10.0.rc1 app/lib/actions/katello/organization/manifest_import.rb
katello-4.8.4 app/lib/actions/katello/organization/manifest_import.rb
katello-4.9.1 app/lib/actions/katello/organization/manifest_import.rb
katello-4.8.3 app/lib/actions/katello/organization/manifest_import.rb
katello-4.9.0 app/lib/actions/katello/organization/manifest_import.rb
katello-4.7.6 app/lib/actions/katello/organization/manifest_import.rb
katello-4.8.2 app/lib/actions/katello/organization/manifest_import.rb
katello-4.9.0.rc2 app/lib/actions/katello/organization/manifest_import.rb