예제 #1
0
파일: client.py 프로젝트: jsdir/docker-py
 def push(self, repository):
     registry, repository = auth.resolve_repository_name(repository)
     if getattr(self, '_cfg', None) is None:
         self._cfg = auth.load_config()
     authcfg = auth.resolve_authconfig(self._cfg, registry)
     u = self._url("/images/{0}/push".format(repository))
     if utils.compare_version('1.5', self._version) >= 0:
         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, authcfg))
예제 #2
0
 def push(self, repository):
     registry, repository = auth.resolve_repository_name(repository)
     if getattr(self, '_cfg', None) is None:
         self._cfg = auth.load_config()
     authcfg = auth.resolve_authconfig(self._cfg, registry)
     u = self._url("/images/{0}/push".format(repository))
     if utils.compare_version('1.5', self._version) >= 0:
         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, authcfg))
예제 #3
0
파일: client.py 프로젝트: kiorky/docker-py
 def push(self, repository):
     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:
         # do not fail if no atuhentication exists
         # for this specific registry as we can have an anon push
         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, authcfg))
예제 #4
0
파일: client.py 프로젝트: jsdir/docker-py
    def pull(self, repository, tag=None):
        registry, repo_name = auth.resolve_repository_name(repository)
        if repo_name.count(":") == 1:
            repository, tag = repository.rsplit(":", 1)

        params = {
            'tag': tag,
            'fromImage': repository
        }
        headers = {}

        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)
            headers = { 'X-Registry-Auth': auth.encode_header(authcfg) }

        u = self._url("/images/create")
        return self._result(self.post(u, params=params, headers=headers))
예제 #5
0
    def pull(self, repository, tag=None):
        registry, repo_name = auth.resolve_repository_name(repository)
        if repo_name.count(":") == 1:
            repository, tag = repository.rsplit(":", 1)

        params = {
            'tag': tag,
            'fromImage': repository
        }
        headers = {}

        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)
            headers = { 'X-Registry-Auth': auth.encode_header(authcfg) }

        u = self._url("/images/create")
        return self._result(self.post(u, params=params, headers=headers))
예제 #6
0
파일: client.py 프로젝트: kiorky/docker-py
    def pull(self, repository, tag=None):
        registry, repo_name = auth.resolve_repository_name(repository)
        if repo_name.count(":") == 1:
            repository, tag = repository.rsplit(":", 1)

        params = {
            'tag': tag,
            'fromImage': repository
        }
        headers = {}
        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 a readonly pull
            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))