Add packer.ExpandUser() function to support tilde in usage of config.ValidationKeyPath (#8657)

This commit is contained in:
Paschalis Tsilias 2020-01-28 15:33:42 +02:00 committed by Sylvia Moss
parent 56206aa3ae
commit beca6de71b
1 changed files with 5 additions and 1 deletions

View File

@ -276,8 +276,12 @@ func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, comm packer.C
}
if p.config.ValidationKeyPath != "" {
path, err := packer.ExpandUser(p.config.ValidationKeyPath)
if err != nil {
return fmt.Errorf("Error while expanding a tilde in the validation key: %s", err)
}
remoteValidationKeyPath = fmt.Sprintf("%s/validation.pem", p.config.StagingDir)
if err := p.uploadFile(ui, comm, remoteValidationKeyPath, p.config.ValidationKeyPath); err != nil {
if err := p.uploadFile(ui, comm, remoteValidationKeyPath, path); err != nil {
return fmt.Errorf("Error copying validation key: %s", err)
}
}