Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
02e660da
Unverified
Kaydet (Commit)
02e660da
authored
Mar 26, 2019
tarafından
Ian Campbell
Kaydeden (comit)
GitHub
Mar 26, 2019
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #2227 from docker/2225-inspect_distrib_auth
Add registry auth header to inspect_distribution requests
üst
c1fea8ee
b6f6e727
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
16 deletions
+32
-16
image.py
docker/api/image.py
+23
-10
images.py
docker/models/images.py
+9
-6
No files found.
docker/api/image.py
Dosyayı görüntüle @
02e660da
...
...
@@ -247,12 +247,15 @@ class ImageApiMixin(object):
@utils.minimum_version
(
'1.30'
)
@utils.check_resource
(
'image'
)
def
inspect_distribution
(
self
,
image
):
def
inspect_distribution
(
self
,
image
,
auth_config
=
None
):
"""
Get image digest and platform information by contacting the registry.
Args:
image (str): The image name to inspect
auth_config (dict): Override the credentials that are found in the
config for this request. ``auth_config`` should contain the
``username`` and ``password`` keys to be valid.
Returns:
(dict): A dict containing distribution data
...
...
@@ -261,9 +264,21 @@ class ImageApiMixin(object):
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
registry
,
_
=
auth
.
resolve_repository_name
(
image
)
headers
=
{}
if
auth_config
is
None
:
header
=
auth
.
get_config_header
(
self
,
registry
)
if
header
:
headers
[
'X-Registry-Auth'
]
=
header
else
:
log
.
debug
(
'Sending supplied auth config'
)
headers
[
'X-Registry-Auth'
]
=
auth
.
encode_header
(
auth_config
)
url
=
self
.
_url
(
"/distribution/{0}/json"
,
image
)
return
self
.
_result
(
self
.
_get
(
self
.
_url
(
"/distribution/{0}/json"
,
image
)
),
True
self
.
_get
(
url
,
headers
=
headers
),
True
)
def
load_image
(
self
,
data
,
quiet
=
None
):
...
...
@@ -336,10 +351,9 @@ class ImageApiMixin(object):
tag (str): The tag to pull
stream (bool): Stream the output as a generator. Make sure to
consume the generator, otherwise pull might get cancelled.
auth_config (dict): Override the credentials that
:py:meth:`~docker.api.daemon.DaemonApiMixin.login` has set for
this request. ``auth_config`` should contain the ``username``
and ``password`` keys to be valid.
auth_config (dict): Override the credentials that are found in the
config for this request. ``auth_config`` should contain the
``username`` and ``password`` keys to be valid.
decode (bool): Decode the JSON data from the server into dicts.
Only applies with ``stream=True``
platform (str): Platform in the format ``os[/arch[/variant]]``
...
...
@@ -414,10 +428,9 @@ class ImageApiMixin(object):
repository (str): The repository to push to
tag (str): An optional tag to push
stream (bool): Stream the output as a blocking generator
auth_config (dict): Override the credentials that
:py:meth:`~docker.api.daemon.DaemonApiMixin.login` has set for
this request. ``auth_config`` should contain the ``username``
and ``password`` keys to be valid.
auth_config (dict): Override the credentials that are found in the
config for this request. ``auth_config`` should contain the
``username`` and ``password`` keys to be valid.
decode (bool): Decode the JSON data from the server into dicts.
Only applies with ``stream=True``
...
...
docker/models/images.py
Dosyayı görüntüle @
02e660da
...
...
@@ -315,22 +315,26 @@ class ImageCollection(Collection):
"""
return
self
.
prepare_model
(
self
.
client
.
api
.
inspect_image
(
name
))
def
get_registry_data
(
self
,
name
):
def
get_registry_data
(
self
,
name
,
auth_config
=
None
):
"""
Gets the registry data for an image.
Args:
name (str): The name of the image.
auth_config (dict): Override the credentials that are found in the
config for this request. ``auth_config`` should contain the
``username`` and ``password`` keys to be valid.
Returns:
(:py:class:`RegistryData`): The data object.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
return
RegistryData
(
image_name
=
name
,
attrs
=
self
.
client
.
api
.
inspect_distribution
(
name
),
attrs
=
self
.
client
.
api
.
inspect_distribution
(
name
,
auth_config
),
client
=
self
.
client
,
collection
=
self
,
)
...
...
@@ -404,10 +408,9 @@ class ImageCollection(Collection):
Args:
repository (str): The repository to pull
tag (str): The tag to pull
auth_config (dict): Override the credentials that
:py:meth:`~docker.client.DockerClient.login` has set for
this request. ``auth_config`` should contain the ``username``
and ``password`` keys to be valid.
auth_config (dict): Override the credentials that are found in the
config for this request. ``auth_config`` should contain the
``username`` and ``password`` keys to be valid.
platform (str): Platform in the format ``os[/arch[/variant]]``
Returns:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment