Sha256: 36b55f36be7211301dae35cae122e7f68966995a05bb3bd9a9ef8204e3caeed3

Contents?: true

Size: 1.57 KB

Versions: 114

Compression:

Stored size: 1.57 KB

Contents

module Actions
  module Katello
    module Environment
      class Destroy < Actions::EntryAction
        middleware.use ::Actions::Middleware::RemoteAction

        input_format do
          param :id
          param :name
        end

        def plan(env, options = {})
          fail env.errors.full_messages.join(" ") unless env.deletable?

          skip_repo_destroy = options.fetch(:skip_repo_destroy, false)
          organization_destroy = options.fetch(:organization_destroy, false)
          sequence do
            action_subject(env)

            concurrence do
              env.content_view_environments.each do |cve|
                plan_action(ContentView::Remove, cve.content_view, :content_view_environments => [cve], :skip_repo_destroy => skip_repo_destroy, :organization_destroy => organization_destroy)
              end
            end

            if organization_destroy
              env.hostgroups.clear
              env.hosts.clear
            end

            plan_self
          end
        end

        def humanized_name
          _("Delete Lifecycle Environment")
        end

        def humanized_input
          ["'#{input['kt_environment']['name']}'"] + super
        end

        def finalize
          environment = ::Katello::KTEnvironment.find(input['kt_environment']['id'])

          # CapsuleLifecycleEnvironment can cause issues when auditing, it will try to associate the audit to the deleted taxonomy
          ::Katello::CapsuleLifecycleEnvironment.without_auditing do
            environment.destroy!
          end
        end
      end
    end
  end
end

Version data entries

114 entries across 114 versions & 1 rubygems

Version Path
katello-4.7.6 app/lib/actions/katello/environment/destroy.rb
katello-4.7.5 app/lib/actions/katello/environment/destroy.rb
katello-4.7.4 app/lib/actions/katello/environment/destroy.rb
katello-4.7.3 app/lib/actions/katello/environment/destroy.rb
katello-4.7.2 app/lib/actions/katello/environment/destroy.rb
katello-4.7.1 app/lib/actions/katello/environment/destroy.rb
katello-4.6.2.1 app/lib/actions/katello/environment/destroy.rb
katello-4.6.2 app/lib/actions/katello/environment/destroy.rb
katello-4.7.0 app/lib/actions/katello/environment/destroy.rb
katello-4.6.1 app/lib/actions/katello/environment/destroy.rb
katello-4.7.0.rc2 app/lib/actions/katello/environment/destroy.rb
katello-4.7.0.rc1 app/lib/actions/katello/environment/destroy.rb
katello-4.4.2.2 app/lib/actions/katello/environment/destroy.rb
katello-4.4.2.1 app/lib/actions/katello/environment/destroy.rb
katello-4.4.2 app/lib/actions/katello/environment/destroy.rb
katello-4.5.1 app/lib/actions/katello/environment/destroy.rb
katello-4.6.0 app/lib/actions/katello/environment/destroy.rb
katello-4.6.0.rc2 app/lib/actions/katello/environment/destroy.rb
katello-4.6.0.rc1 app/lib/actions/katello/environment/destroy.rb
katello-4.5.0 app/lib/actions/katello/environment/destroy.rb