Class: AuditEntry

Inherits:
Object
  • Object
show all
Extended by:
RightScale::Api::BaseExtend
Includes:
RightScale::Api::Base
Defined in:
lib/rest_connection/rightscale/audit_entry.rb

Overview

API 1.0

Instance Attribute Summary

Attributes included from RightScale::Api::Base

#params

Instance Method Summary collapse

Methods included from RightScale::Api::BaseExtend

[], create, deny_methods, filters, find, find_all, find_by, find_by_cloud_id, find_by_id, find_by_nickname, find_by_nickname_speed, find_with_filter, resource_plural_name, resource_singular_name

Methods included from RightScale::Api::BaseConnection

#connection

Methods included from RightScale::Api::Base

#[], #[]=, #destroy, #initialize, #method_missing, #reload, #resource_plural_name, #resource_singular_name, #rs_id, #save

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class RightScale::Api::Base

Instance Method Details

#wait_for_completed(timeout = 900) ⇒ Object



59
60
61
# File 'lib/rest_connection/rightscale/audit_entry.rb', line 59

def wait_for_completed(timeout=900)
  wait_for_state("completed", timeout)
end

#wait_for_state(state, timeout = 900) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/rest_connection/rightscale/audit_entry.rb', line 45

def wait_for_state(state, timeout=900)
  while(timeout > 0)
    reload
    return true if state == self.state
    connection.logger("state is #{self.state}, waiting for #{state}")
    friendly_url = "https://my.rightscale.com/audit_entries/"
    friendly_url += self.href.split(/\//).last
    raise "FATAL error, #{self.summary}\nSee Audit: API:#{self.href}, WWW:<a href='#{friendly_url}'>#{friendly_url}</a>\n" if self.state == 'failed'
    sleep 30
    timeout -= 30
  end
  raise "FATAL: Timeout waiting for Executable to complete.  State was #{self.state}" if timeout <= 0
end