mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-05 13:33:58 +00:00
fix(provider): handle IPv6 in ssh client (#1558)
fix(vm): handle IPv6 in ssh client Signed-off-by: Jordan Garside <jordangarside@Jordans-MacBook-Pro.local>
This commit is contained in:
parent
d226b59e2e
commit
18a7f8ec35
@ -473,7 +473,14 @@ func (c *client) openNodeShell(ctx context.Context, node ProxmoxNode) (*ssh.Clie
|
|||||||
return nil, fmt.Errorf("failed to determine the home directory: %w", err)
|
return nil, fmt.Errorf("failed to determine the home directory: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
sshHost := fmt.Sprintf("%s:%d", node.Address, node.Port)
|
var sshHost string
|
||||||
|
if strings.Contains(node.Address, ":") {
|
||||||
|
// IPv6
|
||||||
|
sshHost = fmt.Sprintf("[%s]:%d", node.Address, node.Port)
|
||||||
|
} else {
|
||||||
|
// IPv4
|
||||||
|
sshHost = fmt.Sprintf("%s:%d", node.Address, node.Port)
|
||||||
|
}
|
||||||
|
|
||||||
sshPath := path.Join(homeDir, ".ssh")
|
sshPath := path.Join(homeDir, ".ssh")
|
||||||
if _, err = os.Stat(sshPath); os.IsNotExist(err) {
|
if _, err = os.Stat(sshPath); os.IsNotExist(err) {
|
||||||
|
Loading…
Reference in New Issue
Block a user