Bug 1273231 - Remove ability to set job log parse status via a web api

They were never used externally and just complicate things. If this is
ever needed we can always provide an improved interface for people
to use.
This commit is contained in:
William Lachance 2016-05-24 12:49:19 -04:00
Родитель eaf242ad03
Коммит 3547055561
4 изменённых файлов: 3 добавлений и 43 удалений

Просмотреть файл

@ -1,15 +0,0 @@
import pytest
from webtest.app import AppError
from treeherder.client import TreeherderClient
def test_update_parse_status_nonexistent_id(test_project, mock_post_json):
"""
Attempting to update the parse status for a non-existent log should return a 404.
"""
client = TreeherderClient(protocol='http', host='localhost')
non_existent_id = 9999999
with pytest.raises(AppError) as e:
client.update_parse_status(test_project, non_existent_id, 'parsed')
assert "404 NOT FOUND" in str(e.value)

Просмотреть файл

@ -605,7 +605,6 @@ class TreeherderClient(object):
'User-Agent': 'treeherder-pyclient/{}'.format(__version__),
}
UPDATE_ENDPOINT = 'job-log-url/{}/update_parse_status'
RESULTSET_ENDPOINT = 'resultset'
JOBS_ENDPOINT = 'jobs'
JOB_LOG_URL_ENDPOINT = 'job-log-url'
@ -928,18 +927,6 @@ class TreeherderClient(object):
return self._post_json(project, collection_inst.endpoint_base,
collection_inst.get_collection_data(), timeout)
def update_parse_status(self, project, job_log_url_id, parse_status, timeout=None):
"""
Updates the parsing status of a treeherder job
:param project: project to submit data for
:param parse_status: string representing parse status of a treeherder
job
:param timeout: custom timeout in seconds (defaults to class timeout)
"""
self._post_json(project, self.UPDATE_ENDPOINT.format(job_log_url_id),
{'parse_status': parse_status}, timeout)
class TreeherderClientError(Exception):
def __init__(self, msg, Errors):

Просмотреть файл

@ -74,7 +74,9 @@ def post_log_artifacts(project,
artifact_list = extract_artifacts_cb(project, log_obj['url'],
job_guid)
except Exception as e:
client.update_parse_status(project, log_obj['id'], 'failed')
with JobsModel(project) as jm:
jm.update_job_log_url_status(log_obj["id"], "failed")
# unrecoverable http error (doesn't exist or permission denied)
# (apparently this can happen somewhat often with taskcluster if
# the job fails, so just warn about it -- see

Просмотреть файл

@ -46,20 +46,6 @@ class JobLogUrlViewSet(viewsets.ViewSet):
return Response(job_log_url_list)
@detail_route(methods=['post'])
@with_jobs
def update_parse_status(self, request, project, jm, pk=None):
"""
Change the log parsing status for a log reference (eg from 'pending' to 'parsed').
"""
try:
parse_status = request.data["parse_status"]
except KeyError:
raise ParseError(detail=("The parse_status parameter is mandatory for this endpoint"))
jm.update_job_log_url_status(pk, parse_status)
obj = jm.get_job_log_url_detail(pk)
return Response(obj)
@detail_route(methods=['post'])
@with_jobs
def parse(self, request, project, jm, pk=None):