Sha256: aaa1ac5cc1c5dd4bad103899235b293475e4bb705f876daeb4cfe68e6f6015ad

Contents?: true

Size: 1.44 KB

Versions: 1

Compression:

Stored size: 1.44 KB

Contents

#
# Copyright 2014 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

module Actions
  module Katello
    module ContentViewVersion
      class Destroy < Actions::Base
        def plan(version, options = {})
          version.check_ready_to_destroy! unless options[:skip_environment_check]

          sequence do
            concurrence do
              version.repositories.each do |repo|
                repo_options = options.clone
                repo_options[:planned_destroy] = true
                plan_action(Repository::Destroy, repo, repo_options)
              end
              version.content_view_puppet_environments.each do |cvpe|
                plan_action(ContentViewPuppetEnvironment::Destroy, cvpe) unless version.default?
              end
            end
          end

          plan_self(:id => version.id)
        end

        def finalize
          version = ::Katello::ContentViewVersion.find(input[:id])
          version.destroy!
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
katello-2.2.2 app/lib/actions/katello/content_view_version/destroy.rb