Loop through all files in the given artifact and return the given artifact on finish
Signed-off-by: Ian Duffy <ian@ianduffy.ie>
This commit is contained in:
parent
34b59bc051
commit
5b4e0fe25b
|
@ -170,12 +170,12 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
|
|||
envVars[1] = fmt.Sprintf("PACKER_BUILDER_TYPE='%s'", p.config.PackerBuilderType)
|
||||
copy(envVars[2:], p.config.Vars)
|
||||
|
||||
for _, file := range artifact.Files() {
|
||||
for _, path := range scripts {
|
||||
ui.Say(fmt.Sprintf("Post processing with local shell script: %s", path))
|
||||
|
||||
// Flatten the environment variables
|
||||
flattendVars := strings.Join(envVars, " ")
|
||||
|
||||
path := strings.Join([]string{path, file}, " ")
|
||||
p.config.ctx.Data = &ExecuteCommandTemplate{
|
||||
Vars: flattendVars,
|
||||
Path: path,
|
||||
|
@ -186,6 +186,8 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
|
|||
return nil, false, fmt.Errorf("Error processing command: %s", err)
|
||||
}
|
||||
|
||||
ui.Say(fmt.Sprintf("Post processing with local shell script: %s", command))
|
||||
|
||||
comm := &Communicator{}
|
||||
|
||||
cmd := &packer.RemoteCmd{Command: command}
|
||||
|
@ -206,8 +208,8 @@ func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (pac
|
|||
cmd.ExitStatus,
|
||||
path)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return nil, true, nil
|
||||
return artifact, true, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue