From 8c875ebda4d1a76fe067c80dbb4b62cae9f2da34 Mon Sep 17 00:00:00 2001 From: Chris Bednarski Date: Fri, 10 Jun 2016 00:52:21 -0700 Subject: [PATCH] Changed overloaded artifact variable name to source --- post-processor/manifest/post-processor.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/post-processor/manifest/post-processor.go b/post-processor/manifest/post-processor.go index 2f8eadaee..fe23455f1 100644 --- a/post-processor/manifest/post-processor.go +++ b/post-processor/manifest/post-processor.go @@ -73,14 +73,14 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, source packer.Artifact) (packe // Read the current manifest file from disk contents := []byte{} if contents, err = ioutil.ReadFile(p.config.Filename); err != nil && !os.IsNotExist(err) { - return nil, true, fmt.Errorf("Unable to open %s for reading: %s", p.config.Filename, err) + return source, true, fmt.Errorf("Unable to open %s for reading: %s", p.config.Filename, err) } // Parse the manifest file JSON, if we have some manifestFile := &ManifestFile{} if len(contents) > 0 { if err = json.Unmarshal(contents, manifestFile); err != nil { - return nil, true, fmt.Errorf("Unable to parse content from %s: %s", p.config.Filename, err) + return source, true, fmt.Errorf("Unable to parse content from %s: %s", p.config.Filename, err) } } @@ -88,13 +88,13 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, source packer.Artifact) (packe manifestFile.Builds = append(manifestFile.Builds, *artifact) // Write JSON to disk - if out, err := json.Marshal(manifestFile); err == nil { + if out, err := json.MarshalIndent(manifestFile, "", " "); err == nil { if err := ioutil.WriteFile(p.config.Filename, out, 0664); err != nil { - return nil, true, fmt.Errorf("Unable to write %s: %s", p.config.Filename, err) + return source, true, fmt.Errorf("Unable to write %s: %s", p.config.Filename, err) } } else { - return nil, true, fmt.Errorf("Unable to marshal JSON %s", err) + return source, true, fmt.Errorf("Unable to marshal JSON %s", err) } - return artifact, true, err + return source, true, err }