// Takes the ReloadValidateCommand and returns nil if the command succeeded
Takes the ReloadValidateCommand and returns nil if the command succeeded
// Takes the ReloadValidateCommand and returns nil if the command succeeded
func validateConfig(validateTemplate string, newContent string) (err error) {
	if validateTemplate == "" {
		return nil
	}
	tmpFile, err := ioutil.TempFile("/tmp", "bamboo")
	if err != nil {
		return
	}
	defer os.Remove(tmpFile.Name())
	defer tmpFile.Close()
	log.Println("Generating validation command")
	_, err = tmpFile.WriteString(newContent)
	if err != nil {
		return
	}
	validateCommand, err := template.RenderTemplate(
		"validate",
		validateTemplate,
		tmpFile.Name())
	if err != nil {
		return
	}
	log.Println("Validating config")
	err = execCommand(validateCommand)
	return
}
func validateConfig ( validateTemplate string , newContent string ) ( err error ) { if validateTemplate == " " { return nil } tmpFile , err := ioutil . TempFile ( " " , " " ) if err != nil { return } defer os . Remove ( tmpFile . Name ( ) ) defer tmpFile . Close ( ) log . Println ( " " ) _ , err = tmpFile . WriteString ( newContent ) if err != nil { return } validateCommand , err := template . RenderTemplate ( " " , validateTemplate , tmpFile . Name ( ) ) if err != nil { return } log . Println ( " " ) err = execCommand ( validateCommand ) return }
Takes the ReloadValidateCommand and returns nil if the command succeeded
Takes the ReloadValidateCommand and returns nil if the command succeeded