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
5800c4ab
Kaydet (Commit)
5800c4ab
authored
Agu 22, 2014
tarafından
Cameron Maske
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Allow pushing a single tag.
Closes #282
üst
710f3725
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
4 deletions
+35
-4
README.md
README.md
+1
-1
client.py
docker/client.py
+9
-3
test.py
tests/test.py
+25
-0
No files found.
README.md
Dosyayı görüntüle @
5800c4ab
...
...
@@ -201,7 +201,7 @@ c.pull(repository, tag=None, stream=False)
Identical to the
`docker pull`
command.
```
python
c
.
push
(
repository
,
stream
=
False
)
c
.
push
(
repository
,
tag
=
None
,
stream
=
False
)
```
Identical to the
`docker push`
command.
...
...
docker/client.py
Dosyayı görüntüle @
5800c4ab
...
...
@@ -747,9 +747,14 @@ class Client(requests.Session):
else
:
return
self
.
_result
(
response
)
def
push
(
self
,
repository
,
stream
=
False
):
def
push
(
self
,
repository
,
tag
=
None
,
stream
=
False
):
if
not
tag
:
repository
,
tag
=
utils
.
parse_repository_tag
(
repository
)
registry
,
repo_name
=
auth
.
resolve_repository_name
(
repository
)
u
=
self
.
_url
(
"/images/{0}/push"
.
format
(
repository
))
params
=
{
'tag'
:
tag
}
headers
=
{}
if
utils
.
compare_version
(
'1.5'
,
self
.
_version
)
>=
0
:
...
...
@@ -765,9 +770,10 @@ class Client(requests.Session):
if
authcfg
:
headers
[
'X-Registry-Auth'
]
=
auth
.
encode_header
(
authcfg
)
response
=
self
.
_post_json
(
u
,
None
,
headers
=
headers
,
stream
=
stream
)
response
=
self
.
_post_json
(
u
,
None
,
headers
=
headers
,
stream
=
stream
,
params
=
params
)
else
:
response
=
self
.
_post_json
(
u
,
None
,
stream
=
stream
)
response
=
self
.
_post_json
(
u
,
None
,
stream
=
stream
,
params
=
params
)
return
stream
and
self
.
_stream_helper
(
response
)
\
or
self
.
_result
(
response
)
...
...
tests/test.py
Dosyayı görüntüle @
5800c4ab
...
...
@@ -1306,6 +1306,28 @@ class DockerClientTest(Cleanup, unittest.TestCase):
fake_request
.
assert_called_with
(
url_prefix
+
'images/test_image/push'
,
params
=
{
'tag'
:
None
},
data
=
'{}'
,
headers
=
{
'Content-Type'
:
'application/json'
},
stream
=
False
,
timeout
=
docker
.
client
.
DEFAULT_TIMEOUT_SECONDS
)
def
test_push_image_with_tag
(
self
):
try
:
with
mock
.
patch
(
'docker.auth.auth.resolve_authconfig'
,
fake_resolve_authconfig
):
self
.
client
.
push
(
fake_api
.
FAKE_IMAGE_NAME
,
tag
=
fake_api
.
FAKE_TAG_NAME
)
except
Exception
as
e
:
self
.
fail
(
'Command should not raise exception: {0}'
.
format
(
e
))
fake_request
.
assert_called_with
(
url_prefix
+
'images/test_image/push'
,
params
=
{
'tag'
:
fake_api
.
FAKE_TAG_NAME
,
},
data
=
'{}'
,
headers
=
{
'Content-Type'
:
'application/json'
},
stream
=
False
,
...
...
@@ -1322,6 +1344,9 @@ class DockerClientTest(Cleanup, unittest.TestCase):
fake_request
.
assert_called_with
(
url_prefix
+
'images/test_image/push'
,
params
=
{
'tag'
:
None
},
data
=
'{}'
,
headers
=
{
'Content-Type'
:
'application/json'
},
stream
=
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