Module: ForemanChef::Concerns::HostBuild
- Defined in:
- app/models/foreman_chef/concerns/host_build.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.prepended(base) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/models/foreman_chef/concerns/host_build.rb', line 4 def self.prepended(base) base.send :prepend, ForemanTasks::Concerns::ActionSubject base.send :prepend, ForemanTasks::Concerns::ActionTriggering base.after_build do |host| ::ForemanTasks.sync_task ::Actions::ForemanChef::Client::Destroy, host.name, host.chef_proxy # private key is no longer valid host.chef_private_key = nil if !::Setting[:validation_bootstrap_method] new_client = ::ForemanTasks.sync_task ::Actions::ForemanChef::Client::Create, host.name, host.chef_proxy host.chef_private_key = new_client.output[:private_key] end host.disable_dynflow_hooks { |h| h.save! } end end |
Instance Method Details
#setSSHProvisionScript ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/models/foreman_chef/concerns/host_build.rb', line 22 def setSSHProvisionScript ::ForemanTasks.sync_task ::Actions::ForemanChef::Client::Destroy, self.name, self.chef_proxy # private key is no longer valid self.chef_private_key = nil if !::Setting[:validation_bootstrap_method] new_client = ::ForemanTasks.sync_task ::Actions::ForemanChef::Client::Create, self.name, self.chef_proxy self.chef_private_key = new_client.output[:private_key] end self.disable_dynflow_hooks { |h| super; h.save! } end |