@@ -164,14 +164,9 @@ func (c *client) WaitForVolumeAttached(volumeAttachmentId string) (core.VolumeAt
164164func (c * client ) FindVolumeAttachment (volumeId string ) (core.VolumeAttachment , error ) {
165165 var page * string
166166
167- vcnCompartment , err := c .getVCNCompartment ()
168- if err != nil {
169- return nil , err
170- }
171-
172167 for {
173168 request := core.ListVolumeAttachmentsRequest {
174- CompartmentId : vcnCompartment ,
169+ CompartmentId : common . String ( c . config . Auth . CompartmentOCID ) ,
175170 Page : page ,
176171 VolumeId : & volumeId ,
177172 }
@@ -258,14 +253,14 @@ func (c *client) isVnicAttachmentInSubnets(vnicAttachment *core.VnicAttachment,
258253// I'm leaving the DNS lookup till later as the options below fix the OKE issue
259254// 2) see if the nodename is equal to the hostname label
260255// 3) see if the nodename is an IP
261- func (c * client ) findInstanceByNodeNameIsVNIC (cache * cache.OCICache , nodeName string , compartment * string ) (* core.Instance , error ) {
262- subnets , err := c .getAllSubnetsForVCN (compartment )
256+ func (c * client ) findInstanceByNodeNameIsVNIC (cache * cache.OCICache , nodeName string , compartment * string , vcnCompartment * string ) (* core.Instance , error ) {
257+ subnets , err := c .getAllSubnetsForVCN (vcnCompartment )
263258 if err != nil {
264- log .Printf ("Error getting subnets for VCN: %s" , c . config . Auth . VcnOCID )
259+ log .Printf ("Error getting subnets for VCN: %s" , * vcnCompartment )
265260 return nil , err
266261 }
267262 if len (* subnets ) == 0 {
268- return nil , fmt .Errorf ("no subnets defined for VCN: %s" , c . config . Auth . VcnOCID )
263+ return nil , fmt .Errorf ("no subnets defined for VCN: %s" , * vcnCompartment )
269264 }
270265
271266 var running []core.Instance
@@ -407,10 +402,10 @@ func (c *client) GetInstanceByNodeName(nodeName string) (*core.Instance, error)
407402 }
408403
409404 // Cache lookup failed so time to refill the cache
410- instance , err := c .findInstanceByNodeNameIsDisplayName (nodeName , vcnCompartment )
405+ instance , err := c .findInstanceByNodeNameIsDisplayName (nodeName , common . String ( c . config . Auth . CompartmentOCID ) )
411406 if err != nil {
412407 log .Printf ("Unable to find OCI instance by displayname trying hostname/public ip" )
413- instance , err = c .findInstanceByNodeNameIsVNIC (ociCache , nodeName , vcnCompartment )
408+ instance , err = c .findInstanceByNodeNameIsVNIC (ociCache , nodeName , common . String ( c . config . Auth . CompartmentOCID ), vcnCompartment )
414409 if err != nil {
415410 log .Printf ("Unable to find OCI instance by hostname/displayname" )
416411 }
0 commit comments