Class: Vagrant::SSH
- Inherits:
-
Object
- Object
- Vagrant::SSH
- Defined in:
- lib/cuken/api/vagrant.rb
Instance Method Summary collapse
-
#ssh_connect_command(opts = {}) ⇒ Object
In order to run Aruba’s ‘When I type “…”’ steps: Returns a Vagrant SSH connection string for the environment’s virtual machine, This method optionally takes a hash of options which override the configuration values.
Instance Method Details
#ssh_connect_command(opts = {}) ⇒ Object
In order to run Aruba’s ‘When I type “…”’ steps: Returns a Vagrant SSH connection string for the environment’s virtual machine, This method optionally takes a hash of options which override the configuration values.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/cuken/api/vagrant.rb', line 51 def ssh_connect_command(opts={}) if Mario::Platform.windows? raise Errors::SSHUnavailableWindows, :key_path => env.config.ssh.private_key_path, :ssh_port => port(opts) end raise Errors::SSHUnavailable if !Kernel.system("which ssh > /dev/null 2>&1") = {} [:port] = port(opts) [:host, :username, :private_key_path].each do |param| [param] = opts[param] || env.config.ssh.send(param) end ([:private_key_path]) # Command line options = ["-p #{[:port]}", "-o UserKnownHostsFile=/dev/null", "-o StrictHostKeyChecking=no", "-o IdentitiesOnly=yes", "-i #{[:private_key_path]}", "-o LogLevel=ERROR"] << "-o ForwardAgent=yes" if env.config.ssh.forward_agent if env.config.ssh.forward_x11 # Both are required so that no warnings are shown regarding X11 << "-o ForwardX11=yes" << "-o ForwardX11Trusted=yes" end "ssh #{.join(" ")} #{[:username]}@#{[:host]}".strip end |