You should be able to start a `Net::SSH` session here, then create a new SCP client with `scp = Net::SCP.new(session)`, to avoid needing to create two distinct SSH connections to the remote server.  That should also reduce duplicate code a little.