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
ad350b95
Kaydet (Commit)
ad350b95
authored
Eyl 14, 2016
tarafından
Joffrey F
Kaydeden (comit)
GitHub
Eyl 14, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #1214 from bfirsh/ignore-not-in-swarm-error-when-leaving
Ignore not in swarm error when force leaving
üst
e6768409
ca51ad29
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
17 deletions
+10
-17
swarm.py
docker/api/swarm.py
+5
-1
service_test.py
tests/integration/service_test.py
+2
-8
swarm_test.py
tests/integration/swarm_test.py
+3
-8
No files found.
docker/api/swarm.py
Dosyayı görüntüle @
ad350b95
from
..
import
utils
import
logging
from
six.moves
import
http_client
from
..
import
utils
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -53,6 +54,9 @@ class SwarmApiMixin(object):
def
leave_swarm
(
self
,
force
=
False
):
url
=
self
.
_url
(
'/swarm/leave'
)
response
=
self
.
_post
(
url
,
params
=
{
'force'
:
force
})
# Ignore "this node is not part of a swarm" error
if
force
and
response
.
status_code
==
http_client
.
NOT_ACCEPTABLE
:
return
True
self
.
_raise_for_status
(
response
)
return
True
...
...
tests/integration/service_test.py
Dosyayı görüntüle @
ad350b95
...
...
@@ -12,10 +12,7 @@ BUSYBOX = helpers.BUSYBOX
class
ServiceTest
(
helpers
.
BaseTestCase
):
def
setUp
(
self
):
super
(
ServiceTest
,
self
)
.
setUp
()
try
:
self
.
client
.
leave_swarm
(
force
=
True
)
except
docker
.
errors
.
APIError
:
pass
self
.
client
.
leave_swarm
(
force
=
True
)
self
.
client
.
init_swarm
(
'eth0'
)
def
tearDown
(
self
):
...
...
@@ -25,10 +22,7 @@ class ServiceTest(helpers.BaseTestCase):
self
.
client
.
remove_service
(
service
[
'ID'
])
except
docker
.
errors
.
APIError
:
pass
try
:
self
.
client
.
leave_swarm
(
force
=
True
)
except
docker
.
errors
.
APIError
:
pass
self
.
client
.
leave_swarm
(
force
=
True
)
def
get_service_name
(
self
):
return
'dockerpytest_{0:x}'
.
format
(
random
.
getrandbits
(
64
))
...
...
tests/integration/swarm_test.py
Dosyayı görüntüle @
ad350b95
...
...
@@ -11,17 +11,11 @@ BUSYBOX = helpers.BUSYBOX
class
SwarmTest
(
helpers
.
BaseTestCase
):
def
setUp
(
self
):
super
(
SwarmTest
,
self
)
.
setUp
()
try
:
self
.
client
.
leave_swarm
(
force
=
True
)
except
docker
.
errors
.
APIError
:
pass
self
.
client
.
leave_swarm
(
force
=
True
)
def
tearDown
(
self
):
super
(
SwarmTest
,
self
)
.
tearDown
()
try
:
self
.
client
.
leave_swarm
(
force
=
True
)
except
docker
.
errors
.
APIError
:
pass
self
.
client
.
leave_swarm
(
force
=
True
)
@requires_api_version
(
'1.24'
)
def
test_init_swarm_simple
(
self
):
...
...
@@ -65,6 +59,7 @@ class SwarmTest(helpers.BaseTestCase):
with
pytest
.
raises
(
docker
.
errors
.
APIError
)
as
exc_info
:
self
.
client
.
inspect_swarm
()
exc_info
.
value
.
response
.
status_code
==
406
assert
self
.
client
.
leave_swarm
(
force
=
True
)
@requires_api_version
(
'1.24'
)
def
test_update_swarm
(
self
):
...
...
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