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
b585ec59
Kaydet (Commit)
b585ec59
authored
Mar 03, 2017
tarafından
Frank Sachsenheim
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Adds a 'labels' property to the image model
Signed-off-by:
Frank Sachsenheim
<
funkyfuture@riseup.net
>
üst
1cd56b9f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
0 deletions
+15
-0
images.py
docker/models/images.py
+8
-0
images.rst
docs/images.rst
+1
-0
fake_api.py
tests/unit/fake_api.py
+1
-0
models_images_test.py
tests/unit/models_images_test.py
+5
-0
No files found.
docker/models/images.py
Dosyayı görüntüle @
b585ec59
...
...
@@ -15,6 +15,14 @@ class Image(Model):
def
__repr__
(
self
):
return
"<
%
s: '
%
s'>"
%
(
self
.
__class__
.
__name__
,
"', '"
.
join
(
self
.
tags
))
@property
def
labels
(
self
):
"""
The labels of an image as dictionary.
"""
result
=
self
.
attrs
[
'Config'
]
.
get
(
'Labels'
)
return
result
or
{}
@property
def
short_id
(
self
):
"""
...
...
docs/images.rst
Dosyayı görüntüle @
b585ec59
...
...
@@ -29,6 +29,7 @@ Image objects
.. autoattribute:: id
.. autoattribute:: short_id
.. autoattribute:: tags
.. autoattribute:: labels
.. py:attribute:: attrs
The raw representation of this object from the server.
...
...
tests/unit/fake_api.py
Dosyayı görüntüle @
b585ec59
...
...
@@ -158,6 +158,7 @@ def get_fake_inspect_image():
'Parent'
:
"27cf784147099545"
,
'Created'
:
"2013-03-23T22:24:18.818426-07:00"
,
'Container'
:
FAKE_CONTAINER_ID
,
'Config'
:
{
'Labels'
:
{
'bar'
:
'foo'
}},
'ContainerConfig'
:
{
"Hostname"
:
""
,
...
...
tests/unit/models_images_test.py
Dosyayı görüntüle @
b585ec59
...
...
@@ -21,6 +21,11 @@ class ImageCollectionTest(unittest.TestCase):
assert
isinstance
(
image
,
Image
)
assert
image
.
id
==
FAKE_IMAGE_ID
def
test_labels
(
self
):
client
=
make_fake_client
()
image
=
client
.
images
.
get
(
FAKE_IMAGE_ID
)
assert
image
.
labels
==
{
'bar'
:
'foo'
}
def
test_list
(
self
):
client
=
make_fake_client
()
images
=
client
.
images
.
list
(
all
=
True
)
...
...
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