Skip to content

Commit

Permalink
Delete before creating new snaps (#84)
Browse files Browse the repository at this point in the history
according to the docs https://cloud.google.com/compute/docs/disks/restore-and-delete-snapshots#deleting_snapshot this would be slightly more correct since instead of gcp handling the magic of references, we can allow the newly created snapshot to reference the right parent
  • Loading branch information
dvdliao authored and jacksegal committed Jan 7, 2019
1 parent 4ef1300 commit 748afb5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gcloud-snapshot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,12 @@ main()

# build snapshot name
local snapshot_name=$(createSnapshotName ${PREFIX} ${device_name} ${DATE_TIME})

# delete snapshots for this disk that were created older than DELETION_DATE
deleteSnapshots "$PREFIX-.*" "$DELETION_DATE" "${device_id}"

# create the snapshot
createSnapshot ${device_name} ${snapshot_name} ${device_zone}

# delete snapshots for this disk that were created older than DELETION_DATE
deleteSnapshots "$PREFIX-.*" "$DELETION_DATE" "${device_id}"
done

logTime "End of google-compute-snapshot"
Expand Down

0 comments on commit 748afb5

Please sign in to comment.