Merge "Prime github app install map on connection load" into feature/zuulv3
diff --git a/tests/base.py b/tests/base.py
index 2a2f164..4de9134 100755
--- a/tests/base.py
+++ b/tests/base.py
@@ -499,7 +499,7 @@
             "refUpdate": {
                 "oldRev": oldrev,
                 "newRev": repo.heads[branch].commit.hexsha,
-                "refName": branch,
+                "refName": 'refs/heads/' + branch,
                 "project": project,
             }
         }
diff --git a/tools/encrypt_secret.py b/tools/encrypt_secret.py
index df4f449..9b52846 100755
--- a/tools/encrypt_secret.py
+++ b/tools/encrypt_secret.py
@@ -86,7 +86,12 @@
         if p.returncode != 0:
             raise Exception("Return code %s from openssl" % p.returncode)
         output = stdout.decode('utf-8')
-        m = re.match(r'^Public-Key: \((\d+) bit\)$', output, re.MULTILINE)
+        openssl_version = subprocess.check_output(
+            ['openssl', 'version']).split()[1]
+        if openssl_version.startswith(b'0.'):
+            m = re.match(r'^Modulus \((\d+) bit\):$', output, re.MULTILINE)
+        else:
+            m = re.match(r'^Public-Key: \((\d+) bit\)$', output, re.MULTILINE)
         nbits = int(m.group(1))
         nbytes = int(nbits / 8)
         max_bytes = nbytes - 42  # PKCS1-OAEP overhead
diff --git a/zuul/driver/gerrit/gerritconnection.py b/zuul/driver/gerrit/gerritconnection.py
index 59051bb..f4b090d 100644
--- a/zuul/driver/gerrit/gerritconnection.py
+++ b/zuul/driver/gerrit/gerritconnection.py
@@ -125,7 +125,9 @@
         # This checks whether the event created or deleted a branch so
         # that Zuul may know to perform a reconfiguration on the
         # project.
-        if event.type == 'ref-updated' and not event.ref.startswith('refs/'):
+        if (event.type == 'ref-updated' and
+            ((not event.ref.startswith('refs/')) or
+             event.ref.startswith('refs/heads'))):
             if event.oldrev == '0' * 40:
                 event.branch_created = True
                 event.branch = event.ref