Merge "Remove unused parameter in docker_load"
This commit is contained in:
commit
7813ffd875
@ -76,7 +76,7 @@ class Manager(object):
|
|||||||
context, repo, tag, sandbox_image_pull_policy,
|
context, repo, tag, sandbox_image_pull_policy,
|
||||||
sandbox_image_driver)
|
sandbox_image_driver)
|
||||||
if not image_loaded:
|
if not image_loaded:
|
||||||
self.driver.load_image(sandbox_image, image['path'])
|
self.driver.load_image(image['path'])
|
||||||
sandbox_id = self.driver.create_sandbox(context, container,
|
sandbox_id = self.driver.create_sandbox(context, container,
|
||||||
image=sandbox_image)
|
image=sandbox_image)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -97,7 +97,7 @@ class Manager(object):
|
|||||||
image, image_loaded = image_driver.pull_image(
|
image, image_loaded = image_driver.pull_image(
|
||||||
context, repo, tag, image_pull_policy, image_driver_name)
|
context, repo, tag, image_pull_policy, image_driver_name)
|
||||||
if not image_loaded:
|
if not image_loaded:
|
||||||
self.driver.load_image(container.image, image['path'])
|
self.driver.load_image(image['path'])
|
||||||
except exception.ImageNotFound as e:
|
except exception.ImageNotFound as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=reraise):
|
with excutils.save_and_reraise_exception(reraise=reraise):
|
||||||
LOG.error(six.text_type(e))
|
LOG.error(six.text_type(e))
|
||||||
@ -472,7 +472,7 @@ class Manager(object):
|
|||||||
pulled_image, image_loaded = image_driver.pull_image(
|
pulled_image, image_loaded = image_driver.pull_image(
|
||||||
context, image.repo, image.tag)
|
context, image.repo, image.tag)
|
||||||
if not image_loaded:
|
if not image_loaded:
|
||||||
self.driver.load_image(repo_tag, pulled_image['path'])
|
self.driver.load_image(pulled_image['path'])
|
||||||
image_dict = self.driver.inspect_image(repo_tag)
|
image_dict = self.driver.inspect_image(repo_tag)
|
||||||
image.image_id = image_dict['Id']
|
image.image_id = image_dict['Id']
|
||||||
image.size = image_dict['Size']
|
image.size = image_dict['Size']
|
||||||
|
@ -45,7 +45,7 @@ class DockerDriver(driver.ContainerDriver):
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(DockerDriver, self).__init__()
|
super(DockerDriver, self).__init__()
|
||||||
|
|
||||||
def load_image(self, image, image_path=None):
|
def load_image(self, image_path=None):
|
||||||
with docker_utils.docker_client() as docker:
|
with docker_utils.docker_client() as docker:
|
||||||
if image_path:
|
if image_path:
|
||||||
with open(image_path, 'rb') as fd:
|
with open(image_path, 'rb') as fd:
|
||||||
|
@ -511,7 +511,7 @@ class TestManager(base.TestCase):
|
|||||||
mock_pull.assert_any_call(self.context, image.repo, image.tag)
|
mock_pull.assert_any_call(self.context, image.repo, image.tag)
|
||||||
mock_save.assert_called_once()
|
mock_save.assert_called_once()
|
||||||
mock_inspect.assert_called_once_with(repo_tag)
|
mock_inspect.assert_called_once_with(repo_tag)
|
||||||
mock_load.assert_called_once_with(repo_tag, ret['path'])
|
mock_load.assert_called_once_with(ret['path'])
|
||||||
|
|
||||||
@mock.patch.object(fake_driver, 'execute_resize')
|
@mock.patch.object(fake_driver, 'execute_resize')
|
||||||
def test_container_exec_resize(self, mock_resize):
|
def test_container_exec_resize(self, mock_resize):
|
||||||
|
@ -65,8 +65,7 @@ class TestDockerDriver(base.DriverTestCase):
|
|||||||
self.mock_docker.load_image = mock.Mock()
|
self.mock_docker.load_image = mock.Mock()
|
||||||
mock_open_file = mock.mock_open()
|
mock_open_file = mock.mock_open()
|
||||||
with mock.patch('zun.container.docker.driver.open', mock_open_file):
|
with mock.patch('zun.container.docker.driver.open', mock_open_file):
|
||||||
mock_image = mock.MagicMock()
|
self.driver.load_image('test')
|
||||||
self.driver.load_image(mock_image, 'test')
|
|
||||||
self.mock_docker.load_image.assert_called_once_with(
|
self.mock_docker.load_image.assert_called_once_with(
|
||||||
mock_open_file.return_value)
|
mock_open_file.return_value)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user