Merge pull request #3672 from yoctocloud/checksum

post-processor/checksum: create dir for output file
This commit is contained in:
Chris Bednarski 2016-07-06 17:24:45 -07:00 committed by GitHub
commit b062c76ca3
1 changed files with 3 additions and 1 deletions

View File

@ -103,7 +103,9 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
if _, err := os.Stat(checksumFile); err != nil {
newartifact.files = append(newartifact.files, checksumFile)
}
if err := os.MkdirAll(filepath.Dir(checksumFile), os.FileMode(0755)); err != nil {
return nil, false, fmt.Errorf("unable to create dir: %s", err.Error())
}
fw, err := os.OpenFile(checksumFile, os.O_WRONLY|os.O_APPEND|os.O_CREATE, os.FileMode(0644))
if err != nil {
return nil, false, fmt.Errorf("unable to create file %s: %s", checksumFile, err.Error())