Skip to content

Commit

Permalink
gcp-iot-setup: Report error from device creation, not deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
rojer committed Jan 16, 2020
1 parent 451940c commit 49ca459
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cli/gcp/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ func GCPIoTSetup(ctx context.Context, devConn dev.DevConn) error {
}
resp, err := iotAPIClient.Projects.Locations.Registries.Devices.Create(parent, &device).Do()
if err != nil {
glog.Infof("Error creating device: %s %#v", err, resp)
glog.Errorf("Error creating device: %s %#v", err, resp)
ourutil.Reportf("Trying to delete the device...")
dev := fmt.Sprintf("%s/devices/%s", parent, devID)
_, err = iotAPIClient.Projects.Locations.Registries.Devices.Delete(dev).Do()
if err != nil {
_, err1 := iotAPIClient.Projects.Locations.Registries.Devices.Delete(dev).Do()
if err1 != nil {
return errors.Annotatef(err, "failed to re-create device")
}
ourutil.Reportf("Retrying device creation...")
Expand Down

0 comments on commit 49ca459

Please sign in to comment.