`vagrant ssh -p` is now plain mode
This commit is contained in:
parent
a6c3551064
commit
026a551496
|
@ -20,6 +20,9 @@
|
||||||
- All Vagrant commands that take a VM name in a Multi-VM environment
|
- All Vagrant commands that take a VM name in a Multi-VM environment
|
||||||
can now be given a regular expression. If the name starts and ends with a "/"
|
can now be given a regular expression. If the name starts and ends with a "/"
|
||||||
then it is assumed to be a regular expression. [GH-573]
|
then it is assumed to be a regular expression. [GH-573]
|
||||||
|
- Added a "--plain" flag to `vagrant ssh` which will cause Vagrant to not
|
||||||
|
perform any authentication. It will simply `ssh` into the proper IP and
|
||||||
|
port of the virtual machine.
|
||||||
- Removed Thor as a dependency for the command line interfaces. This resulted
|
- Removed Thor as a dependency for the command line interfaces. This resulted
|
||||||
in general speed increases across all command line commands.
|
in general speed increases across all command line commands.
|
||||||
- Linux uses `shutdown -h` instead of `halt` to hopefully more consistently
|
- Linux uses `shutdown -h` instead of `halt` to hopefully more consistently
|
||||||
|
|
|
@ -14,11 +14,8 @@ module Vagrant
|
||||||
opts.on("-c", "--command COMMAND", "Execute an SSH command directly.") do |c|
|
opts.on("-c", "--command COMMAND", "Execute an SSH command directly.") do |c|
|
||||||
options[:command] = c
|
options[:command] = c
|
||||||
end
|
end
|
||||||
opts.on(
|
opts.on("-p", "--plain", "Plain mode, leaves authentication up to user.") do |p|
|
||||||
"-p",
|
options[:plain_mode] = p
|
||||||
"Act more like vanilla 'ssh <vm>'"
|
|
||||||
) do |p|
|
|
||||||
options[:port_only] = p
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -35,7 +32,7 @@ module Vagrant
|
||||||
if options[:command]
|
if options[:command]
|
||||||
ssh_execute(vm, options[:command])
|
ssh_execute(vm, options[:command])
|
||||||
else
|
else
|
||||||
ssh_connect(vm, {:port_only => options[:port_only]})
|
ssh_connect(vm, { :plain_mode => options[:plain_mode] })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,7 +33,10 @@ module Vagrant
|
||||||
|
|
||||||
raise Errors::SSHUnavailable if !Kernel.system("which ssh > /dev/null 2>&1")
|
raise Errors::SSHUnavailable if !Kernel.system("which ssh > /dev/null 2>&1")
|
||||||
|
|
||||||
port_only = opts[:port_only]
|
# If plain mode is enabled then we don't do any authentication (we don't
|
||||||
|
# set a user or an identity file)
|
||||||
|
plain_mode = options[:plain_mode]
|
||||||
|
|
||||||
options = {}
|
options = {}
|
||||||
options[:port] = port(opts)
|
options[:port] = port(opts)
|
||||||
options[:private_key_path] = private_key_path
|
options[:private_key_path] = private_key_path
|
||||||
|
@ -47,7 +50,7 @@ module Vagrant
|
||||||
command_options = ["-p #{options[:port]}", "-o UserKnownHostsFile=/dev/null",
|
command_options = ["-p #{options[:port]}", "-o UserKnownHostsFile=/dev/null",
|
||||||
"-o StrictHostKeyChecking=no", "-o IdentitiesOnly=yes",
|
"-o StrictHostKeyChecking=no", "-o IdentitiesOnly=yes",
|
||||||
"-o LogLevel=ERROR"]
|
"-o LogLevel=ERROR"]
|
||||||
command_options << "-i #{options[:private_key_path]}" unless port_only
|
command_options << "-i #{options[:private_key_path]}" if !plain_mode
|
||||||
command_options << "-o ForwardAgent=yes" if @vm.config.ssh.forward_agent
|
command_options << "-o ForwardAgent=yes" if @vm.config.ssh.forward_agent
|
||||||
|
|
||||||
if @vm.config.ssh.forward_x11
|
if @vm.config.ssh.forward_x11
|
||||||
|
@ -57,7 +60,7 @@ module Vagrant
|
||||||
end
|
end
|
||||||
|
|
||||||
host_string = options[:host]
|
host_string = options[:host]
|
||||||
host_string = "#{options[:username]}@" + host_string unless port_only
|
host_string = "#{options[:username]}@#{host_string}" if !plain_mode
|
||||||
command = "ssh #{command_options.join(" ")} #{host_string}".strip
|
command = "ssh #{command_options.join(" ")} #{host_string}".strip
|
||||||
@logger.info("Invoking SSH: #{command}")
|
@logger.info("Invoking SSH: #{command}")
|
||||||
safe_exec(command)
|
safe_exec(command)
|
||||||
|
|
Loading…
Reference in New Issue