-
Notifications
You must be signed in to change notification settings - Fork 583
Image V2: cannot unmarshal string into Go struct field .images.tmp.Properties of type map[string]interface {} #3588
Copy link
Copy link
Description
What happened?
When user provide additional metadata to an image with a key properties, this will cause the unmarshal of Image struct broken.
To reproduce, create an image in glance, and add a property named properties
openstack image set <MY_IMAGE> --properties properties="anything, it can be {'hypervisor_type': 'qemu', 'architecture': 'x86_64'}"Then, use the sdk to list that image
package main
import (
"context"
"github.com/gophercloud/gophercloud/v2"
"github.com/gophercloud/gophercloud/v2/openstack"
"github.com/gophercloud/gophercloud/v2/openstack/image/v2/images"
)
func main() {
ctx := context.Background()
opts, err := openstack.AuthOptionsFromEnv()
if err != nil {
panic(err)
}
providerClient, err := openstack.AuthenticatedClient(ctx, opts)
if err != nil {
panic(err)
}
listOpts := images.ListOpts{
Name: "<MY_IMAGE>",
}
imageClient, err := openstack.NewImageV2(providerClient, gophercloud.EndpointOpts{})
if err != nil {
panic(err)
}
_, err := images.List(imageClient, listOpts).AllPages(ctx) # should failed here
if err != nil {
panic(err)
}
}Useful debugging information to help identify the issue:
openstack image show <MY_IMAGE> --debugNote the last RESP BODY from the debug output.
This is originally from canonical/openstack-exporter-operator#158
Version
v2 (current)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels