mirror of https://github.com/docker/docker-py.git
Removed logger dependency (no warnings) + do not break push for API versions < 1.5
This commit is contained in:
parent
b2c2a1b87f
commit
6c55b63f22
|
@ -3,7 +3,7 @@ ChangeLog
|
|||
|
||||
0.2.2
|
||||
-----
|
||||
* Authorize but warn anonym push/pull
|
||||
* Allow anonymous push/pull (no authconfig detected)
|
||||
|
||||
0.2.1
|
||||
-----
|
||||
|
|
|
@ -19,16 +19,12 @@ import shlex
|
|||
import requests
|
||||
import requests.exceptions
|
||||
import six
|
||||
import logging
|
||||
|
||||
import auth
|
||||
import unixconn
|
||||
import utils
|
||||
|
||||
|
||||
logger = logging.getLogger('docker-py')
|
||||
|
||||
|
||||
class APIError(requests.exceptions.HTTPError):
|
||||
def __init__(self, message, response, explanation=None):
|
||||
super(APIError, self).__init__(message, response=response)
|
||||
|
@ -393,11 +389,7 @@ class Client(requests.Session):
|
|||
authcfg = auth.resolve_authconfig(self._cfg, registry)
|
||||
# do not fail if no atuhentication exists
|
||||
# for this specific registry as we can have a readonly pull
|
||||
if not authcfg:
|
||||
logger.warn(
|
||||
'No authentication bits found for {0}'.format(
|
||||
registry))
|
||||
else:
|
||||
if authcfg:
|
||||
headers['X-Registry-Auth'] = auth.encode_header(authcfg)
|
||||
u = self._url("/images/create")
|
||||
return self._result(self.post(u, params=params, headers=headers))
|
||||
|
@ -406,19 +398,16 @@ class Client(requests.Session):
|
|||
registry, repository = auth.resolve_repository_name(repository)
|
||||
u = self._url("/images/{0}/push".format(repository))
|
||||
headers = {}
|
||||
if getattr(self, '_cfg', None) is None:
|
||||
self._cfg = auth.load_config()
|
||||
authcfg = auth.resolve_authconfig(self._cfg, registry)
|
||||
if utils.compare_version('1.5', self._version) >= 0:
|
||||
if getattr(self, '_cfg', None) is None:
|
||||
self._cfg = auth.load_config()
|
||||
authcfg = auth.resolve_authconfig(self._cfg, registry)
|
||||
# do not fail if no atuhentication exists
|
||||
# for this specific registry as we can have an anon push
|
||||
if not authcfg:
|
||||
logger.warn(
|
||||
'No authentication bits found for {0}'.format(
|
||||
registry))
|
||||
else:
|
||||
if authcfg:
|
||||
headers['X-Registry-Auth'] = auth.encode_header(authcfg)
|
||||
return self._result(self._post_json(u, None, headers=headers))
|
||||
return self._result(self._post_json(u, None, headers=headers))
|
||||
return self._result(self._post_json(u, authcfg))
|
||||
|
||||
def remove_container(self, container, v=False):
|
||||
if isinstance(container, dict):
|
||||
|
|
Loading…
Reference in New Issue