blob: d84366acb2884a1f6899d639d0b51a058d2ca8ac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package main
import (
"github.com/dmacvicar/terraform-provider-libvirt/libvirt"
"github.com/hashicorp/terraform/plugin"
"log"
"math/rand"
"time"
)
func main() {
defer func() {
if libvirt.LibvirtClient != nil {
alive, err := libvirt.LibvirtClient.IsAlive()
if err != nil {
log.Printf("[ERROR] cannot determine libvirt connection status: %v", err)
}
if alive {
ret, err := libvirt.LibvirtClient.Close()
if err != nil {
log.Printf("[ERROR] cannot close libvirt connection %d - %v", ret, err)
} else {
libvirt.LibvirtClient = nil
}
}
}
}()
plugin.Serve(&plugin.ServeOpts{
ProviderFunc: libvirt.Provider,
})
}
func init() {
rand.Seed(time.Now().UTC().UnixNano())
}
|