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
644a8254
Unverified
Kaydet (Commit)
644a8254
authored
Ara 14, 2017
tarafından
Joffrey F
Kaydeden (comit)
GitHub
Ara 14, 2017
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #1834 from mhank/1823-support-update-order
Add support for order property when updating a service
üst
20b5b58b
49d09583
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
1 deletion
+32
-1
service.py
docker/api/service.py
+4
-0
services.py
docker/types/services.py
+10
-1
api_service_test.py
tests/integration/api_service_test.py
+18
-0
No files found.
docker/api/service.py
Dosyayı görüntüle @
644a8254
...
...
@@ -19,6 +19,10 @@ def _check_api_features(version, task_template, update_config):
if
'Monitor'
in
update_config
:
raise_version_error
(
'UpdateConfig.monitor'
,
'1.25'
)
if
utils
.
version_lt
(
version
,
'1.29'
):
if
'Order'
in
update_config
:
raise_version_error
(
'UpdateConfig.order'
,
'1.29'
)
if
task_template
is
not
None
:
if
'ForceUpdate'
in
task_template
and
utils
.
version_lt
(
version
,
'1.25'
):
...
...
docker/types/services.py
Dosyayı görüntüle @
644a8254
...
...
@@ -334,9 +334,11 @@ class UpdateConfig(dict):
max_failure_ratio (float): The fraction of tasks that may fail during
an update before the failure action is invoked, specified as a
floating point number between 0 and 1. Default: 0
order (string): Specifies the order of operations when rolling out an
updated task. Either ``start_first`` or ``stop_first`` are accepted.
"""
def
__init__
(
self
,
parallelism
=
0
,
delay
=
None
,
failure_action
=
'continue'
,
monitor
=
None
,
max_failure_ratio
=
None
):
monitor
=
None
,
max_failure_ratio
=
None
,
order
=
None
):
self
[
'Parallelism'
]
=
parallelism
if
delay
is
not
None
:
self
[
'Delay'
]
=
delay
...
...
@@ -360,6 +362,13 @@ class UpdateConfig(dict):
)
self
[
'MaxFailureRatio'
]
=
max_failure_ratio
if
order
is
not
None
:
if
order
not
in
(
'start-first'
,
'stop-first'
):
raise
errors
.
InvalidArgument
(
'order must be either `start-first` or `stop-first`'
)
self
[
'Order'
]
=
order
class
RestartConditionTypesEnum
(
object
):
_values
=
(
...
...
tests/integration/api_service_test.py
Dosyayı görüntüle @
644a8254
...
...
@@ -386,6 +386,24 @@ class ServiceTest(BaseAPIIntegrationTest):
assert
'Env'
in
con_spec
assert
con_spec
[
'Env'
]
==
[
'DOCKER_PY_TEST=1'
]
@requires_api_version
(
'1.29'
)
def
test_create_service_with_update_order
(
self
):
container_spec
=
docker
.
types
.
ContainerSpec
(
BUSYBOX
,
[
'true'
])
task_tmpl
=
docker
.
types
.
TaskTemplate
(
container_spec
)
update_config
=
docker
.
types
.
UpdateConfig
(
parallelism
=
10
,
delay
=
5
,
order
=
'start-first'
)
name
=
self
.
get_service_name
()
svc_id
=
self
.
client
.
create_service
(
task_tmpl
,
update_config
=
update_config
,
name
=
name
)
svc_info
=
self
.
client
.
inspect_service
(
svc_id
)
assert
'UpdateConfig'
in
svc_info
[
'Spec'
]
uc
=
svc_info
[
'Spec'
][
'UpdateConfig'
]
assert
update_config
[
'Parallelism'
]
==
uc
[
'Parallelism'
]
assert
update_config
[
'Delay'
]
==
uc
[
'Delay'
]
assert
update_config
[
'Order'
]
==
uc
[
'Order'
]
@requires_api_version
(
'1.25'
)
def
test_create_service_with_tty
(
self
):
container_spec
=
docker
.
types
.
ContainerSpec
(
...
...
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