Merge "Stop and start container rather than use restart directly"
This commit is contained in:
commit
1ab6822d99
@ -677,7 +677,8 @@ class DockerWorker(object):
|
|||||||
msg="No such container: {}".format(name))
|
msg="No such container: {}".format(name))
|
||||||
else:
|
else:
|
||||||
self.changed = True
|
self.changed = True
|
||||||
self.dc.restart(name, timeout=graceful_timeout)
|
self.dc.stop(name, timeout=graceful_timeout)
|
||||||
|
self.dc.start(name)
|
||||||
|
|
||||||
def create_volume(self):
|
def create_volume(self):
|
||||||
if not self.check_volume():
|
if not self.check_volume():
|
||||||
|
@ -298,7 +298,8 @@ class TestContainer(base.BaseTestCase):
|
|||||||
self.assertTrue(self.dw.changed)
|
self.assertTrue(self.dw.changed)
|
||||||
self.dw.dc.containers.assert_called_once_with(all=True)
|
self.dw.dc.containers.assert_called_once_with(all=True)
|
||||||
self.dw.dc.inspect_container.assert_called_once_with('my_container')
|
self.dw.dc.inspect_container.assert_called_once_with('my_container')
|
||||||
self.dw.dc.restart.assert_called_once_with('my_container', timeout=10)
|
self.dw.dc.stop.assert_called_once_with('my_container', timeout=10)
|
||||||
|
self.dw.dc.start.assert_called_once_with('my_container')
|
||||||
|
|
||||||
def test_restart_container_not_exists(self):
|
def test_restart_container_not_exists(self):
|
||||||
self.dw = get_DockerWorker({'name': 'fake-container',
|
self.dw = get_DockerWorker({'name': 'fake-container',
|
||||||
|
Loading…
Reference in New Issue
Block a user