#18 √ resolved
Le Huy

[PATCH] add support chain of gateways

Reported by Le Huy | May 12th, 2008 @ 06:08 PM

Comments and changes to this ticket

  • Kerry Buckley

    Kerry Buckley August 21st, 2008 @ 06:08 AM

      • → Title changed from “add support chain of gateways” to “[PATCH] add support chain of gateways”
      • → Tag changed from “” to “feature-request patch”

    The attached patch should add this feature. It allow you to specify gateway as an array as well as a string, eg:

    
    set :gateway, ['foo@gateway1', 'bar@gateway2']
    

    A series of tunnels is then set up using the specified gateways.

  • Jamis Buck

    Jamis Buck August 21st, 2008 @ 09:18 PM

    Thanks for working on this, Kerry! I have one concern, though--it looks like the connection to the gateways are reestablished for every server. Why did you decide not to cache the chained gateways and reuse them for subsequent server connections, like it did before?

  • Kerry Buckley

    Kerry Buckley August 22nd, 2008 @ 01:50 AM

      • → Tag changed from “feature-request patch” to “feature-request patch unfinished”

    Looks like I may have misunderstood exactly what the code was doing. I thought it was creating an instance of Net::SSH::Gateway in GatewayConnectionFactory.initialize, but deliberately not opening the gateway until the connect_to method was called.

    Because the second and subsequent gateways can only be created once the port used by the previous one is known (and this is only returned when the gateway is opened), I moved both creation and opening of gateways into connect_to. Would it have made more sense to do both in the initializer, and only do the final connection to the target server in connect_to? If so, I'll have a play and submit a new patch.

  • Kerry Buckley

    Kerry Buckley August 22nd, 2008 @ 02:40 AM

    Actually there's a bigger problem: my code seems to be reusing the same connection details for all roles, so commands that should be run on app and web, for example, are both being run on whichever is connected to first.

  • Kerry Buckley

    Kerry Buckley August 22nd, 2008 @ 07:14 AM

      • → Tag changed from “feature-request patch unfinished” to “feature-request patch”

    OK, here's a replacement patch that hopefully fixes both problems.

  • Jamis Buck

    Jamis Buck August 25th, 2008 @ 10:41 PM

      • → State changed from “new” to “resolved”
      • → Tag changed from “feature-request patch” to “committed feature-request patch”

    Great patch! Thanks Kerry. I've applied this patch in commit 5b60cc4e3f88bd4d29b404b9b616941d11079648.

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket