Enable forward ssh-port to host

Provides an option to disable the forwarding in case it causes issues.
However based on original PRs adding the forwarded behaviour, it does
not appear to be intentional to exclude it permanently.

Closes: #1011
Closes: #1012
This commit is contained in:
Matthias Blümel
2019-06-11 18:36:10 +02:00
committed by Darragh Bailey
parent f0b6897095
commit 07391048af
4 changed files with 65 additions and 1 deletions

View File

@@ -71,7 +71,7 @@ module VagrantPlugins
next
end
next unless type == :forwarded_port && options[:id] != 'ssh'
next if type != :forwarded_port || ( options[:id] == 'ssh' && !env[:machine].provider_config.forward_ssh_port )
if options.fetch(:host_ip, '').to_s.strip.empty?
options.delete(:host_ip)
end

View File

@@ -39,6 +39,9 @@ module VagrantPlugins
attr_accessor :proxy_command
# Forward port with id 'ssh'
attr_accessor :forward_ssh_port
# Libvirt storage pool name, where box image and instance snapshots will
# be stored.
attr_accessor :storage_pool_name
@@ -196,6 +199,7 @@ module VagrantPlugins
@id_ssh_key_file = UNSET_VALUE
@socket = UNSET_VALUE
@proxy_command = UNSET_VALUE
@forward_ssh_port = UNSET_VALUE # forward port with id 'ssh'
@storage_pool_name = UNSET_VALUE
@snapshot_pool_name = UNSET_VALUE
@random_hostname = UNSET_VALUE
@@ -784,6 +788,9 @@ module VagrantPlugins
finalize_from_uri
finalize_proxy_command
# forward port with id 'ssh'
@forward_ssh_port = true if @forward_ssh_port == UNSET_VALUE
@storage_pool_name = 'default' if @storage_pool_name == UNSET_VALUE
@snapshot_pool_name = @storage_pool_name if @snapshot_pool_name == UNSET_VALUE
@storage_pool_path = nil if @storage_pool_path == UNSET_VALUE