Skip to content

Commit 0efd200

Browse files
committed
fix sshprivatekey validation and testinfra exec failure
1 parent 260a94e commit 0efd200

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
- Note in Packer logs when they originate from this plugin.
33
- Promote `winrm` to officially supported communicator.
44
- Minor code optimization.
5+
- Fix Packer ssh private key validation.
6+
- Indicate failed testinfra execution based solely on exit code.
57

68
### 1.5.1
79
- More improvements to Packer communicators' settings interfacing with Testinfra provisioner plugin.

provisioner/command.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ func packerRemoteCmd(localCmd *packer.RemoteCmd, installCmd []string, comm packe
113113

114114
// wait for testinfra to complete and flush buffers
115115
// then check for pytest/testinfra execution issues
116-
if exitStatus := localCmd.Wait(); exitStatus > 0 || len(stderr.String()) > 0 {
116+
if exitStatus := localCmd.Wait(); exitStatus > 0 {
117117
ui.Error("Testinfra errored internally during execution:")
118118
ui.Error(stderr.String())
119119
ui.Errorf("Testinfra returned exit status: %d", exitStatus)

provisioner/communication.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ func (provisioner *Provisioner) determineSSHAuth(ui packer.Ui) (sshAuth, string,
241241
} else { // we have no other options, so create a temp private key file from the packer data
242242
// attempt to obtain a private key
243243
SSHPrivateKey, ok := provisioner.generatedData["SSHPrivateKey"].(string)
244-
if !ok || len("SSHPrivateKey") == 0 {
244+
if !ok || len(SSHPrivateKey) == 0 {
245245
ui.Error("no SSH authentication information was available in Packer data")
246246
return "", "", errors.New("no ssh authentication")
247247
}

0 commit comments

Comments
 (0)