File tree 11 files changed +44
-0
lines changed
11 files changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,10 @@ const insertCluster = `
62
62
// Insert into database
63
63
func (b * Backend ) InsertClusters (clusters []common.Cluster ) (err error ) {
64
64
65
+ if len (clusters ) == 0 {
66
+ return
67
+ }
68
+
65
69
// exit if there is no database connection
66
70
err = b .checkDB ()
67
71
if err != nil {
Original file line number Diff line number Diff line change @@ -32,6 +32,10 @@ const insertDatacenter = `
32
32
// InsertVMs inserts a vm into database
33
33
func (b * Backend ) InsertDatacenters (dcs []common.Datacenter ) (err error ) {
34
34
35
+ if len (dcs ) == 0 {
36
+ return
37
+ }
38
+
35
39
// exit if there is no database connection
36
40
err = b .checkDB ()
37
41
if err != nil {
Original file line number Diff line number Diff line change @@ -43,6 +43,10 @@ const insertDatastore = `
43
43
44
44
func (b * Backend ) InsertDatastores (dss []common.Datastore ) (err error ) {
45
45
46
+ if len (dss ) == 0 {
47
+ return
48
+ }
49
+
46
50
// exit if there is no database connection
47
51
err = b .checkDB ()
48
52
if err != nil {
Original file line number Diff line number Diff line change @@ -92,6 +92,10 @@ const insertEsxi = `
92
92
// Insert into database
93
93
func (b * Backend ) InsertEsxi (esxis []common.Esxi ) (err error ) {
94
94
95
+ if len (esxis ) == 0 {
96
+ return
97
+ }
98
+
95
99
// exit if there is no database connection
96
100
err = b .checkDB ()
97
101
if err != nil {
Original file line number Diff line number Diff line change @@ -42,6 +42,10 @@ const insertFolders = `
42
42
// Insert into database
43
43
func (b * Backend ) InsertFolders (folders []common.Folder ) (err error ) {
44
44
45
+ if len (folders ) == 0 {
46
+ return
47
+ }
48
+
45
49
// exit if there is no database connection
46
50
err = b .checkDB ()
47
51
if err != nil {
Original file line number Diff line number Diff line change @@ -38,6 +38,10 @@ const insertPortgroup = `
38
38
// Insert into database
39
39
func (b * Backend ) InsertPortgroups (portgroups []common.Portgroup ) (err error ) {
40
40
41
+ if len (portgroups ) == 0 {
42
+ return
43
+ }
44
+
41
45
// exit if there is no database connection
42
46
err = b .checkDB ()
43
47
if err != nil {
Original file line number Diff line number Diff line change @@ -64,6 +64,10 @@ const insertResourcepool = `
64
64
// Insert into database
65
65
func (b * Backend ) InsertResourcepools (resourcepools []common.ResourcePool ) (err error ) {
66
66
67
+ if len (resourcepools ) == 0 {
68
+ return
69
+ }
70
+
67
71
// exit if there is no database connection
68
72
err = b .checkDB ()
69
73
if err != nil {
Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ const insertVDisk = `
50
50
// Insert into database
51
51
func (b * Backend ) InsertVDisks (vdisks []common.VDisk ) (err error ) {
52
52
53
+ if len (vdisks ) == 0 {
54
+ return
55
+ }
56
+
53
57
// exit if there is no database connection
54
58
err = b .checkDB ()
55
59
if err != nil {
Original file line number Diff line number Diff line change @@ -98,6 +98,10 @@ const insertVm = `
98
98
// InsertVirtualmachines inserts a vm into database
99
99
func (b * Backend ) InsertVirtualmachines (vms []common.VirtualMachine ) (err error ) {
100
100
101
+ if len (vms ) == 0 {
102
+ return
103
+ }
104
+
101
105
// exit if there is no database connection
102
106
err = b .checkDB ()
103
107
if err != nil {
Original file line number Diff line number Diff line change @@ -44,6 +44,10 @@ const insertVNics = `
44
44
// Insert into database
45
45
func (b * Backend ) InsertVNics (vnics []common.VNic ) (err error ) {
46
46
47
+ if len (vnics ) == 0 {
48
+ return
49
+ }
50
+
47
51
// exit if there is no database connection
48
52
err = b .checkDB ()
49
53
if err != nil {
Original file line number Diff line number Diff line change @@ -67,6 +67,10 @@ const insertDVS = `
67
67
// Insert into database
68
68
func (b * Backend ) InsertVSwitch (vswitches []common.VSwitch ) (err error ) {
69
69
70
+ if len (vswitches ) == 0 {
71
+ return
72
+ }
73
+
70
74
// exit if there is no database connection
71
75
err = b .checkDB ()
72
76
if err != nil {
You can’t perform that action at this time.
0 commit comments