Skip to content

Commit

Permalink
support winrm ssl settings interfacing from packer
Browse files Browse the repository at this point in the history
  • Loading branch information
mschuchard committed Nov 5, 2024
1 parent 905227a commit 3ffaddc
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion provisioner/testinfra_communication.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,21 @@ func (provisioner *Provisioner) determineCommunication(ui packer.Ui) ([]string,
}
}

// format string for testinfra connection backend setting
connectionBackend := fmt.Sprintf("--hosts=winrm://%s:%s@%s", user, winrmPassword, httpAddr)

// modify connection backend for ssl settings
if useSSL, ok := provisioner.generatedData["WinRMUseSSL"].(bool); ok && !useSSL {
// disable ssl
connectionBackend += "?no_ssl=true"
}
if insecure, _ := provisioner.generatedData["WinRMInsecure"].(bool); insecure {
// do not verify ssl
connectionBackend += "?no_verify_ssl=true"
}

// append args with winrm connection backend information (user, password, host, port)
args = append(args, fmt.Sprintf("--hosts=winrm://%s:%s@%s", user, winrmPassword, httpAddr))
args = append(args, connectionBackend)
case "docker", "podman", "lxc":
// determine instanceid
instanceID, ok := provisioner.generatedData["ID"].(string)
Expand Down

0 comments on commit 3ffaddc

Please sign in to comment.