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
532c62ee
Kaydet (Commit)
532c62ee
authored
Mar 28, 2019
tarafından
Hannes Ljungberg
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Add support for rotate_manager_unlock_key
Signed-off-by:
Hannes Ljungberg
<
hannes@5monkeys.se
>
üst
4d62dd0a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
8 deletions
+35
-8
swarm.py
docker/api/swarm.py
+17
-5
swarm.py
docker/models/swarm.py
+5
-3
api_swarm_test.py
tests/integration/api_swarm_test.py
+13
-0
No files found.
docker/api/swarm.py
Dosyayı görüntüle @
532c62ee
...
...
@@ -406,8 +406,10 @@ class SwarmApiMixin(object):
return
True
@utils.minimum_version
(
'1.24'
)
def
update_swarm
(
self
,
version
,
swarm_spec
=
None
,
rotate_worker_token
=
False
,
rotate_manager_token
=
False
):
def
update_swarm
(
self
,
version
,
swarm_spec
=
None
,
rotate_worker_token
=
False
,
rotate_manager_token
=
False
,
rotate_manager_unlock_key
=
False
):
"""
Update the Swarm's configuration
...
...
@@ -421,6 +423,8 @@ class SwarmApiMixin(object):
``False``.
rotate_manager_token (bool): Rotate the manager join token.
Default: ``False``.
rotate_manager_unlock_key (bool): Rotate the manager unlock key.
Default: ``False``.
Returns:
``True`` if the request went through.
...
...
@@ -429,12 +433,20 @@ class SwarmApiMixin(object):
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
url
=
self
.
_url
(
'/swarm/update'
)
response
=
self
.
_post_json
(
url
,
data
=
swarm_spec
,
params
=
{
params
=
{
'rotateWorkerToken'
:
rotate_worker_token
,
'rotateManagerToken'
:
rotate_manager_token
,
'version'
:
version
})
}
if
rotate_manager_unlock_key
:
if
utils
.
version_lt
(
self
.
_version
,
'1.25'
):
raise
errors
.
InvalidVersion
(
'Rotate manager unlock key '
'is only available for API version >= 1.25'
)
params
[
'rotateManagerUnlockKey'
]
=
rotate_manager_unlock_key
response
=
self
.
_post_json
(
url
,
data
=
swarm_spec
,
params
=
params
)
self
.
_raise_for_status
(
response
)
return
True
docker/models/swarm.py
Dosyayı görüntüle @
532c62ee
...
...
@@ -151,7 +151,7 @@ class Swarm(Model):
unlock
.
__doc__
=
APIClient
.
unlock_swarm
.
__doc__
def
update
(
self
,
rotate_worker_token
=
False
,
rotate_manager_token
=
False
,
**
kwargs
):
rotate_manager_unlock_key
=
False
,
**
kwargs
):
"""
Update the swarm's configuration.
...
...
@@ -164,7 +164,8 @@ class Swarm(Model):
``False``.
rotate_manager_token (bool): Rotate the manager join token.
Default: ``False``.
rotate_manager_unlock_key (bool): Rotate the manager unlock key.
Default: ``False``.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
...
...
@@ -178,5 +179,6 @@ class Swarm(Model):
version
=
self
.
version
,
swarm_spec
=
self
.
client
.
api
.
create_swarm_spec
(
**
kwargs
),
rotate_worker_token
=
rotate_worker_token
,
rotate_manager_token
=
rotate_manager_token
rotate_manager_token
=
rotate_manager_token
,
rotate_manager_unlock_key
=
rotate_manager_unlock_key
)
tests/integration/api_swarm_test.py
Dosyayı görüntüle @
532c62ee
...
...
@@ -236,6 +236,19 @@ class SwarmTest(BaseAPIIntegrationTest):
assert
e
.
value
.
response
.
status_code
>=
400
@requires_api_version
(
'1.25'
)
def
test_rotate_manager_unlock_key
(
self
):
spec
=
self
.
client
.
create_swarm_spec
(
autolock_managers
=
True
)
assert
self
.
init_swarm
(
swarm_spec
=
spec
)
swarm_info
=
self
.
client
.
inspect_swarm
()
key_1
=
self
.
client
.
get_unlock_key
()
assert
self
.
client
.
update_swarm
(
version
=
swarm_info
[
'Version'
][
'Index'
],
rotate_manager_unlock_key
=
True
)
key_2
=
self
.
client
.
get_unlock_key
()
assert
key_1
[
'UnlockKey'
]
!=
key_2
[
'UnlockKey'
]
@requires_api_version
(
'1.30'
)
def
test_init_swarm_data_path_addr
(
self
):
assert
self
.
init_swarm
(
data_path_addr
=
'eth0'
)
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