Sha256: 1039c3051b8bbb552a2033cca9cd97fb922fe8ef336eec7b7b59f82e97b72c9e
Contents?: true
Size: 877 Bytes
Versions: 158
Compression:
Stored size: 877 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 puppet 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 puppet 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
158 entries across 158 versions & 1 rubygems