Merge "Stop and start container rather than use restart directly"

This commit is contained in:
Jenkins 2017-07-31 13:12:38 +00:00 committed by Gerrit Code Review
commit 1ab6822d99
2 changed files with 4 additions and 2 deletions

View File

@ -677,7 +677,8 @@ class DockerWorker(object):
msg="No such container: {}".format(name))
else:
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):
if not self.check_volume():

View File

@ -298,7 +298,8 @@ class TestContainer(base.BaseTestCase):
self.assertTrue(self.dw.changed)
self.dw.dc.containers.assert_called_once_with(all=True)
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):
self.dw = get_DockerWorker({'name': 'fake-container',