From e8cada8bf7faf575590390cf25738ec7a5983dcf Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Wed, 19 Apr 2017 23:26:49 -0700 Subject: [PATCH] document and remove artifactID --- post-processor/checksum/post-processor.go | 12 +++++------- website/source/docs/post-processors/checksum.html.md | 11 ++++++++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/post-processor/checksum/post-processor.go b/post-processor/checksum/post-processor.go index 7021af061..2ae6da164 100644 --- a/post-processor/checksum/post-processor.go +++ b/post-processor/checksum/post-processor.go @@ -31,10 +31,9 @@ type PostProcessor struct { } type outputPathTemplate struct { - BuildName string - BuilderType string - ArtifactID string - HashType string + BuildName string + BuilderType string + ChecksumType string } func getHash(t string) hash.Hash { @@ -80,7 +79,7 @@ func (p *PostProcessor) Configure(raws ...interface{}) error { } if p.config.OutputPath == "" { - p.config.OutputPath = "packer_{{.BuildName}}_{{.BuilderType}}_{{.HashType}}.checksum" + p.config.OutputPath = "packer_{{.BuildName}}_{{.BuilderType}}_{{.ChecksumType}}.checksum" } if err = interpolate.Validate(p.config.OutputPath, &p.config.ctx); err != nil { @@ -103,12 +102,11 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac opTpl := &outputPathTemplate{ BuildName: p.config.PackerBuildName, BuilderType: p.config.PackerBuilderType, - ArtifactID: artifact.Id(), } for _, ct := range p.config.ChecksumTypes { h = getHash(ct) - opTpl.HashType = ct + opTpl.ChecksumType = ct p.config.ctx.Data = &opTpl for _, art := range files { diff --git a/website/source/docs/post-processors/checksum.html.md b/website/source/docs/post-processors/checksum.html.md index 855a8c375..7e72a0937 100644 --- a/website/source/docs/post-processors/checksum.html.md +++ b/website/source/docs/post-processors/checksum.html.md @@ -44,4 +44,13 @@ Optional parameters: - `checksum_types` (array of strings) - An array of strings of checksum types to compute. Allowed values are md5, sha1, sha224, sha256, sha384, sha512. -- `output` (string) - Specify filename to store checksums. +- `output` (string) - Specify filename to store checksums. This defaults to + `packer_{{.BuildName}}_{{.BuilderType}}_{{.ChecksumType}}.checksum`. For + example, if you had a builder named `database`, you might see the file + written as `packer_database_docker_md5.checksum`. The following variables are + available to use in the output template: + + * `BuildName`: The name of the builder that produced the artifact. + * `BuilderType`: The type of builder used to produce the artifact. + * `ChecksumType`: The type of checksums the file contains. This should be + used if you have more than one value in `checksum_types`.