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
14524f19
Kaydet (Commit)
14524f19
authored
Agu 09, 2018
tarafından
Joffrey F
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add version checks and test
Signed-off-by:
Joffrey F
<
joffrey@docker.com
>
üst
0c72cd62
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
2 deletions
+23
-2
service.py
docker/api/service.py
+6
-0
services.py
docker/types/services.py
+3
-2
api_service_test.py
tests/integration/api_service_test.py
+14
-0
No files found.
docker/api/service.py
Dosyayı görüntüle @
14524f19
...
...
@@ -18,6 +18,12 @@ def _check_api_features(version, task_template, update_config, endpoint_spec):
if
'Monitor'
in
update_config
:
raise_version_error
(
'UpdateConfig.monitor'
,
'1.25'
)
if
utils
.
version_lt
(
version
,
'1.28'
):
if
update_config
.
get
(
'FailureAction'
)
==
'rollback'
:
raise_version_error
(
'UpdateConfig.failure_action rollback'
,
'1.28'
)
if
utils
.
version_lt
(
version
,
'1.29'
):
if
'Order'
in
update_config
:
raise_version_error
(
'UpdateConfig.order'
,
'1.29'
)
...
...
docker/types/services.py
Dosyayı görüntüle @
14524f19
...
...
@@ -371,7 +371,8 @@ class UpdateConfig(dict):
delay (int): Amount of time between updates, in nanoseconds.
failure_action (string): Action to take if an updated task fails to
run, or stops running during the update. Acceptable values are
``continue``, ``rollback`` and ``pause``. Default: ``continue``
``continue``, ``pause``, as well as ``rollback`` since API v1.28.
Default: ``continue``
monitor (int): Amount of time to monitor each updated task for
failures, in nanoseconds.
max_failure_ratio (float): The fraction of tasks that may fail during
...
...
@@ -387,7 +388,7 @@ class UpdateConfig(dict):
self
[
'Delay'
]
=
delay
if
failure_action
not
in
(
'pause'
,
'continue'
,
'rollback'
):
raise
errors
.
InvalidArgument
(
'failure_action must be
either `pause` or `continue`.
'
'failure_action must be
one of `pause`, `continue`, `rollback`
'
)
self
[
'FailureAction'
]
=
failure_action
...
...
tests/integration/api_service_test.py
Dosyayı görüntüle @
14524f19
...
...
@@ -281,6 +281,20 @@ class ServiceTest(BaseAPIIntegrationTest):
assert
update_config
[
'Delay'
]
==
uc
[
'Delay'
]
assert
update_config
[
'FailureAction'
]
==
uc
[
'FailureAction'
]
@requires_api_version
(
'1.28'
)
def
test_create_service_with_failure_action_rollback
(
self
):
container_spec
=
docker
.
types
.
ContainerSpec
(
BUSYBOX
,
[
'true'
])
task_tmpl
=
docker
.
types
.
TaskTemplate
(
container_spec
)
update_config
=
docker
.
types
.
UpdateConfig
(
failure_action
=
'rollback'
)
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
[
'FailureAction'
]
==
uc
[
'FailureAction'
]
@requires_api_version
(
'1.25'
)
def
test_create_service_with_update_config_monitor
(
self
):
container_spec
=
docker
.
types
.
ContainerSpec
(
'busybox'
,
[
'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