# File lib/fog/vmfusion/models/compute/server.rb, line 24 def clone(name) requires :raw ::Fission::VM.clone(@raw.name,name) return connection.servers.get(name) end
# File lib/fog/vmfusion/models/compute/server.rb, line 31 def destroy(options={ :force => false}) requires :raw if state=="running" if options[:force] @raw.stop end end ::Fission::VM.delete @raw.name end
# File lib/fog/vmfusion/models/compute/server.rb, line 77 def halt requires :raw if state=="running" @raw.halt return true else return false end end
# File lib/fog/vmfusion/models/compute/server.rb, line 17 def initalize(attributes={}) end
# File lib/fog/vmfusion/models/compute/server.rb, line 88 def poweroff requires :raw halt end
# File lib/fog/vmfusion/models/compute/server.rb, line 117 def private_ip_address ip_address(:private) end
# File lib/fog/vmfusion/models/compute/server.rb, line 187 def private_key @private_key ||= private_key_path && File.read(private_key_path) end
# File lib/fog/vmfusion/models/compute/server.rb, line 182 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/vmfusion/models/compute/server.rb, line 121 def public_ip_address ip_address(:public) end
# File lib/fog/vmfusion/models/compute/server.rb, line 196 def public_key @public_key ||= public_key_path && File.read(public_key_path) end
# File lib/fog/vmfusion/models/compute/server.rb, line 191 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/vmfusion/models/compute/server.rb, line 113 def ready? state == "running" end
# File lib/fog/vmfusion/models/compute/server.rb, line 65 def reboot requires :raw if state=="running" @raw.stop wait_for { state!="running"} @raw.start return true else return false end end
# File lib/fog/vmfusion/models/compute/server.rb, line 98 def resume requires :raw @raw.resume end
# File lib/fog/vmfusion/models/compute/server.rb, line 20 def save raise Fog::Errors::Error.new('Creating a new vm is not yet supported') end
# File lib/fog/vmfusion/models/compute/server.rb, line 142 def scp(local_path, remote_path, upload_options = {}) requires :public_ip_address, :username scp_options = {} scp_options[:password] = password unless self.password.nil? scp_options[:key_data] = [private_key] if self.private_key Fog::SCP.new(public_ip_address, username, scp_options).upload(local_path, remote_path, upload_options) end
Sets up a new key
# File lib/fog/vmfusion/models/compute/server.rb, line 153 def setup(credentials = {}) requires :public_key, :public_ip_address, :username credentials[:password] = password unless self.password.nil? credentails[:key_data] = [private_key] if self.private_key commands = [ %{mkdir .ssh}, ] if public_key commands << %{echo "#{public_key}" >> ~/.ssh/authorized_keys} end # wait for domain to be ready Timeout::timeout(360) do begin Timeout::timeout(8) do Fog::SSH.new(public_ip_address, username, credentials.merge(:timeout => 4)).run('pwd') end rescue Errno::ECONNREFUSED sleep(2) retry rescue Net::SSH::AuthenticationFailed, Timeout::Error retry end end Fog::SSH.new(public_ip_address, username, credentials).run(commands) end
# File lib/fog/vmfusion/models/compute/server.rb, line 93 def shutdown requires :raw stop end
# File lib/fog/vmfusion/models/compute/server.rb, line 130 def ssh(commands) requires :public_ip_address, :username #requires :password, :private_key ssh_options={} ssh_options[:password] = password unless password.nil? ssh_options[:key_data] = [private_key] if private_key Fog::SSH.new(public_ip_address, @username, ssh_options).run(commands) end
# File lib/fog/vmfusion/models/compute/server.rb, line 43 def start requires :raw unless state=="running" @raw.start return true else return false end end
# File lib/fog/vmfusion/models/compute/server.rb, line 108 def state requires :raw @raw.state end
# File lib/fog/vmfusion/models/compute/server.rb, line 54 def stop requires :raw if state=="running" @raw.stop return true else return false end end
Generated with the Darkfish Rdoc Generator 2.