class Task

API 1.5

Public Class Methods

parse_args(cloud_id, instance_id) click to toggle source
# File lib/rest_connection/rightscale/task.rb, line 33
def self.parse_args(cloud_id, instance_id)
  "clouds/#{cloud_id}/instances/#{instance_id}/live/"
end

Public Instance Methods

show() click to toggle source
# File lib/rest_connection/rightscale/task.rb, line 37
def show
  url = URI.parse(self.href)
  @params.merge! connection.get(url.path)#, 'view' => "extended")
end
wait_for_completed(timeout=900) click to toggle source
# File lib/rest_connection/rightscale/task.rb, line 54
def wait_for_completed(timeout=900)
  wait_for_state("completed", timeout)
end
wait_for_state(state, timeout=900) click to toggle source
# File lib/rest_connection/rightscale/task.rb, line 42
def wait_for_state(state, timeout=900)
  while(timeout > 0)
    show
    return true if self.summary.include?(state)
    connection.logger("state is #{self.summary}, waiting for #{state}")
    raise "FATAL error:\n\n #{self.summary} \n\n" if self.summary.include?('failed') # TODO #{self.detail}
    sleep 30
    timeout -= 30
  end
  raise "FATAL: Timeout waiting for Executable to complete.  State was #{self.summary}" if timeout <= 0
end