# File lib/fog/slicehost/models/compute/server.rb, line 31 def destroy requires :id connection.delete_slice(id) true end
# File lib/fog/slicehost/models/compute/server.rb, line 37 def flavor requires :flavor_id connection.flavors.get(flavor_id) end
# File lib/fog/slicehost/models/compute/server.rb, line 42 def image requires :image_id connection.images.get(image_id) end
# File lib/fog/slicehost/models/compute/server.rb, line 47 def private_ip_address nil end
# File lib/fog/slicehost/models/compute/server.rb, line 56 def private_key @private_key ||= private_key_path && File.read(private_key_path) end
# File lib/fog/slicehost/models/compute/server.rb, line 51 def private_key_path @private_key_path ||= Fog.credentials[:private_key_path] @private_key_path &&= File.expand_path(@private_key_path) end
# File lib/fog/slicehost/models/compute/server.rb, line 60 def public_ip_address addresses.first end
# File lib/fog/slicehost/models/compute/server.rb, line 69 def public_key @public_key ||= public_key_path && File.read(public_key_path) end
# File lib/fog/slicehost/models/compute/server.rb, line 64 def public_key_path @public_key_path ||= Fog.credentials[:public_key_path] @public_key_path &&= File.expand_path(@public_key_path) end
# File lib/fog/slicehost/models/compute/server.rb, line 73 def ready? self.state == 'active' end
# File lib/fog/slicehost/models/compute/server.rb, line 77 def reboot(type = 'SOFT') requires :id connection.reboot_slice(id, type) true end
# File lib/fog/slicehost/models/compute/server.rb, line 83 def save raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity requires :flavor_id, :image_id, :name data = connection.create_slice(flavor_id, image_id, name) merge_attributes(data.body) true end
# File lib/fog/slicehost/models/compute/server.rb, line 92 def setup(credentials = {}) requires :addresses, :identity, :public_key, :username Fog::SSH.new(addresses.first, username, credentials).run([ %{mkdir .ssh}, %{echo "#{public_key}" >> ~/.ssh/authorized_keys}, %{passwd -l #{username}}, %{echo "#{MultiJson.encode(attributes)}" >> ~/attributes.json} ]) rescue Errno::ECONNREFUSED sleep(1) retry end
Generated with the Darkfish Rdoc Generator 2.