Check if communicator is available before detecting guests

This commit is contained in:
sophia 2022-06-15 11:08:45 -05:00
parent e0a30f9ba7
commit adadf26c9c
3 changed files with 11 additions and 2 deletions

View File

@ -98,6 +98,17 @@ func (m *Machine) Box() (b core.Box, err error) {
// Guest implements core.Machine
func (m *Machine) Guest() (g core.Guest, err error) {
comm, err := m.Communicate()
if err != nil {
return nil, err
}
isReady, err := comm.Ready(m)
if err != nil {
return nil, err
}
if !isReady {
return nil, fmt.Errorf("unable to communicate with guest")
}
defer func() {
if g != nil {
err = seedPlugin(g, m)

View File

@ -85,7 +85,6 @@ module Vagrant
end
def guest
# require "pry-remote"; binding.pry_remote
raise Errors::MachineGuestNotReady if !communicate.ready?
if !@guest
@guest = Guest.new(self, nil, nil)

View File

@ -37,7 +37,6 @@ module VagrantPlugins
end
# @return [Guest] machine guest
# TODO: This needs to be loaded properly
def guest
g = client.guest(Empty.new)
Guest.load(g, broker: broker)