def delete_snapshot(request, snapshot_id): log.debug("delete_snapshot snapshot_id: %s", snapshot_id) snapshot = util.get_snapshot(request.user_uniq, snapshot_id) snapshots.delete(snapshot) return HttpResponse(status=202)
def delete_snapshot(request, snapshot_id): util.assert_snapshots_enabled(request) log.debug("User: %s, Snapshot: %s Action: delete", request.user_uniq, snapshot_id) snapshot = util.get_snapshot(request.user_uniq, snapshot_id) snapshots.delete(snapshot) log.info("User %s deleted snapshot %s", request.user_uniq, snapshot["id"]) return HttpResponse(status=202)
def delete_snapshot(request, snapshot_id): credentials = request.credentials util.assert_snapshots_enabled(request) log.debug("User: %s, Snapshot: %s Action: delete", credentials.userid, snapshot_id) snapshot = util.get_snapshot(credentials.userid, snapshot_id) snapshots.delete(snapshot) log.info("User %s deleted snapshot %s", credentials.userid, snapshot["id"]) return HttpResponse(status=202)
def handle(self, *args, **options): if not args: raise CommandError("Please provide a snapshot ID") force = options['force'] message = "snapshots" if len(args) > 1 else "snapshot" self.confirm_deletion(force, message, args) userid = options["user"] for snapshot_id in args: self.stdout.write("\n") try: snapshot = util.get_snapshot(userid, snapshot_id) snapshots.delete(snapshot) self.stdout.write("Successfully removed snapshot %s\n" % snapshot_id) except CommandError as e: self.stdout.write("Error -- %s\n" % e.message)