Sha256: 0869d8c0b228ca29fcec83ed9a9143abaf8a01d6467c0dd8e137147ebb6f79bd
Contents?: true
Size: 863 Bytes
Versions: 11
Compression:
Stored size: 863 Bytes
Contents
module Actions module Foreman module Environment class Destroy < Actions::Base def plan(environment) if environment.hosts.count > 0 names = environment.hosts.limit(5).pluck(:name).join(', ') fail _("The environment %{name} is in use by %{count} Host(s) including %{names}") % {:name => environment.name, :names => names, :count => environment.hosts.count} end if environment.hostgroups.count > 0 names = environment.hostgroups.limit(5).pluck(:name).join(', ') fail _("The environment %{name} is in use by %{count} Host Group(s) including %{names}") % {:name => environment.name, :names => names, :count => environment.hostgroups.count} end environment.destroy! end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems