Skip to content

Commit 702dce8

Browse files
nick-holmquistlbajolet-hashicorp
authored andcommitted
Strip trailing / from proxmox url
Accidentally adding a trailing / to the proxmox_url causes issues with additional_iso_files. A 501 can be seen and the upload fails. proxmox_url ="https://my-proxmox.my-domain:8006/api2/json/" Upload request becomes; eg. POST /api2/json//nodes/pve/storage/local/upload Note the json// with the extra slash.
1 parent 5f3d496 commit 702dce8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

builder/proxmox/common/client.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package proxmox
66
import (
77
"crypto/tls"
88
"log"
9+
"strings"
910

1011
"github.com/Telmate/proxmox-api-go/proxmox"
1112
)
@@ -15,7 +16,7 @@ func newProxmoxClient(config Config) (*proxmox.Client, error) {
1516
InsecureSkipVerify: config.SkipCertValidation,
1617
}
1718

18-
client, err := proxmox.NewClient(config.proxmoxURL.String(), nil, "", tlsConfig, "", int(config.TaskTimeout.Seconds()))
19+
client, err := proxmox.NewClient(strings.TrimSuffix(config.proxmoxURL.String(), "/"), nil, "", tlsConfig, "", int(config.TaskTimeout.Seconds()))
1920
if err != nil {
2021
return nil, err
2122
}

0 commit comments

Comments
 (0)