summaryrefslogtreecommitdiffstats
path: root/git-interface/git-serve.py
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2015-06-11 14:26:47 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2015-06-11 14:32:21 +0200
commita45b5073cac989da084f1bdb44cac71b6c6a61a8 (patch)
tree94ac53a96efa457befb6606dcce22797359fae1d /git-interface/git-serve.py
parent2164750f1e951c6985b3f9c29663bf94d16553e7 (diff)
downloadaurweb-a45b5073cac989da084f1bdb44cac71b6c6a61a8.tar.xz
Implement a maintenance mode
Add support for a maintenance mode that disables both the website and the SSH interface and can be enabled easily using a configuration option. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'git-interface/git-serve.py')
-rwxr-xr-xgit-interface/git-serve.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/git-interface/git-serve.py b/git-interface/git-serve.py
index 9812acb..21b130c 100755
--- a/git-interface/git-serve.py
+++ b/git-interface/git-serve.py
@@ -21,6 +21,8 @@ repo_regex = config.get('serve', 'repo-regex')
git_shell_cmd = config.get('serve', 'git-shell-cmd')
ssh_cmdline = config.get('serve', 'ssh-cmdline')
+enable_maintenance = config.getboolean('options', 'enable-maintenance')
+
def pkgbase_exists(pkgbase):
db = mysql.connector.connect(host=aur_db_host, user=aur_db_user,
passwd=aur_db_pass, db=aur_db_name,
@@ -110,6 +112,9 @@ if not cmd:
cmdargv = shlex.split(cmd)
action = cmdargv[0]
+if enable_maintenance:
+ die("The AUR is down due to maintenance. We will be back soon.")
+
if action == 'git-upload-pack' or action == 'git-receive-pack':
if len(cmdargv) < 2:
die_with_help("%s: missing path" % (action))