Fix
This commit is contained in:
parent
1f4971f5ac
commit
95e8263280
|
@ -74,8 +74,10 @@ type Config struct {
|
||||||
|
|
||||||
RemoveVolume bool `mapstructure:"remove_volume"`
|
RemoveVolume bool `mapstructure:"remove_volume"`
|
||||||
|
|
||||||
UserAgent string `mapstructure-to-hcl2:",skip"`
|
// Shutdown timeout. Default to 5m
|
||||||
ctx interpolate.Context
|
ShutdownTimeout string `mapstructure:"shutdown_timeout" required:"false"`
|
||||||
|
UserAgent string `mapstructure-to-hcl2:",skip"`
|
||||||
|
ctx interpolate.Context
|
||||||
|
|
||||||
// Deprecated configs
|
// Deprecated configs
|
||||||
|
|
||||||
|
@ -98,8 +100,6 @@ type Config struct {
|
||||||
// available.
|
// available.
|
||||||
// Deprecated, use Zone instead
|
// Deprecated, use Zone instead
|
||||||
Region string `mapstructure:"region" required:"false"`
|
Region string `mapstructure:"region" required:"false"`
|
||||||
|
|
||||||
Timeout string `mapstructure:"timeout" required:"false"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
|
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"))
|
errs, errors.New("image is required"))
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.Timeout == "" {
|
if c.ShutdownTimeout == "" {
|
||||||
c.Timeout = "5m"
|
c.ShutdownTimeout = "5m"
|
||||||
}
|
}
|
||||||
|
|
||||||
if errs != nil && len(errs.Errors) > 0 {
|
if errs != nil && len(errs.Errors) > 0 {
|
||||||
|
|
|
@ -35,7 +35,7 @@ func (s *stepShutdown) Run(ctx context.Context, state multistep.StateBag) multis
|
||||||
ServerID: serverID,
|
ServerID: serverID,
|
||||||
}
|
}
|
||||||
c := state.Get("config").(*Config)
|
c := state.Get("config").(*Config)
|
||||||
timeout := c.Timeout
|
timeout := c.ShutdownTimeout
|
||||||
duration, err := time.ParseDuration(timeout)
|
duration, err := time.ParseDuration(timeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("error: %s could not parse string %s as a duration", err, timeout)
|
err := fmt.Errorf("error: %s could not parse string %s as a duration", err, timeout)
|
||||||
|
|
Loading…
Reference in New Issue