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



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

def finalize
  version = ::Katello::ContentViewVersion.find_by(id: input[:id])
  version&.destroy!
  ::Katello::DockerMetaTag.cleanup_tags if input[:docker_cleanup]
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
# File 'app/lib/actions/katello/content_view_version/destroy.rb', line 5

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

  destroy_env_content = !options.fetch(:skip_destroy_env_content, false)
  repos = destroy_env_content ? version.repositories : version.archived_repos
  docker_cleanup = false

  sequence do
    concurrence do
      repos.each do |repo|
        repo_options = options.clone
        repo_options[:docker_cleanup] = false
        plan_action(Repository::Destroy, repo, repo_options)
        docker_cleanup ||= repo.docker?
      end
    end
  end

  plan_self(:id => version.id, :docker_cleanup => docker_cleanup)
end