Skip to content

Commit

Permalink
Add error if image not found (#5730)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander-Kita authored Nov 5, 2024
1 parent 089214c commit 03caa9e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ github.com/IBM/container-registry-go-sdk v1.1.0 h1:sYyknIod8R4RJZQqAheiduP6wbSTp
github.com/IBM/container-registry-go-sdk v1.1.0/go.mod h1:4TwsCnQtVfZ4Vkapy/KPvQBKFc3VOyUZYkwRU4FTPrs=
github.com/IBM/continuous-delivery-go-sdk/v2 v2.0.2 h1:yCJJnSLNYkpF7v9n0tw8CpQbSy43E/NbFOopRf1PgoM=
github.com/IBM/continuous-delivery-go-sdk/v2 v2.0.2/go.mod h1:2MajFr6C5H2jyj7qtjBxAPnZAjbPiK4CAJNk3fKNnPo=
github.com/IBM/event-notifications-go-admin-sdk v0.10.0 h1:SbEG6Z9lJWQxNYexYmLRzF+seFokOW7bRKBgiyfYsls=
github.com/IBM/event-notifications-go-admin-sdk v0.10.0/go.mod h1:za2mdfBpox6hdsKaYTbE5ooCv2im8BYPq5yuKc7x5Ao=
github.com/IBM/event-notifications-go-admin-sdk v0.11.0 h1:X/GhBE6dGRx8s79xYrdmv88ljD/8hSCyh9jMSUPCcCc=
github.com/IBM/event-notifications-go-admin-sdk v0.11.0/go.mod h1:za2mdfBpox6hdsKaYTbE5ooCv2im8BYPq5yuKc7x5Ao=
github.com/IBM/eventstreams-go-sdk v1.4.0 h1:yS/Ns29sBOe8W2tynQmz9HTKqQZ0ckse4Py5Oy/F2rM=
Expand Down
6 changes: 5 additions & 1 deletion ibm/service/power/resource_ibm_pi_capture.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"log"
"strings"
"time"

st "github.com/IBM-Cloud/power-go-client/clients/instance"
Expand Down Expand Up @@ -196,7 +197,10 @@ func resourceIBMPICaptureCreate(ctx context.Context, d *schema.ResourceData, met
imageClient := st.NewIBMPIImageClient(ctx, sess, cloudInstanceID)
imagedata, err := imageClient.Get(capturename)
if err != nil {
log.Printf("Error on get of ibm pi capture (%s) while applying pi_user_tags: %s", capturename, err)
if strings.Contains(err.Error(), NotFound) {
d.SetId("")
}
return diag.Errorf("Error on get of ibm pi capture (%s) while applying pi_user_tags: %s", capturename, err)
}
if imagedata.Crn != "" {
oldList, newList := d.GetChange(Arg_UserTags)
Expand Down

0 comments on commit 03caa9e

Please sign in to comment.