mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-25 13:29:22 -05:00
Fix bugs in upgrade script.
Handle the case when there are colons in server_name. Handle http exceptions more gracefully.
This commit is contained in:
parent
cb91ce5bba
commit
592ba14b36
@ -21,6 +21,7 @@ from syutil.jsonutil import encode_canonical_json
|
|||||||
import argparse
|
import argparse
|
||||||
import dns.resolver
|
import dns.resolver
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import httplib
|
||||||
import json
|
import json
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import syutil
|
import syutil
|
||||||
@ -150,7 +151,6 @@ def get_key(server_name):
|
|||||||
if ":" in server_name:
|
if ":" in server_name:
|
||||||
target, port = server_name.split(":")
|
target, port = server_name.split(":")
|
||||||
targets.append((target, int(port)))
|
targets.append((target, int(port)))
|
||||||
return
|
|
||||||
try:
|
try:
|
||||||
answers = dns.resolver.query("_matrix._tcp." + server_name, "SRV")
|
answers = dns.resolver.query("_matrix._tcp." + server_name, "SRV")
|
||||||
for srv in answers:
|
for srv in answers:
|
||||||
@ -176,6 +176,10 @@ def get_key(server_name):
|
|||||||
return verify_keys
|
return verify_keys
|
||||||
except urllib2.URLError:
|
except urllib2.URLError:
|
||||||
pass
|
pass
|
||||||
|
except urllib2.HTTPError:
|
||||||
|
pass
|
||||||
|
except httplib.HTTPException:
|
||||||
|
pass
|
||||||
|
|
||||||
print "Failed to get keys for %s" % (server_name,)
|
print "Failed to get keys for %s" % (server_name,)
|
||||||
return {}
|
return {}
|
||||||
|
Loading…
Reference in New Issue
Block a user