Class: Task
- Inherits:
-
Object
- Object
- Task
- Extended by:
- RightScale::Api::GatewayExtend
- Includes:
- RightScale::Api::Gateway
- Defined in:
- lib/rest_connection/rightscale/task.rb
Overview
API 1.5
Instance Attribute Summary
Attributes included from RightScale::Api::Base
Class Method Summary collapse
Instance Method Summary collapse
- #show ⇒ Object
- #wait_for_completed(timeout = 900) ⇒ Object
- #wait_for_state(state, timeout = 900) ⇒ Object
Methods included from RightScale::Api::GatewayExtend
create, filters, find, find_all, find_by, find_with_filter, load, load_all, parse_args, resource_post_name
Methods included from RightScale::Api::GatewayConnection
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
Methods included from RightScale::Api::Gateway
#[], #[]=, #actions, #hash_of_links, #href, #initialize, #load, #method_missing, #nickname, #parse_params, #rediscover, #save
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::Gateway
Class Method Details
.parse_args(cloud_id, instance_id) ⇒ Object
33 34 35 |
# 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 |
Instance Method Details
#show ⇒ Object
37 38 39 40 |
# 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) ⇒ Object
54 55 56 |
# 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) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 |
# 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 |