From f2b0fabe6600587b9bcc78fea0f26d7a53e00163 Mon Sep 17 00:00:00 2001 From: Justin Nauman Date: Fri, 29 Apr 2016 21:21:27 -0500 Subject: [PATCH] Fixes #3466 - Remote path needs to be set prior to config interpolation (#3468) --- provisioner/chef-client/provisioner.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/provisioner/chef-client/provisioner.go b/provisioner/chef-client/provisioner.go index 5d9fb751a..572b88212 100644 --- a/provisioner/chef-client/provisioner.go +++ b/provisioner/chef-client/provisioner.go @@ -235,6 +235,14 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error { return fmt.Errorf("Error uploading encrypted data bag secret: %s", err) } } + + if p.config.ValidationKeyPath != "" { + remoteValidationKeyPath = fmt.Sprintf("%s/validation.pem", p.config.StagingDir) + if err := p.uploadFile(ui, comm, remoteValidationKeyPath, p.config.ValidationKeyPath); err != nil { + return fmt.Errorf("Error copying validation key: %s", err) + } + } + configPath, err := p.createConfig( ui, comm, @@ -250,13 +258,6 @@ func (p *Provisioner) Provision(ui packer.Ui, comm packer.Communicator) error { return fmt.Errorf("Error creating Chef config file: %s", err) } - if p.config.ValidationKeyPath != "" { - remoteValidationKeyPath = fmt.Sprintf("%s/validation.pem", p.config.StagingDir) - if err := p.uploadFile(ui, comm, remoteValidationKeyPath, p.config.ValidationKeyPath); err != nil { - return fmt.Errorf("Error copying validation key: %s", err) - } - } - jsonPath, err := p.createJson(ui, comm) if err != nil { return fmt.Errorf("Error creating JSON attributes: %s", err)