lib/chef/provisioning/transport/ssh.rb in chef-provisioning-2.3.2 vs lib/chef/provisioning/transport/ssh.rb in chef-provisioning-2.4.0
- old
+ new
@@ -171,10 +171,14 @@
end
end
def make_url_available_to_remote(local_url)
uri = URI(local_url)
- if is_local_machine(uri.host)
+ if 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')
if !port
# Try harder if the port is already taken
port, host = forward_port(uri.port, uri.host, 0, 'localhost')
if !port