feat(main): add info logs for base events
This commit is contained in:
parent
3fefac0350
commit
ac327d5677
@ -92,7 +92,7 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
_, _, err = ctx.DoContext.CreateSnapshot(&godo.SnapshotCreateRequest{
|
snapshot, _, err := ctx.DoContext.CreateSnapshot(&godo.SnapshotCreateRequest{
|
||||||
VolumeID: volume.ID,
|
VolumeID: volume.ID,
|
||||||
Name: time.Now().Format("2006-01-02T15:04:05"),
|
Name: time.Now().Format("2006-01-02T15:04:05"),
|
||||||
})
|
})
|
||||||
@ -101,6 +101,8 @@ func main() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Info(fmt.Sprintf("Created Snapshot with Id %s from volume %s", snapshot.ID, volume.Name))
|
||||||
|
|
||||||
snapshots, _, err := ctx.DoContext.ListSnapshots(volume.ID, nil)
|
snapshots, _, err := ctx.DoContext.ListSnapshots(volume.ID, nil)
|
||||||
|
|
||||||
snapshotLength := len(snapshots)
|
snapshotLength := len(snapshots)
|
||||||
@ -123,12 +125,14 @@ func main() {
|
|||||||
snapshotsToDelete := snapshotLength - snapshotCount
|
snapshotsToDelete := snapshotLength - snapshotCount
|
||||||
|
|
||||||
for i := 0; i < snapshotsToDelete; i++ {
|
for i := 0; i < snapshotsToDelete; i++ {
|
||||||
_, err := ctx.DoContext.DeleteSnapshot(snapshots[i].ID)
|
snapshotToDeleteID := snapshots[i].ID
|
||||||
|
_, err := ctx.DoContext.DeleteSnapshot(snapshotToDeleteID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
handleError(ctx, err, false)
|
handleError(ctx, err, false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Info(fmt.Sprintf("Deleted Snapshot with Id %s", snapshotToDeleteID))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user