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

Pif, Template and storage repository data source panics when there are multiple matches #66

Closed
ddelnano opened this issue Sep 21, 2020 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@ddelnano
Copy link
Collaborator

While trying to get the acceptance tests to run against the xo lab, I noticed that the pif data source panics during the acceptance tests.

panic: interface conversion: interface {} is []interface {}, not client.PIF

goroutine 33 [running]:
github.com/ddelnano/terraform-provider-xenorchestra/client.(*Client).GetPIFByDevice(0xc0004d4310, 0xc000036928, 0x4, 0xffffffffffffffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/ddelnano/go/src/github.com/ddelnano/terraform-provider-xenorchestra/client/pif.go:46 +0x200
github.com/ddelnano/terraform-provider-xenorchestra/xoa.dataSourcePIFRead(0xc00021e0e0, 0x1147ac0, 0xc000521800, 0xc00021e0e0, 0x0)
        /home/ddelnano/go/src/github.com/ddelnano/terraform-provider-xenorchestra/xoa/data_source_xenorchestra_pif.go:55 +0x1d5
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Resource).ReadDataApply(0xc0001262d0, 0xc0003291c0, 0x1147ac0, 0xc000521800, 0xc00011ca48, 0x1, 0x0)
        /home/ddelnano/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.15.0/helper/schema/resource.go:403 +0x88
github.com/hashicorp/terraform-plugin-sdk/helper/schema.(*Provider).ReadDataApply(0xc000154000, 0xc00009fad0, 0xc0003291c0, 0xc0003291c0, 0x0, 0x0)
        /home/ddelnano/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.15.0/helper/schema/provider.go:451 +0x8f
github.com/hashicorp/terraform-plugin-sdk/internal/helper/plugin.(*GRPCProviderServer).ReadDataSource(0xc0000cc018, 0x1546060, 0xc0006b4210, 0xc0006b6000, 0xc0000cc018, 0xc0006b4210, 0xc000061b78)
        /home/ddelnano/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.15.0/internal/helper/plugin/grpc_provider.go:1036 +0x45d
github.com/hashicorp/terraform-plugin-sdk/internal/tfplugin5._Provider_ReadDataSource_Handler(0x11f55c0, 0xc0000cc018, 0x1546060, 0xc0006b4210, 0xc0005bb380, 0x0, 0x1546060, 0xc0006b4210, 0xc0000e5920, 0x55)
        /home/ddelnano/go/pkg/mod/github.com/hashicorp/terraform-plugin-sdk@v1.15.0/internal/tfplugin5/tfplugin5.pb.go:3341 +0x217
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000f6180, 0x1552cc0, 0xc000506c00, 0xc00008c900, 0xc0001429c0, 0x1d709d0, 0x0, 0x0, 0x0)
        /home/ddelnano/go/pkg/mod/google.golang.org/grpc@v1.27.1/server.go:1024 +0x501
google.golang.org/grpc.(*Server).handleStream(0xc0000f6180, 0x1552cc0, 0xc000506c00, 0xc00008c900, 0x0)
        /home/ddelnano/go/pkg/mod/google.golang.org/grpc@v1.27.1/server.go:1313 +0xd3d
google.golang.org/grpc.(*Server).serveStreams.func1.1(0xc00019c2e0, 0xc0000f6180, 0x1552cc0, 0xc000506c00, 0xc00008c900)
        /home/ddelnano/go/pkg/mod/google.golang.org/grpc@v1.27.1/server.go:722 +0xa1
created by google.golang.org/grpc.(*Server).serveStreams.func1
        /home/ddelnano/go/pkg/mod/google.golang.org/grpc@v1.27.1/server.go:720 +0xa1
FAIL    github.com/ddelnano/terraform-provider-xenorchestra/xoa 1.282s
?       github.com/ddelnano/terraform-provider-xenorchestra/xoa/internal        [no test files]
FAIL

The data source should allow more fine grained filtering with network, pool or host information and also should never panic. I believe the storage repository data source also has this bug.

@ddelnano ddelnano added the bug Something isn't working label Sep 21, 2020
@ddelnano ddelnano added this to the M1 milestone Sep 21, 2020
@ddelnano ddelnano changed the title Pif and storage repository data source panics when there are multiple matches Pif, Template and storage repository data source panics when there are multiple matches Sep 30, 2020
ddelnano added a commit that referenced this issue Oct 15, 2020
* Pif, Template and storage repository data source panics when there are multiple matches (#66)
* Unify the pattern of retrieving XoObjects from the XO api (#52)
* Resolve PV driver issues with the terraform acceptance test VM template (#57)
* Test suite improvements to make it easy to run the tests against any XO deployment
@ddelnano
Copy link
Collaborator Author

This is fixed in v0.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant