[sysadmin-bin] The github mirror sync script should only run when allowed_paths is matched, also adjust the DOAP fi
- From: Andrea Veri <av src gnome org>
- To: gnome-sysadmin gnome org,commits-list gnome org
- Subject: [sysadmin-bin] The github mirror sync script should only run when allowed_paths is matched, also adjust the DOAP fi
- Date: Mon, 4 Sep 2017 12:45:33 +0000 (UTC)
commit c45446eabd4746aa89a9bdfb1cb00aa6f76d405a
Author: Andrea Veri <averi redhat com>
Date: Mon Sep 4 14:45:24 2017 +0200
The github mirror sync script should only run when allowed_paths is matched, also adjust the DOAP file
location when gitlab.g.o is the target
git/post-receive-mirror-github | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/git/post-receive-mirror-github b/git/post-receive-mirror-github
index 905487f..e55bb18 100755
--- a/git/post-receive-mirror-github
+++ b/git/post-receive-mirror-github
@@ -39,6 +39,7 @@ import smtplib
from email.mime.text import MIMEText
import tempfile
import json
+import socket
ORGANIZATION="GNOME"
name_maps = {"gtk+": "gtk",
@@ -46,6 +47,10 @@ name_maps = {"gtk+": "gtk",
class GitHub:
def __init__ (self):
+ allowed_paths = ['/var/opt/gitlab/git-data/repositories/GNOME', '/git']
+ if os.path.dirname(os.getcwd()) not in allowed_paths:
+ sys.exit(1)
+
config = ConfigParser.ConfigParser()
try:
config.read(os.path.expanduser('/etc/gitmirrorrc'))
@@ -102,7 +107,11 @@ def get_repo_name ():
def get_repo_settings (repo_name):
nss = {'doap': 'http://usefulinc.com/ns/doap#',
'rdf': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'}
- doap_url = "https://git.gnome.org/browse/%s/plain/%s.doap" % (repo_name, repo_name)
+
+ if socket.gethostname() == 'gitlab.gnome.org':
+ doap_url = 'https://gitlab.gnome.org/GNOME/%s/raw/master/%s.doap' % (repo_name, repo_name)
+ else:
+ doap_url = "https://git.gnome.org/browse/%s/plain/%s.doap" % (repo_name, repo_name)
rq = requests.get(doap_url)
if rq.status_code != 200:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]