We need check content, when cmd failed.

Signed-off-by: Tang Le <at28997146@163.com>
This commit is contained in:
Tang Le 2017-02-17 19:11:56 +08:00
parent 3d9f89be1d
commit e26efd0b08

View file

@ -111,7 +111,13 @@ func (t *Template) Write(conf config.TemplateConfig, isValidTemplate func([]byte
cmd.Stdout = t.outCmdBuf
if err := cmd.Run(); err != nil {
glog.Warningf("unexpected error cleaning template: %v", err)
return t.tmplBuf.Bytes(), nil
content := t.tmplBuf.Bytes()
err = isValidTemplate(content)
if err != nil {
return nil, err
}
return content, nil
}
content := t.outCmdBuf.Bytes()