@@ -251,14 +251,14 @@ 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
+ if ( vnic . PublicIp != nil && * vnic .PublicIp == nodeName ) ||
261
+ (vnic . HostnameLabel != nil && ( * vnic .HostnameLabel != "" && strings .HasPrefix (nodeName , * vnic .HostnameLabel ) )) {
262
262
instanceRequest := core.GetInstanceRequest {
263
263
InstanceId : attachment .InstanceId ,
264
264
}
@@ -268,7 +268,7 @@ func (c *client) findInstanceByNodeNameIsVnic(cache *cache.OCICache, nodeName st
268
268
return c .compute .GetInstance (ctx , instanceRequest )
269
269
}()
270
270
if err != nil {
271
- log .Printf ("Error getting instance for attachment: %s" , * attachment . InstanceId )
271
+ log .Printf ("Error getting instance for attachment: %s" , attachment )
272
272
return nil , err
273
273
}
274
274
instance := instanceResponse .Instance
@@ -344,6 +344,7 @@ func getCacheDirectory() string {
344
344
// GetInstanceByNodeName retrieves the corresponding core.Instance or a
345
345
// SearchError if no instance matching the node name is found.
346
346
func (c * client ) GetInstanceByNodeName (nodeName string ) (* core.Instance , error ) {
347
+ log .Printf ("GetInstanceByNodeName:%s" , nodeName )
347
348
ociCache , err := cache .Open (fmt .Sprintf ("%s/%s" , getCacheDirectory (), "nodenamecache.json" ))
348
349
if err != nil {
349
350
return nil , err
0 commit comments