summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-12-16 14:07:05 +0000
committerErik Johnston <erik@matrix.org>2014-12-16 14:07:05 +0000
commit592ba14b36bca88aa4517aa4885f89a706cc3b06 (patch)
tree32c6c18e2e142af69e6e9b617e30785b5cc03cc0 /scripts
parentRename upgrade script (diff)
downloadsynapse-592ba14b36bca88aa4517aa4885f89a706cc3b06.tar.xz
Fix bugs in upgrade script.
Handle the case when there are colons in server_name. Handle http
exceptions more gracefully.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/upgrade_db_to_v0.6.0.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/upgrade_db_to_v0.6.0.py b/scripts/upgrade_db_to_v0.6.0.py
index 5f6fa3a5aa..8f371bb4bb 100644
--- a/scripts/upgrade_db_to_v0.6.0.py
+++ b/scripts/upgrade_db_to_v0.6.0.py
@@ -21,6 +21,7 @@ from syutil.jsonutil import encode_canonical_json
 import argparse
 import dns.resolver
 import hashlib
+import httplib
 import json
 import sqlite3
 import syutil
@@ -150,7 +151,6 @@ def get_key(server_name):
     if ":" in server_name:
         target, port = server_name.split(":")
         targets.append((target, int(port)))
-        return
     try:
         answers = dns.resolver.query("_matrix._tcp." + server_name, "SRV")
         for srv in answers:
@@ -176,6 +176,10 @@ def get_key(server_name):
             return verify_keys
         except urllib2.URLError:
             pass
+        except urllib2.HTTPError:
+            pass
+        except httplib.HTTPException:
+            pass
 
     print "Failed to get keys for %s" % (server_name,)
     return {}