github.phpd.cn/hashicorp/packer@v1.3.2/builder/parallels/common/ssh_config.go (about)

     1  package common
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/hashicorp/packer/helper/communicator"
     7  	"github.com/hashicorp/packer/template/interpolate"
     8  )
     9  
    10  // SSHConfig contains the configuration for SSH communicator.
    11  type SSHConfig struct {
    12  	Comm communicator.Config `mapstructure:",squash"`
    13  
    14  	// These are deprecated, but we keep them around for BC
    15  	// TODO(@mitchellh): remove
    16  	SSHWaitTimeout time.Duration `mapstructure:"ssh_wait_timeout"`
    17  }
    18  
    19  // Prepare sets the default values for SSH communicator properties.
    20  func (c *SSHConfig) Prepare(ctx *interpolate.Context) []error {
    21  	// TODO: backwards compatibility, write fixer instead
    22  	if c.SSHWaitTimeout != 0 {
    23  		c.Comm.SSHTimeout = c.SSHWaitTimeout
    24  	}
    25  
    26  	return c.Comm.Prepare(ctx)
    27  }