Make the build server and build worker slightly more robust to errors.

This commit is contained in:
yackob03 2013-10-29 18:15:12 -04:00
parent d3d593f7e1
commit 5e81f999d1
2 changed files with 5 additions and 3 deletions

View file

@ -124,7 +124,7 @@ def build_image(build_dir, tag_name, num_steps, result_object):
except Exception as e:
logger.exception('Exception when processing request.')
result_object['status'] = 'error'
result_object['message'] = e.message
result_object['message'] = str(e.message)
MIME_PROCESSORS = {

View file

@ -43,7 +43,7 @@ def retry_command(to_call, args=[], kwargs={}, retries=5, period=5):
def get_status(url):
return requests.get(url).json()['status']
return retry_command(requests.get, [url]).json()['status']
def babysit_builder(request):
@ -112,8 +112,10 @@ def babysit_builder(request):
ssh_client = paramiko.SSHClient()
ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
logger.debug('Connecting to droplet through ssh at ip: %s' %
droplet.ip_address)
retry_command(ssh_client.connect, [droplet.ip_address, 22, 'root'],
{'look_for_keys': False,
{'look_for_keys': False, 'timeout': 10.0,
'key_filename': app.config['DO_SSH_PRIVATE_KEY_FILENAME']})
# Load the node with the pull token