Skip to content

Commit 1312750

Browse files
committed
Delete device if provisioning goes wrong
1 parent e9e0e93 commit 1312750

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: command/device/create.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ func Create(params *CreateParams) (string, error) {
6868
id: devID}
6969
err = prov.run()
7070
if err != nil {
71-
// TODO: delete the device on iot cloud
71+
// TODO: retry to delete the device if it returns an error.
72+
// In alternative: encapsulate also this error.
73+
iotClient.DeleteDevice(devID)
7274
err = fmt.Errorf("%s: %w", "cannot provision device", err)
7375
return "", err
7476
}

0 commit comments

Comments
 (0)