lib/chef/provisioning/transport/ssh.rb in chef-provisioning-2.5.0 vs lib/chef/provisioning/transport/ssh.rb in chef-provisioning-2.6.0
- old
+ new
@@ -41,10 +41,11 @@
@username = username
@ssh_options = ssh_options
@options = options
@config = global_config
@remote_forwards = ssh_options.delete(:remote_forwards) { Array.new }
+ @never_forward_localhost = ssh_options.delete(:never_forward_localhost)
end
attr_reader :host
attr_reader :username
attr_reader :ssh_options
@@ -171,10 +172,12 @@
end
end
def make_url_available_to_remote(local_url)
uri = URI(local_url)
- if uri.scheme == 'chefzero' && !ChefZero::SocketlessServerMap.server_on_port(uri.port).server
+ if @never_forward_localhost
+ return uri.to_s
+ elsif uri.scheme == 'chefzero' && !ChefZero::SocketlessServerMap.server_on_port(uri.port).server
# There is no .server for a socketless, for a socket-d server it would
# be a WEBrick::HTTPServer object.
raise 'Cannot forward a socketless Chef Zero server, see https://docs.chef.io/deprecations_local_listen.html for more information'
elsif is_local_machine(uri.host)
port, host = forward_port(uri.port, uri.host, uri.port, 'localhost')