class Hive::Diagnostic::Tv::Uptime

Public Class Methods

new(config, options) click to toggle source
Calls superclass method
# File lib/hive/diagnostic/tv/uptime.rb, line 7
def initialize(config, options)
  @next_reboot_time = Time.now + config[:reboot_timeout] if config.has_key?(:reboot_timeout)
  super(config, options)
end

Public Instance Methods

diagnose() click to toggle source
# File lib/hive/diagnostic/tv/uptime.rb, line 12
def diagnose
  if config.has_key?(:reboot_timeout)
    if Time.now < @next_reboot_time
      self.pass("Time to next reboot: #{@next_reboot_time - Time.now}s")
    else
      self.fail("Reboot required")
    end
  else
    self.pass("Not configured to reboot")
  end
end
repair(result) click to toggle source
# File lib/hive/diagnostic/tv/uptime.rb, line 24
def repair(result)
  @next_reboot_time += config[:reboot_timeout]
  @device_api.power_cycle ? self.pass("Successful reboot") : self.fail("Reboot failed")
end