1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-02 09:10:11 +02:00

more detailed error message and handling when fetching buildserverid in build.py

This commit is contained in:
Michael Pöhn 2018-06-27 01:05:45 +02:00 committed by Michael Pöhn
parent a5ef08f57d
commit c005d8c5f4

View File

@ -67,8 +67,8 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
try: try:
paramiko paramiko
except NameError: except NameError as e:
raise BuildException("Paramiko is required to use the buildserver") raise BuildException("Paramiko is required to use the buildserver") from e
if options.verbose: if options.verbose:
logging.getLogger("paramiko").setLevel(logging.INFO) logging.getLogger("paramiko").setLevel(logging.INFO)
else: else:
@ -79,11 +79,18 @@ def build_server(app, build, vcs, build_dir, output_dir, log_dir, force):
output = None output = None
try: try:
if not buildserverid: if not buildserverid:
buildserverid = subprocess.check_output(['vagrant', 'ssh', '-c', try:
'cat /home/vagrant/buildserverid'], buildserverid = subprocess.check_output(['vagrant', 'ssh', '-c',
cwd='builder').strip().decode() 'cat /home/vagrant/buildserverid'],
logging.debug(_('Fetched buildserverid from VM: {buildserverid}') cwd='builder').strip().decode()
.format(buildserverid=buildserverid)) logging.debug(_('Fetched buildserverid from VM: {buildserverid}')
.format(buildserverid=buildserverid))
except Exception as e:
if type(buildserverid) is not str or not re.match('^[0-9a-f]{40}$', buildserverid):
logging.info(subprocess.check_output(['vagrant', 'status'], cwd="builder"))
raise FDroidException("Could not obtain buildserverid from buldserver VM. "
"(stored inside the buildserver VM at '/home/vagrant/buildserverid') "
"Please reset your buildserver, the setup VM is broken.") from e
# Open SSH connection... # Open SSH connection...
logging.info("Connecting to virtual machine...") logging.info("Connecting to virtual machine...")
@ -1160,7 +1167,7 @@ def main():
net.download_file(url, local_filename=of) net.download_file(url, local_filename=of)
except requests.exceptions.HTTPError as e: except requests.exceptions.HTTPError as e:
raise FDroidException( raise FDroidException(
'Downloading Binaries from %s failed. %s' % (url, e)) 'Downloading Binaries from %s failed.' % url) from e
# Now we check whether the build can be verified to # Now we check whether the build can be verified to
# match the supplied binary or not. Should the # match the supplied binary or not. Should the