Class: Fog::Compute::Tenderloin::Server
- Inherits:
-
Server
- Object
- Server
- Fog::Compute::Tenderloin::Server
- Defined in:
- lib/fog/tenderloin/models/compute/server.rb
Instance Method Summary collapse
- #destroy ⇒ Object
-
#initialize(attributes = {}) ⇒ Server
constructor
A new instance of Server.
- #public_ip_address ⇒ Object
- #ready? ⇒ Boolean
- #running? ⇒ Boolean
- #save ⇒ Object
- #ssh(commands, options = {}, &blk) ⇒ Object
- #sshable? ⇒ Boolean
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Server
Returns a new instance of Server.
37 38 39 |
# File 'lib/fog/tenderloin/models/compute/server.rb', line 37 def initialize(attributes={}) super end |
Instance Method Details
#destroy ⇒ Object
45 46 47 48 49 |
# File 'lib/fog/tenderloin/models/compute/server.rb', line 45 def destroy requires :id connection.destroy_vm(id) true end |
#public_ip_address ⇒ Object
33 34 35 |
# File 'lib/fog/tenderloin/models/compute/server.rb', line 33 def public_ip_address ip end |
#ready? ⇒ Boolean
25 26 27 |
# File 'lib/fog/tenderloin/models/compute/server.rb', line 25 def ready? running && ip end |
#running? ⇒ Boolean
29 30 31 |
# File 'lib/fog/tenderloin/models/compute/server.rb', line 29 def running? running end |
#save ⇒ Object
41 42 43 |
# File 'lib/fog/tenderloin/models/compute/server.rb', line 41 def save raise "Save not implemented" end |
#ssh(commands, options = {}, &blk) ⇒ Object
19 20 21 22 23 |
# File 'lib/fog/tenderloin/models/compute/server.rb', line 19 def ssh(commands, ={}, &blk) require 'net/ssh' [:password] = password super(commands, ) end |
#sshable? ⇒ Boolean
63 64 65 66 67 |
# File 'lib/fog/tenderloin/models/compute/server.rb', line 63 def sshable? ready? && !public_ip_address.nil? && !!Timeout::timeout(30) { ssh 'pwd' } rescue SystemCallError, Net::SSH::AuthenticationFailed, Timeout::Error false end |
#start ⇒ Object
51 52 53 54 55 |
# File 'lib/fog/tenderloin/models/compute/server.rb', line 51 def start requires :id connection.start_vm(id) true end |
#stop ⇒ Object
57 58 59 60 61 |
# File 'lib/fog/tenderloin/models/compute/server.rb', line 57 def stop requires :id connection.stop_vm(id) true end |