From 6448642477851d3dc7d34e0d11e95cfb5872a39f Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Thu, 1 Sep 2016 17:14:42 +0200 Subject: [PATCH] Return 503 for PUT/DELETE during user migration --- lib/remote_storage/swift.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/remote_storage/swift.rb b/lib/remote_storage/swift.rb index 59e23e7..3c5bb12 100644 --- a/lib/remote_storage/swift.rb +++ b/lib/remote_storage/swift.rb @@ -20,6 +20,10 @@ module RemoteStorage def authorize_request(user, directory, token, listing=false) request_method = server.env["REQUEST_METHOD"] + if request_method.match(/PUT|DELETE/) && redis.sismember("migration_in_progress", user) + server.halt 503, "Down for maintenance. Back soon!" + end + if directory.split("/").first == "public" return true if ["GET", "HEAD"].include?(request_method) && !listing end