document and remove artifactID

This commit is contained in:
Matthew Hooker 2017-04-19 23:26:49 -07:00
parent 0b4cd4d394
commit e8cada8bf7
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
2 changed files with 15 additions and 8 deletions

View File

@ -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 {

View File

@ -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`.