Sha256: 9a65b3d728282af5423c100782e6c1a32341a1eb235849ae232236eb063d6fd4

Contents?: true

Size: 871 Bytes

Versions: 2

Compression:

Stored size: 871 Bytes

Contents

module VagrantPlugins
module CommunicatorSSH
class Communicator
  # Override Vagrant key insertion (we handle generated keys internally)
  def ready?
    @logger.debug("Checking whether SSH is ready...")

    # Attempt to connect. This will raise an exception if it fails.
    begin
      connect
      @logger.info("SSH is ready!")
    rescue Vagrant::Errors::VagrantError => e
      # We catch a `VagrantError` which would signal that something went
      # wrong expectedly in the `connect`, which means we didn't connect.
      @logger.info("SSH not up: #{e.inspect}")
      dbg(e.inspect, 'error')
      return false
    end

    # Verify the shell is valid
    if execute("", error_check: false) != 0
      raise Vagrant::Errors::SSHInvalidShell
    end

    # If we reached this point then we successfully connected
    dbg('connected')
    true
  end
end
end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
corl-0.5.8 lib/core/mod/vagrant.rb
corl-0.5.7 lib/core/mod/vagrant.rb