# File lib/fog/terremark/models/shared/server.rb, line 16 def destroy requires :id data = connection.power_off(id).body task = connection.tasks.new(data) task.wait_for { ready? } connection.delete_vapp(id) true end
# File lib/fog/terremark/models/shared/server.rb, line 77 def graceful_restart requires :id shutdown wait_for { off? } power_on end
# File lib/fog/terremark/models/shared/server.rb, line 34 def off? status == '2' end
# File lib/fog/terremark/models/shared/server.rb, line 30 def on? status == '4' end
# File lib/fog/terremark/models/shared/server.rb, line 49 def power_off requires :id begin connection.power_off(id) rescue Excon::Errors::InternalServerError => e #Frankly we shouldn't get here ... raise e unless e.to_s =~ /because it is already powered off/ end true end
# File lib/fog/terremark/models/shared/server.rb, line 38 def power_on(options = {}) requires :id begin connection.power_on(id) rescue Excon::Errors::InternalServerError => e #Frankly we shouldn't get here ... raise e unless e.to_s =~ /because it is already powered on/ end true end
# File lib/fog/terremark/models/shared/server.rb, line 71 def power_reset requires :id connection.power_reset(id) true end
{ '0' => 'Being created', '2' => 'Powered Off', '4' => 'Powered On'}
# File lib/fog/terremark/models/shared/server.rb, line 26 def ready? status == '2' end
# File lib/fog/terremark/models/shared/server.rb, line 84 def save requires :name data = connection.instantiate_vapp(name) merge_attributes(data.body) task = connection.deploy_vapp(id) task.wait_for { ready? } task = connection.power_on(id) task.wait_for { ready? } true end
# File lib/fog/terremark/models/shared/server.rb, line 60 def shutdown requires :id begin connection.power_shutdown(id) rescue Excon::Errors::InternalServerError => e #Frankly we shouldn't get here ... raise e unless e.to_s =~ /because it is already powered off/ end true end
Generated with the Darkfish Rdoc Generator 2.