@@ -280,6 +280,26 @@ func (o *oracleOps) InspectInstance(instanceID string) (*cloudops.InstanceInfo,
280280 }, nil
281281}
282282
283+ func (o * oracleOps ) GetInstance (displayName string ) (interface {}, error ) {
284+ listInstanceReq := core.ListInstancesRequest {
285+ DisplayName : common .String (displayName ),
286+ CompartmentId : common .String (o .compartmentID ),
287+ }
288+
289+ listInstanceResp , err := o .compute .ListInstances (context .Background (), listInstanceReq )
290+ if err != nil {
291+ return nil , err
292+ }
293+ if len (listInstanceResp .Items ) == 0 {
294+ return nil , fmt .Errorf ("no oracle instance found with display name: %s" , displayName )
295+ }
296+ // Currently, torpedo uses this API to fetch details of the instance created
297+ // by OKE. OKE ensures that all the worker nodes created, have unique display
298+ // names. In future, if we require to use this API to get details of vanilla
299+ // compute instances, then we can modify below array indexing.
300+ return listInstanceResp .Items [0 ], nil
301+ }
302+
283303func (o * oracleOps ) InspectInstanceGroupForInstance (instanceID string ) (* cloudops.InstanceGroupInfo , error ) {
284304 getNodePoolReq := containerengine.GetNodePoolRequest {
285305 NodePoolId : & o .poolID ,
@@ -777,6 +797,10 @@ func (o *oracleOps) DeleteInstance(instanceID string, zone string, timeout time.
777797 }
778798 }
779799
800+ if nodePoolID == nil {
801+ return fmt .Errorf ("node pool containing instance [%s] not found" , instanceID )
802+ }
803+
780804 nodeDeleteReq := containerengine.DeleteNodeRequest {
781805 NodePoolId : nodePoolID ,
782806 NodeId : & instanceID ,
0 commit comments