Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Give callers an easy way to extract both the plugin version and the dependency versions. With this commit: $ ./terraform-provider-libvirt -version ./terraform-provider-libvirt 48adac3-dirty Compiled against library: libvirt 3.9.0 Using library: libvirt 3.9.0 Running hypervisor: QEMU 2.9.0 Running against daemon: 3.9.0 The details are very similar to: $ virsh version --daemon Compiled against library: libvirt 3.9.0 Using library: libvirt 3.9.0 Using API: QEMU 3.9.0 Running hypervisor: QEMU 2.9.0 Running against daemon: 3.9.0 except the Go bindings do not currently expose the API version [1]. I've submitted a patch to libvirt-go adding ParseVersion there. But until then, carrying our own parseVersion shouldn't be too much trouble. Passing an empty string to NewConnect ends up passing a nil pointer through to virConnect [2], which will give us libvirt's internal default URI logic [3,4]. I hunted around for a way to expose the version information in Terraform. Currently: $ cat main.tf provider "libvirt" { uri = "qemu:///system" } $ terraform version Terraform v0.11.8 + provider.libvirt (unversioned) but the RPC API is not particularly clear to me, and the versions there may be extracted from plugin filenames and not from RPC calls. [1]: https://libvirt.org/git/?p=libvirt-go.git;a=blob;f=connect.go;h=8cc7cc771f7d258400175df47fcc8b3779ef4930;hb=9c5bdce3c18faad94cb383e7ec42f5122a8c7fa1#l313 [2]: https://libvirt.org/git/?p=libvirt-go.git;a=blob;f=connect.go;h=8cc7cc771f7d258400175df47fcc8b3779ef4930;hb=9c5bdce3c18faad94cb383e7ec42f5122a8c7fa1#l322 [3]: https://libvirt.org/html/libvirt-libvirt-host.html#virConnectOpen [4]: https://libvirt.org/uri.html#URI_default
- Loading branch information