Skip to content
This repository has been archived by the owner on Nov 22, 2017. It is now read-only.

Commit

Permalink
Handlers do not guarantee a numeric exit code; work around it (#96)
Browse files Browse the repository at this point in the history

We currently don't have a safe guard for handlers to have a numeric exit code but they can return None.

In this patch we work around it until we can fix it.
  • Loading branch information
armenzg committed Jun 30, 2016
1 parent dc1ae23 commit 6e23988
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pulse_actions/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,6 @@ def end_request(exit_code, data, log_path, treeherder_job, start_time):
url = S3_UPLOADER.upload(log_path)
LOG.debug('Log uploaded to {}'.format(url))

# XXX: Do something more elegant
if exit_code is None:
exit_code = 0

JOB_FACTORY.submit_completed(
job=treeherder_job,
result=EXIT_CODE_JOB_RESULT_MAP[exit_code],
Expand Down Expand Up @@ -336,6 +332,10 @@ def _ignore_hack(data):
exit_code = handler(data=data, message=message, repo_name=repo_name,
revision=revision, **kwargs)

# XXX: Until handlers can guarantee an exit_code
if exit_code is None:
exit_code = 0

# 3) Submit results to Treeherder
end_request(exit_code=exit_code, data=data, **end_request_kwargs)

Expand Down

0 comments on commit 6e23988

Please sign in to comment.