Class: Actions::Katello::ContentViewVersion::Destroy

Inherits:
Base
  • Object
show all
Defined in:
app/lib/actions/katello/content_view_version/destroy.rb

Instance Method Summary collapse

Instance Method Details

#finalizeObject



28
29
30
31
# File 'app/lib/actions/katello/content_view_version/destroy.rb', line 28

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

#plan(version, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'app/lib/actions/katello/content_view_version/destroy.rb', line 5

def plan(version, options = {})
  version.validate_destroyable!(options[:skip_environment_check])

  destroy_env_content = !options.fetch(:skip_destroy_env_content, false)
  repos = destroy_env_content ? version.repositories : version.archived_repos
  puppet_envs = destroy_env_content ? version.content_view_puppet_environments : [version.archive_puppet_environment]

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

  plan_self(:id => version.id)
end