"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "taskcluster/taskgraph/util/docker.py" between
firefox-68.4.0esr.source.tar.xz and firefox-68.4.1esr.source.tar.xz

About: Firefox is Mozilla’s standalone Web browser. Extended Support Release. Source code.

docker.py  (firefox-68.4.0esr.source.tar.xz):docker.py  (firefox-68.4.1esr.source.tar.xz)
# This Source Code Form is subject to the terms of the Mozilla Public # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this # License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function, unicode_literals from __future__ import absolute_import, print_function, unicode_literals
import hashlib import hashlib
import json import json
import os import os
import re import re
import requests
import requests_unixsocket import requests_unixsocket
import sys import sys
import urllib import urllib
import urlparse import urlparse
from mozbuild.util import memoize from mozbuild.util import memoize
from mozpack.files import GeneratedFile from mozpack.files import GeneratedFile
from mozpack.archive import ( from mozpack.archive import (
create_tar_gz_from_files, create_tar_gz_from_files,
) )
skipping to change at line 44 skipping to change at line 45
urllib.urlencode(kwargs), urllib.urlencode(kwargs),
'')) ''))
def post_to_docker(tar, api_path, **kwargs): def post_to_docker(tar, api_path, **kwargs):
"""POSTs a tar file to a given docker API path. """POSTs a tar file to a given docker API path.
The tar argument can be anything that can be passed to requests.post() The tar argument can be anything that can be passed to requests.post()
as data (e.g. iterator or file object). as data (e.g. iterator or file object).
The extra keyword arguments are passed as arguments to the docker API. The extra keyword arguments are passed as arguments to the docker API.
""" """
req = requests_unixsocket.Session().post( # requests-unixsocket doesn't honor requests timeouts
# See https://github.com/msabramo/requests-unixsocket/issues/44
# We have some large docker images that trigger the default timeout,
# so we increase the requests-unixsocket timeout here.
session = requests.Session()
session.mount(
requests_unixsocket.DEFAULT_SCHEME,
requests_unixsocket.UnixAdapter(timeout=120),
)
req = session.post(
docker_url(api_path, **kwargs), docker_url(api_path, **kwargs),
data=tar, data=tar,
stream=True, stream=True,
headers={'Content-Type': 'application/x-tar'}, headers={'Content-Type': 'application/x-tar'},
) )
if req.status_code != 200: if req.status_code != 200:
message = req.json().get('message') message = req.json().get('message')
if not message: if not message:
message = 'docker API returned HTTP code {}'.format( message = 'docker API returned HTTP code {}'.format(
req.status_code) req.status_code)
 End of changes. 2 change blocks. 
1 lines changed or deleted 11 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)