Skip to content

Commit cac2929

Browse files
committed
[new-git-repository] Remove IP address check for git.mysociety.org
We can't rely on the IP address for git.mysociety.org being bound to a local interface on the server hosting it any longer. For now this replaces the check with one that checks for the presence of `/data/git`, which isn't perfect but is better than nothing. Fixes #69
1 parent 4be6b06 commit cac2929

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

bin/new-git-repository

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,13 @@ import argparse
55
import json
66
import os
77
import requests
8-
import socket
98
from subprocess import check_call
109
import sys
1110

1211
def is_correct_server():
13-
git_ip = socket.gethostbyname('git.mysociety.org')
14-
15-
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
16-
s.connect(('46.43.39.78', 0)) # connecting to a UDP address doesn't send packets
17-
local_ip = s.getsockname()[0]
18-
19-
if git_ip != local_ip:
12+
if os.path.exists('/data/git'):
13+
return
14+
else:
2015
sys.exit("You can only run this on git.mysociety.org")
2116

2217
def parse_arguments():

0 commit comments

Comments
 (0)