From a131270811ec865473c33ff115e70d08ea9da43f Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Fri, 15 May 2020 11:38:04 -0400 Subject: [PATCH] mantle/ore: gcloud: fix error detection for deprecate-image Previously we weren't checking the error from "pending". Let's do that now because we can miss actual errors from the gcloud API otherwise. --- mantle/cmd/ore/gcloud/deprecate-image.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mantle/cmd/ore/gcloud/deprecate-image.go b/mantle/cmd/ore/gcloud/deprecate-image.go index 99ff607835..e81446fc6b 100644 --- a/mantle/cmd/ore/gcloud/deprecate-image.go +++ b/mantle/cmd/ore/gcloud/deprecate-image.go @@ -67,8 +67,11 @@ func runDeprecateImage(cmd *cobra.Command, args []string) { plog.Debugf("Attempting to change GCP image deprecation state of %s to %s\n", deprecateImageName, deprecateImageState) - _, err := api.DeprecateImage(deprecateImageName, + pending, err := api.DeprecateImage(deprecateImageName, gcloud.DeprecationState(deprecateImageState), deprecateImageReplacement) + if err == nil { + err = pending.Wait() + } if err != nil { plog.Fatalf("Changing deprecation state of image failed: %v\n", err) }