diff options
author | Andy Doan <andy.doan@linaro.org> | 2015-04-27 12:05:35 -0500 |
---|---|---|
committer | Andy Doan <andy.doan@linaro.org> | 2015-04-27 12:05:35 -0500 |
commit | 76ae382768d69cd26f4a438f18603583058ac658 (patch) | |
tree | 497e14719a9902bc1d225eb6ab9201532b2861cf | |
parent | 5e22f20aa7ff36843c581d336d65423c39f6827c (diff) |
detect errors in create logic
The fact we miss errors from the ssh command were causing us to see tons
of error messages like:
fatal: internal server error
fatal: project "platform/frameworks/multidex" exists
fatal: project "platform/external/eclipse-basebuilder" exists
fatal: project "platform/external/safe-iop" exists
fatal: project "platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8"
exists
The only real error was not knowing what projects gerrit knew about.
This helps us exit when that happens so we can further debug if needed.
Change-Id: I3d41778abff1bc5c9f12753a24b0143c3a5dd2a1
-rwxr-xr-x | git-gerrit-mirror | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/git-gerrit-mirror b/git-gerrit-mirror index 4f003a5..2c5f17b 100755 --- a/git-gerrit-mirror +++ b/git-gerrit-mirror @@ -5,6 +5,7 @@ import time import optparse import logging import re +import subprocess import urllib import urlparse from xml.dom import minidom @@ -150,11 +151,9 @@ def get_gerrit_projects(gerrit_host): ssh_identity_option = get_ssh_identity_file_option() cmd = "ssh %s -p %s %s gerrit ls-projects" % ( ssh_identity_option, parts[1], parts[0]) - log.debug("Running: %s", cmd) - f = os.popen(cmd) - projects = [l.strip() for l in f] - f.close() - return projects + log.debug("Running command: %s", cmd) + return [x.strip() for x in + subprocess.check_output(cmd, shell=True).split('\n') if x] def get_url_project_list(url): f = urllib.urlopen(url) |