зеркало из https://github.com/mozilla/gecko-dev.git
No bug: Don't use proxy for accessing taskcluster index; r=Callek
The index is not protected by scopes, so don't use the proxy to access it Differential Revision: https://phabricator.services.mozilla.com/D77537
This commit is contained in:
Родитель
85d3e9e10f
Коммит
98dd864200
|
@ -5,7 +5,6 @@
|
||||||
from __future__ import absolute_import, print_function, unicode_literals
|
from __future__ import absolute_import, print_function, unicode_literals
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
|
||||||
|
|
||||||
import mozpack.path as mozpath
|
import mozpack.path as mozpath
|
||||||
from mozbuild.base import MozbuildObject
|
from mozbuild.base import MozbuildObject
|
||||||
|
@ -35,9 +34,7 @@ class IndexSearch(OptimizationStrategy):
|
||||||
"Look for a task with one of the given index paths"
|
"Look for a task with one of the given index paths"
|
||||||
for index_path in index_paths:
|
for index_path in index_paths:
|
||||||
try:
|
try:
|
||||||
task_id = find_task_id(
|
task_id = find_task_id(index_path)
|
||||||
index_path,
|
|
||||||
use_proxy=bool(os.environ.get('TASK_ID')))
|
|
||||||
return task_id
|
return task_id
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# 404 will end up here and go on to the next index path
|
# 404 will end up here and go on to the next index path
|
||||||
|
|
|
@ -176,9 +176,9 @@ def get_index_url(index_path, use_proxy=False, multiple=False):
|
||||||
return index_tmpl.format('s' if multiple else '', index_path)
|
return index_tmpl.format('s' if multiple else '', index_path)
|
||||||
|
|
||||||
|
|
||||||
def find_task_id(index_path, use_proxy=False):
|
def find_task_id(index_path):
|
||||||
try:
|
try:
|
||||||
response = _do_request(get_index_url(index_path, use_proxy))
|
response = _do_request(get_index_url(index_path))
|
||||||
except requests.exceptions.HTTPError as e:
|
except requests.exceptions.HTTPError as e:
|
||||||
if e.response.status_code == 404:
|
if e.response.status_code == 404:
|
||||||
raise KeyError("index path {} not found".format(index_path))
|
raise KeyError("index path {} not found".format(index_path))
|
||||||
|
|
Загрузка…
Ссылка в новой задаче