Set default communicator constant

This commit is contained in:
sophia 2022-06-29 17:27:03 -05:00
parent 935c665412
commit b01ace79f0

View File

@ -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)