Skip to content

Commit

Permalink
Strip trailing / from proxmox url
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nick-holmquist authored and lbajolet-hashicorp committed Nov 7, 2023
1 parent 5f3d496 commit 702dce8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builder/proxmox/common/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package proxmox
import (
"crypto/tls"
"log"
"strings"

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

client, err := proxmox.NewClient(config.proxmoxURL.String(), nil, "", tlsConfig, "", int(config.TaskTimeout.Seconds()))
client, err := proxmox.NewClient(strings.TrimSuffix(config.proxmoxURL.String(), "/"), nil, "", tlsConfig, "", int(config.TaskTimeout.Seconds()))
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 702dce8

Please sign in to comment.