Sha256: 480235df547e858f82d2732087666860c296acc050f494ba3dbc548f523ab0c9
Contents?: true
Size: 1.04 KB
Versions: 9
Compression:
Stored size: 1.04 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 %s") % 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://#{old.try(:ip) || 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: %s") % e.message 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
9 entries across 9 versions & 1 rubygems