Sha256: 8a6b8da5228d15561a845decf19736c6a90d226d1ad89abcae941e7116c7d83b
Contents?: true
Size: 1.02 KB
Versions: 2
Compression:
Stored size: 1.02 KB
Contents
module Host::ManagedExtensions extend ActiveSupport::Concern included do # execute standard callbacks after_validation :queue_reboot end def queue_reboot return if new_record? # Discovered Hosts already exist, and new_records will break `find` return unless type_changed? and ::Host::Base.find(self.id).type == "Host::Discovered" post_queue.create(:name => "Rebooting #{self}", :priority => 10000, :action => [self, :setReboot]) end def setReboot logger.info "ForemanDiscovery: Rebooting #{name} as its being discovered and assigned" if ::ProxyAPI::BMC.new(:url => "http://#{ip}:8443").power :action => "cycle" logger.info "ForemanDiscovery: reboot result: successful" else logger.info "ForemanDiscovery: reboot result: failed" end rescue => e failure "Failed to reboot: #{proxy_error e}" end def delReboot # nothing to do here, in reality we should never hit this method since this should be the # last action in the queue. end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
foreman_discovery-1.0.0.rc2 | app/models/host/managed_extensions.rb |
foreman_discovery-1.0.0.rc1 | app/models/host/managed_extensions.rb |