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
b3657964
Kaydet (Commit)
b3657964
authored
Eki 22, 2014
tarafından
Patrick Hensley
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Use shlex for exec string cmd, added integration testcase.
üst
3ac4c788
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
client.py
docker/client.py
+2
-2
integration_test.py
tests/integration_test.py
+17
-2
No files found.
docker/client.py
Dosyayı görüntüle @
b3657964
...
...
@@ -548,8 +548,8 @@ class Client(requests.Session):
raise
Exception
(
'Exec is not supported in API < 1.15!'
)
if
isinstance
(
container
,
dict
):
container
=
container
.
get
(
'Id'
)
if
not
isinstance
(
cmd
,
(
list
,
tuple
)
):
cmd
=
[
cmd
]
if
isinstance
(
cmd
,
six
.
string_types
):
cmd
=
shlex
.
split
(
str
(
cmd
))
data
=
{
'Container'
:
container
,
...
...
tests/integration_test.py
Dosyayı görüntüle @
b3657964
...
...
@@ -630,7 +630,8 @@ class TestRestartingContainer(BaseTestCase):
class
TestExecuteCommand
(
BaseTestCase
):
def
runTest
(
self
):
container
=
self
.
client
.
create_container
(
'busybox'
,
[
'false'
])
container
=
self
.
client
.
create_container
(
'busybox'
,
'cat'
,
detach
=
True
,
stdin_open
=
True
)
id
=
container
[
'Id'
]
self
.
client
.
start
(
id
)
self
.
tmp_containers
.
append
(
id
)
...
...
@@ -640,9 +641,23 @@ class TestExecuteCommand(BaseTestCase):
self
.
assertEqual
(
res
,
expected
)
class
TestExecuteCommandString
(
BaseTestCase
):
def
runTest
(
self
):
container
=
self
.
client
.
create_container
(
'busybox'
,
'cat'
,
detach
=
True
,
stdin_open
=
True
)
id
=
container
[
'Id'
]
self
.
client
.
start
(
id
)
self
.
tmp_containers
.
append
(
id
)
res
=
self
.
client
.
execute
(
id
,
'echo hello world'
,
stdout
=
True
)
expected
=
b
'hello world
\n
'
if
six
.
PY3
else
'hello world
\n
'
self
.
assertEqual
(
res
,
expected
)
class
TestExecuteCommandStreaming
(
BaseTestCase
):
def
runTest
(
self
):
container
=
self
.
client
.
create_container
(
'busybox'
,
[
'false'
])
container
=
self
.
client
.
create_container
(
'busybox'
,
'cat'
,
detach
=
True
,
stdin_open
=
True
)
id
=
container
[
'Id'
]
self
.
client
.
start
(
id
)
self
.
tmp_containers
.
append
(
id
)
...
...
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