2014-04-06 13:21:22 -04:00
|
|
|
package common
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
2014-09-03 23:23:39 -04:00
|
|
|
|
2015-06-13 18:43:27 -04:00
|
|
|
"github.com/mitchellh/packer/helper/communicator"
|
2015-05-27 16:49:31 -04:00
|
|
|
"github.com/mitchellh/packer/template/interpolate"
|
2014-04-06 13:21:22 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
type SSHConfig struct {
|
2015-06-13 18:43:27 -04:00
|
|
|
Comm communicator.Config `mapstructure:",squash"`
|
2014-04-06 13:21:22 -04:00
|
|
|
|
2015-06-13 18:43:27 -04:00
|
|
|
// These are deprecated, but we keep them around for BC
|
|
|
|
// TODO(@mitchellh): remove
|
|
|
|
SSHWaitTimeout time.Duration `mapstructure:"ssh_wait_timeout"`
|
2014-04-06 13:21:22 -04:00
|
|
|
}
|
|
|
|
|
2015-05-27 16:49:31 -04:00
|
|
|
func (c *SSHConfig) Prepare(ctx *interpolate.Context) []error {
|
2015-06-13 18:43:27 -04:00
|
|
|
// TODO: backwards compatibility, write fixer instead
|
|
|
|
if c.SSHWaitTimeout != 0 {
|
|
|
|
c.Comm.SSHTimeout = c.SSHWaitTimeout
|
2014-04-06 13:21:22 -04:00
|
|
|
}
|
|
|
|
|
2015-06-13 18:43:27 -04:00
|
|
|
return c.Comm.Prepare(ctx)
|
2014-04-06 13:21:22 -04:00
|
|
|
}
|