Bug #14275 » chef-patch.patch
app/lib/actions/foreman_chef/host/destroy.rb | ||
---|---|---|
module Host
|
||
class Destroy < Actions::EntryAction
|
||
def plan(host)
|
||
def plan(host, *_)
|
||
action_subject(host)
|
||
if (::Setting::ForemanChef.auto_deletion && proxy = ::SmartProxy.find_by_id(host.chef_proxy_id))
|
||
node_exists_in_chef = proxy.show_node(host.name)
|
||
... | ... | |
hammer host delete --id '#{task_input[:host][:id]}'
|
||
EXAMPLE
|
||
end
|
||
|
||
def self.subscribe
|
||
if defined? Actions::Katello::System::HostDestroy
|
||
Actions::Katello::System::HostDestroy
|
||
elsif defined? Actions::Katello::Host::Destroy
|
||
Actions::Katello::Host::Destroy
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
app/models/foreman_chef/concerns/host_action_subject.rb | ||
---|---|---|
module ForemanChef
|
||
module Concerns
|
||
module HostActionSubject
|
||
extend ActiveSupport::Concern
|
||
include ForemanTasks::Concerns::ActionSubject
|
||
include ForemanTasks::Concerns::ActionTriggering
|
||
def destroy_action
|
||
sync_action!
|
||
::Actions::ForemanChef::Host::Destroy
|
||
end
|
||
def action_input_key
|
||
"host"
|
||
end
|
||
end
|
||
end
|
||
end
|
||
class ::Host::Managed::Jail < Safemode::Jail
|
||
allow :chef_proxy
|
||
end
|
||
# module ForemanChef
|
||
# module Concerns
|
||
# module HostActionSubject
|
||
# extend ActiveSupport::Concern
|
||
# include ForemanTasks::Concerns::ActionSubject
|
||
# include ForemanTasks::Concerns::ActionTriggering
|
||
#
|
||
# def destroy_action
|
||
# sync_action!
|
||
# ::Actions::ForemanChef::Host::Destroy
|
||
# end
|
||
#
|
||
# def action_input_key
|
||
# "host"
|
||
# end
|
||
#
|
||
# end
|
||
# end
|
||
# end
|
lib/foreman_chef/engine.rb | ||
---|---|---|
::SmartProxy.send :include, SmartProxyExtensions
|
||
::FactImporter.register_fact_importer(:foreman_chef, ForemanChef::FactImporter)
|
||
::FactParser.register_fact_parser(:foreman_chef, ForemanChef::FactParser)
|
||
::Host::Base.send :include, ForemanChef::Concerns::HostActionSubject
|
||
class ::Host::Managed::Jail < Safemode::Jail
|
||
allow :chef_proxy
|
||
end
|
||
::HostsController.send :include, ForemanChef::Concerns::HostsControllerRescuer
|
||
# Renderer Concern needs to be injected to controllers, ForemanRenderer was already included
|
||
(TemplatesController.descendants + [TemplatesController]).each do |klass|
|
||
klass.send(:include, ForemanChef::Concerns::Renderer)
|
||
end
|
||
end
|
||
config.after_initialize do
|
- « Previous
- 1
- 2
- 3
- 4
- Next »