@@ -251,14 +251,15 @@ func (c *client) findInstanceByNodeNameIsVnic(cache *cache.OCICache, nodeName st
251
251
return c .network .GetVnic (ctx , vnicRequest )
252
252
}()
253
253
if err != nil {
254
- log .Printf ("Error getting Vnic for attachment: %s(%v)" , * attachment . Id , err )
254
+ log .Printf ("Error getting Vnic for attachment: %s(%v)" , attachment , err )
255
255
continue
256
256
}
257
257
vnic = & vnicResponse .Vnic
258
258
cache .SetVnic (* attachment .VnicId , vnic )
259
259
}
260
- if * vnic .PublicIp == nodeName ||
261
- (* vnic .HostnameLabel != "" && strings .HasPrefix (nodeName , * vnic .HostnameLabel )) {
260
+ log .Printf ("Checking vnic:%s" , * vnic )
261
+ if (vnic .PublicIp != nil && * vnic .PublicIp == nodeName ) ||
262
+ (vnic .HostnameLabel != nil && (* vnic .HostnameLabel != "" && strings .HasPrefix (nodeName , * vnic .HostnameLabel ))) {
262
263
instanceRequest := core.GetInstanceRequest {
263
264
InstanceId : attachment .InstanceId ,
264
265
}
@@ -268,7 +269,7 @@ func (c *client) findInstanceByNodeNameIsVnic(cache *cache.OCICache, nodeName st
268
269
return c .compute .GetInstance (ctx , instanceRequest )
269
270
}()
270
271
if err != nil {
271
- log .Printf ("Error getting instance for attachment: %s" , * attachment . InstanceId )
272
+ log .Printf ("Error getting instance for attachment: %s" , attachment )
272
273
return nil , err
273
274
}
274
275
instance := instanceResponse .Instance
@@ -344,6 +345,7 @@ func getCacheDirectory() string {
344
345
// GetInstanceByNodeName retrieves the corresponding core.Instance or a
345
346
// SearchError if no instance matching the node name is found.
346
347
func (c * client ) GetInstanceByNodeName (nodeName string ) (* core.Instance , error ) {
348
+ log .Printf ("GetInstanceByNodeName:%s" , nodeName )
347
349
ociCache , err := cache .Open (fmt .Sprintf ("%s/%s" , getCacheDirectory (), "nodenamecache.json" ))
348
350
if err != nil {
349
351
return nil , err
0 commit comments