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
ea442129
Unverified
Kaydet (Commit)
ea442129
authored
Ock 31, 2018
tarafından
Joffrey F
Kaydeden (comit)
GitHub
Ock 31, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #1888 from docker/1884-create_volumes_win32
Correctly parse volumes with Windows paths
üst
82e57a4c
209ae242
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
11 deletions
+20
-11
containers.py
docker/models/containers.py
+15
-9
models_containers_test.py
tests/unit/models_containers_test.py
+5
-2
No files found.
docker/models/containers.py
Dosyayı görüntüle @
ea442129
import
copy
import
copy
import
ntpath
from
collections
import
namedtuple
from
collections
import
namedtuple
from
..api
import
APIClient
from
..api
import
APIClient
...
@@ -995,20 +996,25 @@ def _create_container_args(kwargs):
...
@@ -995,20 +996,25 @@ def _create_container_args(kwargs):
# sort to make consistent for tests
# sort to make consistent for tests
create_kwargs
[
'ports'
]
=
[
tuple
(
p
.
split
(
'/'
,
1
))
create_kwargs
[
'ports'
]
=
[
tuple
(
p
.
split
(
'/'
,
1
))
for
p
in
sorted
(
port_bindings
.
keys
())]
for
p
in
sorted
(
port_bindings
.
keys
())]
binds
=
create_kwargs
[
'host_config'
]
.
get
(
'Binds'
)
if
volumes
:
if
binds
:
if
isinstance
(
volumes
,
dict
):
create_kwargs
[
'volumes'
]
=
[
_host_volume_from_bind
(
v
)
for
v
in
binds
]
create_kwargs
[
'volumes'
]
=
[
v
.
get
(
'bind'
)
for
v
in
volumes
.
values
()
]
else
:
create_kwargs
[
'volumes'
]
=
[
_host_volume_from_bind
(
v
)
for
v
in
volumes
]
return
create_kwargs
return
create_kwargs
def
_host_volume_from_bind
(
bind
):
def
_host_volume_from_bind
(
bind
):
bits
=
bind
.
split
(
':'
)
drive
,
rest
=
ntpath
.
splitdrive
(
bind
)
if
len
(
bits
)
==
1
:
bits
=
rest
.
split
(
':'
,
1
)
return
bits
[
0
]
if
len
(
bits
)
==
1
or
bits
[
1
]
in
(
'ro'
,
'rw'
):
elif
len
(
bits
)
==
2
and
bits
[
1
]
in
(
'ro'
,
'rw'
):
return
drive
+
bits
[
0
]
return
bits
[
0
]
else
:
else
:
return
bits
[
1
]
return
bits
[
1
]
.
rstrip
(
':ro'
)
.
rstrip
(
':rw'
)
ExecResult
=
namedtuple
(
'ExecResult'
,
'exit_code,output'
)
ExecResult
=
namedtuple
(
'ExecResult'
,
'exit_code,output'
)
...
...
tests/unit/models_containers_test.py
Dosyayı görüntüle @
ea442129
...
@@ -102,6 +102,7 @@ class ContainerCollectionTest(unittest.TestCase):
...
@@ -102,6 +102,7 @@ class ContainerCollectionTest(unittest.TestCase):
'volumename:/mnt/vol3'
,
'volumename:/mnt/vol3'
,
'/volumewithnohostpath'
,
'/volumewithnohostpath'
,
'/anothervolumewithnohostpath:ro'
,
'/anothervolumewithnohostpath:ro'
,
'C:
\\
windows
\\
path:D:
\\
hello
\\
world:rw'
],
],
volumes_from
=
[
'container'
],
volumes_from
=
[
'container'
],
working_dir
=
'/code'
working_dir
=
'/code'
...
@@ -120,7 +121,8 @@ class ContainerCollectionTest(unittest.TestCase):
...
@@ -120,7 +121,8 @@ class ContainerCollectionTest(unittest.TestCase):
'/var/www:/mnt/vol1:ro'
,
'/var/www:/mnt/vol1:ro'
,
'volumename:/mnt/vol3'
,
'volumename:/mnt/vol3'
,
'/volumewithnohostpath'
,
'/volumewithnohostpath'
,
'/anothervolumewithnohostpath:ro'
'/anothervolumewithnohostpath:ro'
,
'C:
\\
windows
\\
path:D:
\\
hello
\\
world:rw'
],
],
'BlkioDeviceReadBps'
:
[{
'Path'
:
'foo'
,
'Rate'
:
3
}],
'BlkioDeviceReadBps'
:
[{
'Path'
:
'foo'
,
'Rate'
:
3
}],
'BlkioDeviceReadIOps'
:
[{
'Path'
:
'foo'
,
'Rate'
:
3
}],
'BlkioDeviceReadIOps'
:
[{
'Path'
:
'foo'
,
'Rate'
:
3
}],
...
@@ -191,7 +193,8 @@ class ContainerCollectionTest(unittest.TestCase):
...
@@ -191,7 +193,8 @@ class ContainerCollectionTest(unittest.TestCase):
'/mnt/vol1'
,
'/mnt/vol1'
,
'/mnt/vol3'
,
'/mnt/vol3'
,
'/volumewithnohostpath'
,
'/volumewithnohostpath'
,
'/anothervolumewithnohostpath'
'/anothervolumewithnohostpath'
,
'D:
\\
hello
\\
world'
],
],
working_dir
=
'/code'
working_dir
=
'/code'
)
)
...
...
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