config/template.go
func (c *TemplateConfig) Finalize() {
	if c.Backup == nil {
		c.Backup = Bool(false)
	}

	if c.Command == nil {
		c.Command = String("")
	}

	if c.CommandTimeout == nil {
		c.CommandTimeout = TimeDuration(DefaultTemplateCommandTimeout)
	}

	if c.Contents == nil {
		c.Contents = String("")
	}

	if c.CreateDestDirs == nil {
		c.CreateDestDirs = Bool(true)
	}

	if c.Destination == nil {
		c.Destination = String("")
	}

	if c.ErrMissingKey == nil {
		c.ErrMissingKey = Bool(false)
	}

	if c.Exec == nil {
		c.Exec = DefaultExecConfig()
	}

	// Backwards compat for specifying command directly
	if c.Exec.Command == nil && c.Command != nil {
		c.Exec.Command = c.Command
	}
	if c.Exec.Timeout == nil && c.CommandTimeout != nil {
		c.Exec.Timeout = c.CommandTimeout
	}
	c.Exec.Finalize()

	if c.Perms == nil {
		c.Perms = FileMode(0)
	}

	if c.Source == nil {
		c.Source = String("")
	}

	if c.Wait == nil {
		c.Wait = DefaultWaitConfig()
	}
	c.Wait.Finalize()

	if c.LeftDelim == nil {
		c.LeftDelim = String("")
	}

	if c.RightDelim == nil {
		c.RightDelim = String("")
	}
}
func (c *TemplateConfig) Finalize() {
	if c.Backup == nil {
		c.Backup = Bool(false)
	}

	if c.Command == nil {
		c.Command = String("")
	}

	if c.CommandTimeout == nil {
		c.CommandTimeout = TimeDuration(DefaultTemplateCommandTimeout)
	}

	if c.Contents == nil {
		c.Contents = String("")
	}

	if c.CreateDestDirs == nil {
		c.CreateDestDirs = Bool(true)
	}

	if c.Destination == nil {
		c.Destination = String("")
	}

	if c.ErrMissingKey == nil {
		c.ErrMissingKey = Bool(false)
	}

	if c.Exec == nil {
		c.Exec = DefaultExecConfig()
	}

	// Backwards compat for specifying command directly
	if c.Exec.Command == nil && c.Command != nil {
		c.Exec.Command = c.Command
	}
	if c.Exec.Timeout == nil && c.CommandTimeout != nil {
		c.Exec.Timeout = c.CommandTimeout
	}
	c.Exec.Finalize()

	if c.Perms == nil {
		c.Perms = FileMode(0)
	}

	if c.Source == nil {
		c.Source = String("")
	}

	if c.Wait == nil {
		c.Wait = DefaultWaitConfig()
	}
	c.Wait.Finalize()

	if c.LeftDelim == nil {
		c.LeftDelim = String("")
	}

	if c.RightDelim == nil {
		c.RightDelim = String("")
	}
}
// Finalize ensures the configuration has no nil pointers and sets default
// values.