joernott / go-proxmox

Proxmox API in golang
BSD 3-Clause "New" or "Revised" License
26 stars 15 forks source link

unexpected end of JSON input #2

Closed prologic closed 8 years ago

prologic commented 8 years ago

I'm trying to use your library to write a docker-machine proxmox driver and wrote a very simple test to see if the basics work:

package main

import (
    "fmt"
    "github.com/joernott/go-proxmox"
    "log"
)

func main() {
    proxmox, err := proxmox.NewProxMox("192.168.0.100", "root", "xxx")
    if err != nil {
        log.Fatal(err)
    }

    nodes, err := proxmox.Nodes()
    if err != nil {
        log.Print("Error listing nodes")
        log.Fatal(err)
    }
    for node := range nodes {
        fmt.Println(node)
    }
}

This doesn't work against Proxmox VE 4.1:

$ ./nodes
2016/07/04 13:42:24 Error listing nodes
2016/07/04 13:42:24 unexpected end of JSON input```
prologic commented 8 years ago

After much debugging turned out the Hostname parameter needs to match the name of the node you are accessing! Who knew :) I kept getting 401 No ticket. Good thing I have proper DNS. Sorry for the noise!