Sha256: 65e03ec26d3a1ff02ce764f031a6f24bc858c1e2c7d933431f2ba5589539a826

Contents?: true

Size: 1.37 KB

Versions: 64

Compression:

Stored size: 1.37 KB

Contents

module Actions
  module Katello
    module ContentViewEnvironment
      class Destroy < Actions::Base
        def plan(cv_env, options = {})
          skip_repo_destroy = options.fetch(:skip_repo_destroy, false)
          organization_destroy = options.fetch(:organization_destroy, false)
          content_view = cv_env.content_view
          environment = cv_env.environment
          content_view.check_remove_from_environment!(environment) unless organization_destroy

          sequence do
            concurrence do
              unless skip_repo_destroy
                content_view.repos(environment).each do |repo|
                  # no need to update the content view environment since it's
                  # getting destroyed so skip_environment_update
                  plan_action(Repository::Destroy, repo, skip_environment_update: true)
                end
              end
            end
            plan_action(Candlepin::Environment::Destroy, cp_id: cv_env.cp_id) unless organization_destroy
            plan_self(:id => cv_env.id)
          end
        end

        def finalize
          cv_env = ::Katello::ContentViewEnvironment.find_by(:id => input[:id])
          if cv_env.nil?
            output[:response] = "Content view with ID #{input[:id]} is (probably) already deleted"
          else
            cv_env.destroy!
          end
        end
      end
    end
  end
end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
katello-4.8.4 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.9.1 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.8.3 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.9.0 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.7.6 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.8.2 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.9.0.rc2 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.9.0.rc1 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.8.1 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.7.5 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.8.0 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.8.0.rc2 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.7.4 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.8.0.rc1 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.7.3 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.7.2 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.7.1 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.6.2.1 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.6.2 app/lib/actions/katello/content_view_environment/destroy.rb
katello-4.7.0 app/lib/actions/katello/content_view_environment/destroy.rb