diff --git a/internal/core/target.go b/internal/core/target.go index 858029808..1dada36fa 100644 --- a/internal/core/target.go +++ b/internal/core/target.go @@ -30,6 +30,8 @@ import ( "github.com/hashicorp/vagrant/internal/serverclient" ) +const DEFAULT_COMMUNICATOR_NAME = "ssh" + type Target struct { ctx context.Context target *vagrant_server.Target @@ -149,12 +151,15 @@ func (t *Target) Communicate() (c core.Communicator, err error) { rawCommunicatorName, err := t.vagrantfile.GetValue("vm", "communicator") // If there is an error getting the communicator, default to using the ssh communicator if err != nil { - communicatorName = "ssh" + communicatorName = DEFAULT_COMMUNICATOR_NAME } if rawCommunicatorName == nil { - communicatorName = "ssh" + communicatorName = DEFAULT_COMMUNICATOR_NAME } else { - communicatorName = rawCommunicatorName.(string) + communicatorName, err = optionToString(rawCommunicatorName) + if err != nil { + return nil, err + } } communicator, err := t.project.basis.component( t.ctx, component.CommunicatorType, communicatorName)