Skip to content

Commit 77deea8

Browse files
committed
fix shadowing issue in packer type issue workaround
1 parent 4f03669 commit 77deea8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

provisioner/communication.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,12 +185,15 @@ func (provisioner *Provisioner) determineUserAddr(connectionType string, ui pack
185185
if !ok || port == 0 {
186186
// packer > 1.11 now casts "port" as int64 so try again with that
187187
// never mind that sshport is still int (but dropped now for some reason), and either would actually be uint16...
188-
port, ok := provisioner.generatedData["Port"].(int64)
188+
newPort, ok := provisioner.generatedData["Port"].(int64)
189189

190-
if !ok || port == 0 {
190+
if !ok || newPort == 0 {
191191
ui.Error("host port could not be determined from available Packer data")
192192
return "", "", errors.New("unknown host port")
193193
}
194+
195+
// convert int64 port to int
196+
port = int(newPort)
194197
}
195198
}
196199

0 commit comments

Comments
 (0)