Sha256: 506891bc7ea0940c019536a4f739e0144c0cfea2851f54955fbafbbc26ea32c3

Contents?: true

Size: 1.38 KB

Versions: 33

Compression:

Stored size: 1.38 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 = {})
          unless env.deletable?
            fail env.errors.full_messages.join(" ")
          end
          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'])
          environment.destroy!
        end
      end
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
katello-3.5.0.rc1 app/lib/actions/katello/environment/destroy.rb
katello-3.4.5 app/lib/actions/katello/environment/destroy.rb
katello-3.4.4 app/lib/actions/katello/environment/destroy.rb
katello-3.4.2 app/lib/actions/katello/environment/destroy.rb
katello-3.4.1 app/lib/actions/katello/environment/destroy.rb
katello-3.4.0.2 app/lib/actions/katello/environment/destroy.rb
katello-3.4.0.1 app/lib/actions/katello/environment/destroy.rb
katello-3.3.2 app/lib/actions/katello/environment/destroy.rb
katello-3.4.0 app/lib/actions/katello/environment/destroy.rb
katello-3.4.0.rc2 app/lib/actions/katello/environment/destroy.rb
katello-3.4.0.rc1 app/lib/actions/katello/environment/destroy.rb
katello-3.3.1.1 app/lib/actions/katello/environment/destroy.rb
katello-3.3.1 app/lib/actions/katello/environment/destroy.rb