This commit is contained in:
Rémy Léone 2021-02-22 12:17:16 +01:00
parent 1f4971f5ac
commit 95e8263280
2 changed files with 7 additions and 7 deletions

View File

@ -74,8 +74,10 @@ type Config struct {
RemoveVolume bool `mapstructure:"remove_volume"`
UserAgent string `mapstructure-to-hcl2:",skip"`
ctx interpolate.Context
// Shutdown timeout. Default to 5m
ShutdownTimeout string `mapstructure:"shutdown_timeout" required:"false"`
UserAgent string `mapstructure-to-hcl2:",skip"`
ctx interpolate.Context
// Deprecated configs
@ -98,8 +100,6 @@ type Config struct {
// available.
// Deprecated, use Zone instead
Region string `mapstructure:"region" required:"false"`
Timeout string `mapstructure:"timeout" required:"false"`
}
func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
@ -257,8 +257,8 @@ func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
errs, errors.New("image is required"))
}
if c.Timeout == "" {
c.Timeout = "5m"
if c.ShutdownTimeout == "" {
c.ShutdownTimeout = "5m"
}
if errs != nil && len(errs.Errors) > 0 {

View File

@ -35,7 +35,7 @@ func (s *stepShutdown) Run(ctx context.Context, state multistep.StateBag) multis
ServerID: serverID,
}
c := state.Get("config").(*Config)
timeout := c.Timeout
timeout := c.ShutdownTimeout
duration, err := time.ParseDuration(timeout)
if err != nil {
err := fmt.Errorf("error: %s could not parse string %s as a duration", err, timeout)