@@ -40,6 +40,11 @@ const (
40
40
providerSpecificInfobloxPtrRecord = "infoblox-ptr-record-exists"
41
41
)
42
42
43
+ func isNotFoundError (err error ) bool {
44
+ _ , ok := err .(* ibclient.NotFoundError )
45
+ return ok
46
+ }
47
+
43
48
// InfobloxConfig clarifies the method signature
44
49
type InfobloxConfig struct {
45
50
DomainFilter endpoint.DomainFilter
@@ -175,7 +180,7 @@ func (p *InfobloxProvider) Records(ctx context.Context) (endpoints []*endpoint.E
175
180
objA .View = p .view
176
181
objA .Zone = zone .Fqdn
177
182
err = p .client .GetObject (objA , "" , ibclient .NewQueryParams (false , nil ), & resA )
178
- if err != nil {
183
+ if err != nil && ! isNotFoundError ( err ) {
179
184
return nil , fmt .Errorf ("could not fetch A records from zone '%s': %s" , zone .Fqdn , err )
180
185
}
181
186
for _ , res := range resA {
@@ -208,7 +213,7 @@ func (p *InfobloxProvider) Records(ctx context.Context) (endpoints []*endpoint.E
208
213
objH .View = p .view
209
214
objH .Zone = zone .Fqdn
210
215
err = p .client .GetObject (objH , "" , ibclient .NewQueryParams (false , nil ), & resH )
211
- if err != nil {
216
+ if err != nil && ! isNotFoundError ( err ) {
212
217
return nil , fmt .Errorf ("could not fetch host records from zone '%s': %s" , zone .Fqdn , err )
213
218
}
214
219
for _ , res := range resH {
@@ -230,7 +235,7 @@ func (p *InfobloxProvider) Records(ctx context.Context) (endpoints []*endpoint.E
230
235
objC .View = p .view
231
236
objC .Zone = zone .Fqdn
232
237
err = p .client .GetObject (objC , "" , ibclient .NewQueryParams (false , nil ), & resC )
233
- if err != nil {
238
+ if err != nil && ! isNotFoundError ( err ) {
234
239
return nil , fmt .Errorf ("could not fetch CNAME records from zone '%s': %s" , zone .Fqdn , err )
235
240
}
236
241
for _ , res := range resC {
@@ -249,7 +254,7 @@ func (p *InfobloxProvider) Records(ctx context.Context) (endpoints []*endpoint.E
249
254
objP .Zone = arpaZone
250
255
objP .View = p .view
251
256
err = p .client .GetObject (objP , "" , ibclient .NewQueryParams (false , nil ), & resP )
252
- if err != nil {
257
+ if err != nil && ! isNotFoundError ( err ) {
253
258
return nil , fmt .Errorf ("could not fetch PTR records from zone '%s': %s" , zone .Fqdn , err )
254
259
}
255
260
for _ , res := range resP {
@@ -266,7 +271,7 @@ func (p *InfobloxProvider) Records(ctx context.Context) (endpoints []*endpoint.E
266
271
},
267
272
)
268
273
err = p .client .GetObject (objT , "" , ibclient .NewQueryParams (false , nil ), & resT )
269
- if err != nil {
274
+ if err != nil && ! isNotFoundError ( err ) {
270
275
return nil , fmt .Errorf ("could not fetch TXT records from zone '%s': %s" , zone .Fqdn , err )
271
276
}
272
277
for _ , res := range resT {
@@ -366,8 +371,7 @@ func (p *InfobloxProvider) zones() ([]ibclient.ZoneAuth, error) {
366
371
},
367
372
)
368
373
err := p .client .GetObject (obj , "" , ibclient .NewQueryParams (false , nil ), & res )
369
-
370
- if err != nil {
374
+ if err != nil && ! isNotFoundError (err ) {
371
375
return nil , err
372
376
}
373
377
@@ -480,7 +484,7 @@ func (p *InfobloxProvider) recordSet(ep *endpoint.Endpoint, getObject bool, targ
480
484
obj .View = p .view
481
485
if getObject {
482
486
err = p .client .GetObject (obj , "" , ibclient .NewQueryParams (false , nil ), & res )
483
- if err != nil {
487
+ if err != nil && ! isNotFoundError ( err ) {
484
488
return
485
489
}
486
490
}
@@ -496,7 +500,7 @@ func (p *InfobloxProvider) recordSet(ep *endpoint.Endpoint, getObject bool, targ
496
500
obj .View = p .view
497
501
if getObject {
498
502
err = p .client .GetObject (obj , "" , ibclient .NewQueryParams (false , nil ), & res )
499
- if err != nil {
503
+ if err != nil && ! isNotFoundError ( err ) {
500
504
return
501
505
}
502
506
}
@@ -512,7 +516,7 @@ func (p *InfobloxProvider) recordSet(ep *endpoint.Endpoint, getObject bool, targ
512
516
obj .View = p .view
513
517
if getObject {
514
518
err = p .client .GetObject (obj , "" , ibclient .NewQueryParams (false , nil ), & res )
515
- if err != nil {
519
+ if err != nil && ! isNotFoundError ( err ) {
516
520
return
517
521
}
518
522
}
@@ -536,7 +540,7 @@ func (p *InfobloxProvider) recordSet(ep *endpoint.Endpoint, getObject bool, targ
536
540
)
537
541
if getObject {
538
542
err = p .client .GetObject (obj , "" , ibclient .NewQueryParams (false , nil ), & res )
539
- if err != nil {
543
+ if err != nil && ! isNotFoundError ( err ) {
540
544
return
541
545
}
542
546
}
0 commit comments