Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unmarshalling error in "openstack/db/v1/flavors" package #2778

Open
CupaState opened this issue Sep 19, 2023 · 2 comments
Open

Unmarshalling error in "openstack/db/v1/flavors" package #2778

CupaState opened this issue Sep 19, 2023 · 2 comments

Comments

@CupaState
Copy link

`flavorDB "github.com/gophercloud/gophercloud/openstack/db/v1/flavors"`

func (m *OpenstackManager) GetFlavorList() ([]flavors.Flavor, error) {
	var flavorList []flavors.Flavor

	err := flavorDB.List(m.computeServiceClient).EachPage(func(p pagination.Page) (bool, error) {
                log.Println("Execution will not reach this point")
		
                fList, err := flavors.ExtractFlavors(p)
		if err != nil {
			return false, err
		}

		flavorList = append(flavorList, fList...)

		return true, nil
	})

	if err != nil {
		return nil, err
	}

	return flavorList, nil
}

I`m getting an error in EachPage function and right away.
Error message: json: cannot unmarshal string into Go struct field Flavor.flavors.id of type int

@github-actions
Copy link

Thank you for reporting your first issue! Be sure that we will be looking at it, but keep in mind
this sometimes takes a while.
Please let the maintainers know if your issue has not got enough attention after a few days.
If any doubt, please consult our issue tutorial.

@kayrus
Copy link
Contributor

kayrus commented Sep 19, 2023

@CupaState thanks for reporting an issue. could you please provide a JSON output of the flavors list? i.e.

$ export OS_AUTH_TOKEN="$(openstack token issue -f value -c id)"
$ curl -s http://db/v1/flavors  -H "X-Auth-Token: ${OS_AUTH_TOKEN}" | jq -r

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants